Xebarsis
New Member
- Reaction score
- 7
In my game, if you die you will receive a new random unit. There's a trigger in the game that pauses the trigger that gives new units, picks every alive unit, kills them, removes the picked units, turns the trigger back on that gives new units, and then a dummy unit is spawned for each player affected by the trigger and kills the dummy which causes a new unit spawn.
The trigger works fine except when a unit has an ankh or reincarnation and dies moments before the trigger starts. What ends up happening is the unit with an ankh dies, the trigger starts and all units are killed, but then the trigger doesn't pick the unit with an ankh or reincarnation because it's not actually considered dead... so then the player now has 2 units even though you're only allowed 1 unit at a time in the game. Here's my trigger:
If you don't want to read the whole thing, my main concern is this line:
I want Group to = Every alive player that is a user, including units that are in the process of reincarnating. I would make it pick every unit, including dead ones, but I want to leave corpses on the ground so that players can use animate dead or raise dead, etc. I've also tried making it say matching unit is alive equal to true, but the results are the same.
The trigger works fine except when a unit has an ankh or reincarnation and dies moments before the trigger starts. What ends up happening is the unit with an ankh dies, the trigger starts and all units are killed, but then the trigger doesn't pick the unit with an ankh or reincarnation because it's not actually considered dead... so then the player now has 2 units even though you're only allowed 1 unit at a time in the game. Here's my trigger:
Code:
Game - Display to (All players) the text: Random Event activa...
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SlainEvent Equal to 0
Then - Actions
Set SlainEvent = 1
Unit - Pause all units
Trigger - Turn off Spawner Determiner <gen>
Set Group = (Units in (Playable map area) matching (((Life of (Matching unit)) Greater than or equal to 1.00) and ((((Owner of (Matching unit)) controller) Equal to User) and (((Owner of (Matching unit)) slot status) Equal to Is playing))))
Sound - Play TrollbatriderPissed5 <gen>
Wait 1.00 seconds
Game - Display to (All players) the text: |CFFFF0303All playe...
Unit Group - Pick every unit in Group and do (Actions)
Loop - Actions
Unit - Explode (Picked unit)
Wait 2.00 seconds
Trigger - Turn on Spawner Determiner <gen>
Unit Group - Pick every unit in Group and do (Actions)
Loop - Actions
Unit - Remove (Picked unit) from the game
Custom script: call DestroyGroup(udg_Group)
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Player((Integer A))) slot status) Equal to Is playing
Then - Actions
Set ThePoint = (Center of (Playable map area))
Unit - Create 1 Dummy Killer for (Player((Integer A))) at ThePoint facing Default building facing degrees
Unit - Set the custom value of (Last created unit) to 1
Unit - Kill (Last created unit)
Else - Actions
Custom script: call DestroyGroup(udg_Group)
Set SlainEvent = 0
Unit - Unpause all units
Custom script: call RemoveLocation (udg_ThePoint)
Else - Actions
Trigger - Run (This trigger) (checking conditions)
If you don't want to read the whole thing, my main concern is this line:
Code:
Set Group = (Units in (Playable map area) matching (((Life of (Matching unit)) Greater than or equal to 1.00) and ((((Owner of (Matching unit)) controller) Equal to User) and (((Owner of (Matching unit)) slot status) Equal to Is playing))))
I want Group to = Every alive player that is a user, including units that are in the process of reincarnating. I would make it pick every unit, including dead ones, but I want to leave corpses on the ground so that players can use animate dead or raise dead, etc. I've also tried making it say matching unit is alive equal to true, but the results are the same.