Jump to content

Recommended Posts

Posted (edited)

The attached mission picks a random number associated with a pre-defined group and then just picks again until it finds one that hasn't already been spawned. Oddly this doesn't work all the time and will just "spin" occasionally and I haven't figured out why yet. When it does work it can take more than what I think is an acceptable amount of time because as more spawns happen the chances of randomly picking the same number goes up.

 

 

Is there a better way to do this without getting overly complex? I know there are other ways which would require setting up a much larger number of flags but I'd like to avoid that. Just trying to keep it simple. Thanks.

Random Spawn.miz

Edited by McShetty
Spelling
Posted

By doing it a little backwards.

 

 

Switch Condition>whatever>Set Flag 1

Once>Flag 1 True && Random 5%>Set Flag 1 False && Activate Group 1

Once>Flag 1 True && Random 5%>Set Flag 1 False && Activate Group 2

Once>Flag 1 True && Random 5%>Set Flag 1 False && Activate Group 3

Once>Flag 1 True && Random 5%>Set Flag 1 False && Activate Group 4

 

 

Basically the game will keep evaluating the conditions. If the random chance occurs when flag 1 is true then it is allowed to execute the the action. The action immediately sets flag 1 to false so no other choices can be made at that time. Whenever you set flag 1 to true again another choice will be made, however because the triggers are set to "Once" the action can only be executed once and any previous choice is effectively removed.

 

It might take a few seconds for a random choice to be chosen, but as long as there is a choice available and flag 1 remains true, then the group will spawn.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...