HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Random Action?

11-12-2004, 07:29 PM#1
Fluff
Hey, how do I trigger this....

Event: Whatver
Conditions:
Action:
20% chance to spawn an A
30%chnace to spawn a B
50 chnace to spawn a C

You know what I mean? On acertain event, and want my actions to be random to increase map playability. Thanks for any help. Rep will be given.
11-12-2004, 07:41 PM#2
Dead-Inside
Set RandomIntegerVariable = Random number between 1 and 10 (Math - Random Number)

Then use RandomIntegerVariable for the chances (If RandomIntegerVariable equal to or less then 2 then do A, etc etc).
11-12-2004, 07:45 PM#3
Fluff
Okay thanks, now I have another question. How do I kill an entire variable array. I will assign units to variable Bandit[1] Bandit[2] etc. How do I kill the entire array with one action?
11-12-2004, 07:56 PM#4
Dead-Inside
.. Loop 1 to How many you expect to be in the variable.

For each Integer A from 1 to ExpectedNumber do
Set YourUnitArray[IntegerA] to No unit (Or anything else you want)

Oh wait, you said KILL... you do the same thing but you;
Kill YourUnitArray[IntegerA]
Instead. Same idea, different execution.
11-12-2004, 08:14 PM#5
Fluff
i gave rep. for the first help, but I didnt understand that last one. I want to kill my entire array. That's Bandit[1] through Bandit[20} all 20 bandit scum dead in one sweeping motion!
11-12-2004, 08:24 PM#6
Klownkiller
try this.

For each (Integer A) from 1 to (number of units in Bandit()array), do (Actions)
Loop - Actions
Unit - Kill Bandit[(Integer A)]

Hope that makes sense to you.