Jump to content

Randomizing "Embark If" commands...


DLDC_Sims_guy

Recommended Posts

What is the best way to randomize the "Embark If" command to set a unit off on variable routes? I understand the explanation in the SB Wiki, just wondering what those with the most experience here have found to work best.

Thanks!

Curt

Random variable!

For example, you have 2 waypoints that you want the AI to choose randomly:

Wp 1

Embark if

0 > random X1 < 50

Wp 2

Embark if

50 < random X1 < 100

At the start of the scenario, 63 random X#s are rolled. So, for every random check point, you assign the condition above for each X# (X1, X2, ...X63)

Link to comment
Share on other sites

On a related note, how would you use the 'New' random variable? Presumably there for when genuinely random movement is needed?

So if I have two paths, each with 0 < New ≤ 50, will it do both or neither, or does it check each in turn at a 50% chance? And if the latter, does it recheck if neither are chosen on the first go or will the unit sit there like a lemon for all eternity?

Cheers,

Jamie

Link to comment
Share on other sites

  • Members
On a related note, how would you use the 'New' random variable? Presumably there for when genuinely random movement is needed?

Correct. The numbered random variables are for coordinated random behavior. Like, an entire formation of units going left or right (the company commander would make that decision for everyone).

The random variable "New" gets a new value whenever a unit queries a condition that includes it, so you can no longer coordinate that behavior with other units.

Link to comment
Share on other sites

  • Members
So if I have two paths, each with 0 < New ≤ 50, will it do both or neither, or does it check each in turn at a 50% chance? And if the latter, does it recheck if neither are chosen on the first go or will the unit sit there like a lemon for all eternity?

Ah, the second part of the question. Yes, it could happen that for both paths XNew is outside of the 50% quartile that you defined. To avoid that, add the random embark condition to only ONE path. That way the random condition will be evaluated first, and if it is isn't true, the other path will be taken. :)

Link to comment
Share on other sites

Ah, the second part of the question. Yes, it could happen that for both paths XNew is outside of the 50% quartile that you defined. To avoid that, add the random embark condition to only ONE path. That way the random condition will be evaluated first, and if it is isn't true, the other path will be taken. :)

But are conditions re-evaluated with new random numbers each time? I am assuming that conditions are evaluated periodically as, to take a semi-related example, if I say embark if unit X is in zone Y, and X isn't in Y at the start but it later enters Y, my assumption is that the condition would then become true and the unit would embark, albeit with a little delay corresponding to the re-evaluation interval...

Edited by Flying Penguin
Link to comment
Share on other sites

Ah, the second part of the question. Yes, it could happen that for both paths XNew is outside of the 50% quartile that you defined. To avoid that, add the random embark condition to only ONE path. That way the random condition will be evaluated first, and if it is isn't true, the other path will be taken. :)

Oh, thanks!

Link to comment
Share on other sites

But are conditions re-evaluated with new random numbers each time? I am assuming that conditions are evaluated periodically as, to take a semi-related example, if I say embark if unit X is in zone Y, and X isn't in Y at the start but it later enters Y, my assumption is that the condition would then become true and the unit would embark, albeit with a little delay corresponding to the re-evaluation interval...

I assume that in this case it wont check again, since it only checks when it is in the checkpoint, not en route, and will continue towards the next checkpoint.

Link to comment
Share on other sites

A new variable is created and then checked each time a unit arrives at the given check point.

Thanks, that seems consistent with the test I just did. It appears that the new random is created on arrival (and is not refreshed each evaluation), but the conditions are repeatedly evaluated as long as the unit is at the waypoint.

In the attached scenario, each Hummer (except for the north most one) has a single route with a 10% chance of setting off at the start, but when the northern Hummer reaches the trigger, the rest of them set off.

56e83cf963537_RandomTest_zip.528d6fac6f7

Random Test.zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...