I have a trigger that respawns units when they die, but there's a bug that if a hallucinated unit dies, it respawns as a real unit. I've tried checking if the unit that just died has either of the behaviors "Sentry - hallucination" or "Hallucination timed life", but to no avail. Maybe it's a problem of finding which index the buff is applied to? Here's the trigger:
Events
Unit - Any Unit dies
Local Variables
DeadUnit = No Game Link <Game Link - Unit>
DeadBehavior = No Game Link <Game Link - Behavior>
DeadPlayer = 0 <Integer>
Conditions
Actions
Variable - Set DeadUnit = (Unit type of (Triggering unit))
Variable - Set DeadBehavior = ((Triggering unit) behavior 1)
Variable - Set DeadPlayer = (Triggering player)
General - Wait 5 Real Time seconds
General - If (Conditions) then do (Actions) else do (Actions)
If
DeadBehavior != Hallucination Timed Life
Then
Unit - Create 1 DeadUnit for player DeadPlayer at SpawnPoint[DeadPlayer] facing 270.0 degrees (No Options)
Else
This is tough, I've actually never been this stumped.
EDIT: after some more debugging, it looks like lots of information (eg: behavior, flags, filters) about the unit is lost after the unit dies. Still trying to find a solution...
Maybe I'll create duplicates of each Protoss unit, and have hallucination spawn these copies. That way, I can explicitly check the dead unit wasn't a unit created by hallucination...
I have a trigger that respawns units when they die, but there's a bug that if a hallucinated unit dies, it respawns as a real unit. I've tried checking if the unit that just died has either of the behaviors "Sentry - hallucination" or "Hallucination timed life", but to no avail. Maybe it's a problem of finding which index the buff is applied to? Here's the trigger:
Events
Unit - Any Unit dies
Local Variables
DeadUnit = No Game Link <Game Link - Unit>
DeadBehavior = No Game Link <Game Link - Behavior>
DeadPlayer = 0 <Integer>
Conditions
Actions
Variable - Set DeadUnit = (Unit type of (Triggering unit))
Variable - Set DeadBehavior = ((Triggering unit) behavior 1)
Variable - Set DeadPlayer = (Triggering player)
General - Wait 5 Real Time seconds
General - If (Conditions) then do (Actions) else do (Actions)
If
DeadBehavior != Hallucination Timed Life
Then
Unit - Create 1 DeadUnit for player DeadPlayer at SpawnPoint[DeadPlayer] facing 270.0 degrees (No Options)
Else
Dead units don't have buffs. You need to find another way to check for them.
Unit Filter Match or Unit Classification Check might work.
@zorbotron: Go
Neither works :/
This is tough, I've actually never been this stumped.
EDIT: after some more debugging, it looks like lots of information (eg: behavior, flags, filters) about the unit is lost after the unit dies. Still trying to find a solution...
Maybe I'll create duplicates of each Protoss unit, and have hallucination spawn these copies. That way, I can explicitly check the dead unit wasn't a unit created by hallucination...
EDIT 2: above worked.