Jump to content
granpa_jo

Script to randomly select a end point from a pool of end points?

Recommended Posts

I've got 5 triggers set to end the mission, and I'd like for the mission to select one of the 5 for some randomness each time the mission is played. Anyone have any info on a script that can pull this off? I'd love to have it select from a random spawn point at the start of the mission as well, but I figure those two script might be related.

 

Thanks!

 

Super Scripting noob.

Share this post


Link to post
Share on other sites

Are the ends  not related to mission status? Accomplish success or failed?

Share this post


Link to post
Share on other sites

Its basically an escape mission. CSAT player needs to get to a specific point on the map to win. I want the specific point to be randomly selected at the start of the mission from a pool of 5 possible end points. I've been working on this literally all day, watching tutorials and reading forums, and oddly enough not a lot of it has been really helpful in understanding how this sort of thing works. I read the damn eden editor wiki so much I think my eyes bleed and its starting to get frustrating. 

 

Sorry to rant, just getting real tired of looking at this and banging my head on it. Either I'm just really stupid or the editor requires an advanced degree in programming. 

Share this post


Link to post
Share on other sites


_end = selectRandom ["end1","end2","end3","end4","end5"];

[_end, true, true] remoteExec ["BIS_fnc_endMission", 0];

Share this post


Link to post
Share on other sites

Thanks, that'll help a lot. One last question if you don't mind. Does this work with a trigger with the end game function, or is it something else I haven't even considered?

Share this post


Link to post
Share on other sites
_end = selectRandom ["end1","end2","end3","end4","end5"];[_end, true, true] remoteExec ["BIS_fnc_endMission", 0];
I think he means end point, as in final objective, final waypoint, not the end screen. I could help, but my editor skills are lacking since Eden, and this whole idea would be easier if the whole mission itself was scripted (but that's just me :P).

EDIT: Nevermind...

Share this post


Link to post
Share on other sites

I think he means end point, as in final objective, final waypoint, not the end screen. I could help, but my editor skills are lacking since Eden, and this whole idea would be easier if the whole mission itself was scripted (but that's just me :P).

EDIT: Nevermind...

 

I wish I could do that. Total noob at this, and I figured a simple A-B type mission would be a good place to start, and cut my teeth on this thing, but it's proven far more difficult than I could ever have imagined. Placing basic stuff is great, but making a mission that amounts to more than AI walking around to shoot at is tough. I used to edit maps and shit for call of duty up to CoD2, and I though those editors were tough. I'm trying to read and take in as much as I can from tutorials and documents online, but this is not user friendly from a new person's perspective. I'm not trying to be a negative nancy here or dig at BIS, I know this tool is powerful, but throw your audience a bone and explain things, and make things easier. The wiki has minimal info at best, and I honestly think if BIS would work on a user friendly mode they'd probably see wider acceptance of the game. I work at a software company, I'm not an unsavvy person when it comes to tech and software, and this is just breaking my head. Again, sorry to rant. I'm almost at the "punch my monitor" stage of frustrations here.

Share this post


Link to post
Share on other sites

Oh we all have faced that in early skills.

With the time you understand more and those frustrations are changes into curiosity.

It will happen for you too.

Share this post


Link to post
Share on other sites
  1. Set up all of your triggers as if they were the only end trigger
  2. Put an initServer.sqf into the mission folder (runs on mission start on the server only, see here)
  3. Then do this inside the file
_triggers  = [End1, End2, End3, End4, ...]; // Initialise array of triggers using their editor names (they translate to global variables)
 
_chosen = _triggers deleteAt floor(random(count _triggers)); // Randomly selects one of the triggers from the array
{ deleteVehicle _x; } forEach _triggers; // Deletes the rest of the triggers

The alternative is to do the opposite and have no triggers in the mission file, then initialise a single trigger via script. This way is probably easier to digest if you're not experienced with sqf though. If you're using tasks and stuff then you can use the _chosen (local variable) trigger further in the script to have everything point players to the correct trigger.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×