- Joined
- Feb 27, 2008
- Messages
- 222
Ok, so im trying to make a trigger which does this -
You insert a command, in my case it is : -random
once you insert it, it turns off all triggers and then, every... say... 0,5 seconds it picks a random trigger and runs it.
Now, i tried doing it with hashtable, and i've been partially successful... the thing which kept me from being totally successful is the content of the other triggers... for instance
now, when i tried using hashtables, the problem was that every time the trigger started (which was 0.5 seconds), the trigger had to create a casting unit for each of the spells since they all are similar to this one.
Then, just one of them cast a spell, and the rest still showed their birth animations. Then i had to remove all of them. This was really unrealistic, cause it spawned like 10 units each 0.5 seconds and only one of them did something causing the map to be flooded with a lot of unnecessary crap.
so, if you have 10 triggers like this, how would you make it so that each 0.5 seconds a random one is executed?
You insert a command, in my case it is : -random
once you insert it, it turns off all triggers and then, every... say... 0,5 seconds it picks a random trigger and runs it.
Now, i tried doing it with hashtable, and i've been partially successful... the thing which kept me from being totally successful is the content of the other triggers... for instance
-
Events
-
Time - Elapsed game time is 10.00 seconds
-
-
Actions
-
Game - Display to (All players) the text: 10 seconds have ela...
-
Set Loc[1] = (Center of (Playable map area))
-
Unit - Create 1 Thunder Clap 3 for Neutral Hostile at Loc[1] facing Default building facing degrees
-
Custom script: call RemoveLocation(udg_Loc[1])
-
Trigger - Turn on Cast <gen>
-
-
Events
-
Time - Every 3.00 seconds of game time
-
-
Actions
-
Set Group = (Units of type Thunder Clap 3)
-
Unit Group - Pick every unit in Group and do (Actions)
-
Loop - Actions
-
Set Loc[1] = (Random point in (Playable map area))
-
Unit - Move (Picked unit) instantly to Loc[1]
-
Animation - Play (Picked unit)'s birth animation
-
Unit - Order (Picked unit) to Human Mountain King - Thunder Clap
-
-
-
Custom script: call RemoveLocation(udg_Loc[1])
-
Custom script: call DestroyGroup(udg_Group)
-
now, when i tried using hashtables, the problem was that every time the trigger started (which was 0.5 seconds), the trigger had to create a casting unit for each of the spells since they all are similar to this one.
Then, just one of them cast a spell, and the rest still showed their birth animations. Then i had to remove all of them. This was really unrealistic, cause it spawned like 10 units each 0.5 seconds and only one of them did something causing the map to be flooded with a lot of unnecessary crap.
so, if you have 10 triggers like this, how would you make it so that each 0.5 seconds a random one is executed?