# [Trigger]Alive & Dead Condition Problem

#### Atami

Level 5
Hi Guys,

i have a problem with two spells in my map. I dont know why it doesnt work.

Problem discription:
If i cast the spell the work time it work perfect but the second time it do smthing with dead units. explain: this is a chain spell the chain projectile is a ball (not a lightning) which jumps on units and cast a spell.
Sorry some parts are german cuz iam from germany and using the german editor!
Iam using this system and the ball jumps on dead unit but not at the first cast only at all further casts!

• Chain Forklightning Cast
• Ereignisse
• Einheit - A unit Startet den Effekt einer Fähigkeit
• Bedingungen
• (Ability being cast) equal Chain Forklightning CasterSpell
• Aktionen
• -------- Setup Variables --------
• -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [Missile Speed, Bounce Range, Number of Bounces and how many times the same unit may be hit during one chain.] --------
• Set SpellBounceRange = 500.00
• Set SpellBounceSpeed = 800.00
• Set SpellNumberBounces = (4 x (Level of Chain Forklightning CasterSpell for (Casting unit)))
• Set SpellMaximumNumberHits = 3
• -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [Missile Speed, Bounce Range, Number of Bounces and how many times the same unit may be hit during one chain.] --------
• -------- Spell Effect Create Dummy Unit With Model --------
• Set TemporaryPoint[1] = (Position of (Casting unit))
• Set TemporaryPoint[2] = (Position of (Target unit of ability being cast))
• -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [The Missile Type, which is a unit.] --------
• Einheit - Create 1 Dummy Chain FL Effect for (Owner of (Casting unit)) at TemporaryPoint[1] facing TemporaryPoint[2]
• -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [The Missile Type, which is a unit.] --------
• -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [Select the right Loop Trigger.] --------
• If ((PowerChainGroup is empty) Gleich True) then do (Auslöser - Turn on Chain Forklightning Loop <gen>) else do (Do nothing)
• -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [Select the right Loop Trigger.] --------
• Einheitengruppe - Add (Last created unit) to PowerChainGroup
• -------- Save Variables --------
• Hashtabelle - Save SpellBounceRange as 0 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save SpellBounceSpeed as 1 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save SpellNumberBounces as 2 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save Handle Of(Target unit of ability being cast) as 3 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save (Level of Chain Forklightning CasterSpell for (Casting unit)) as 4 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save SpellMaximumNumberHits as 5 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save (Key (Last created unit)) as 6 of (Key (Last created unit)) in PowerChainHash
• -------- Clean up --------
• Custom script: call RemoveLocation (udg_TemporaryPoint[2])
• Custom script: call RemoveLocation (udg_TemporaryPoint[1])

• Chain Forklightning Loop
• Ereignisse
• Zeit - Every 0.03 seconds of game time
• Bedingungen
• Aktionen
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• (Number of units in PowerChainGroup) GrÃ¶ÃŸer als 0
• 'THEN'-Aktionen
• Einheitengruppe - Pick every unit in PowerChainGroup and do (Actions)
• Schleifen - Aktionen
• Set SpellBounceSpeed = (Load 1 of (Key (Picked unit)) from PowerChainHash)
• Set SpellNumberBounces = (Load 2 of (Key (Picked unit)) from PowerChainHash)
• Set TemporaryTarget = (Load 3 of (Key (Picked unit)) in PowerChainHash)
• Set TemporaryKeyTarget = (Load 3 of (Key (Picked unit)) in PowerChainHash)
• Set TemporaryKeySpell = (Load 6 of (Key (Picked unit)) from PowerChainHash)
• -------- Spell Effect Move Bouncing Missile --------
• Set TemporaryPoint[1] = (Position of (Picked unit))
• Set TemporaryPoint[2] = (Position of TemporaryTarget)
• Set TemporaryPoint[3] = (TemporaryPoint[1] offset by (0.02 x SpellBounceSpeed) towards (Angle from TemporaryPoint[1] to TemporaryPoint[2]) degrees)
• Einheit - Move (Picked unit) instantly to TemporaryPoint[3], facing TemporaryPoint[2]
• Custom script: call RemoveLocation (udg_TemporaryPoint[3])
• Custom script: call RemoveLocation (udg_TemporaryPoint[1])
• Set TemporaryPoint[1] = (Position of (Picked unit))
• -------- Collision Of Unit And Bouncing Missile --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• (Distance between TemporaryPoint[1] and TemporaryPoint[2]) Kleiner gleich (SpellBounceSpeed / 70.00)
• 'THEN'-Aktionen
• Custom script: call RemoveLocation (udg_TemporaryPoint[1])
• Custom script: call RemoveLocation (udg_TemporaryPoint[2])
• -------- Spell Hit --------
• Set TemporaryPoint[1] = (Position of TemporaryTarget)
• Einheit - Create 1 Dummy Chain FL for (Owner of (Picked unit)) at TemporaryPoint[1] facing TemporaryPoint[1]
• Einheit - Add Chain Forklightning dummy to (Last created unit)
• -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [Ability casted against every unit in the chain, and the right cast order.] --------
• Einheit - Set level of Chain Forklightning dummy for (Last created unit) to (Load 4 of (Key (Picked unit)) from PowerChainHash)
• Einheit - Order (Last created unit) to Neutrale Naga-Meerhexe - 'Gabelblitz' TemporaryTarget
• -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [Ability casted against every unit in the chain, and the right cast order.] --------
• Einheit - Add a 0.50 second Standard expiration timer to (Last created unit)
• Custom script: call RemoveLocation (udg_TemporaryPoint[1])
• -------- Save Variables On Target Unit --------
• Hashtabelle - Save ((Load TemporaryKeySpell of (Key TemporaryKeyTarget) from PowerChainHash) + 1) as TemporaryKeySpell of (Key TemporaryKeyTarget) in PowerChainHash
• -------- Decrease Bounces --------
• Set SpellNumberBounces = (SpellNumberBounces - 1)
• -------- Bounce On When More Units Can Be Hit --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• SpellNumberBounces GrÃ¶ÃŸer als 0
• 'THEN'-Aktionen
• Set SpellMaximumNumberHits = (Load 5 of (Key (Picked unit)) from PowerChainHash)
• Set SpellBounceRange = (Load 0 of (Key (Picked unit)) from PowerChainHash)
• -------- Spell Effect --------
• -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [The conditions that a unit must meet to be aquired as the next target] --------
• Set TemporaryGroup[1] = (Units within SpellBounceRange of (Position of (Picked unit)) matching (((((Matching unit) is alive) Gleich True) and ((((Matching unit) is Ein GebÃ¤ude) Gleich False) and (SpellMaximumNumberHits GrÃ¶ÃŸer als (Load TemporaryKeySpell of (Key (Matching unit)) f
• -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [The conditions that a unit must meet to be aquired as the next target] --------
• Set TemporaryGroup[2] = (Random 1 units from TemporaryGroup[1])
• -------- New Unit To Bounce To Found --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• (Number of units in TemporaryGroup[2]) GrÃ¶ÃŸer als 0
• 'THEN'-Aktionen
• -------- Make This Unit The New Target --------
• Einheitengruppe - Pick every unit in TemporaryGroup[2] and do (Actions)
• Schleifen - Aktionen
• Set TemporaryTarget = (Picked unit)
• Custom script: call DestroyGroup (udg_TemporaryGroup[2])
• Custom script: call DestroyGroup (udg_TemporaryGroup[1])
• Set TemporaryPoint[1] = (Position of (Picked unit))
• Set TemporaryPoint[2] = (Position of TemporaryTarget)
• -------- New Dummy Unit --------
• -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [The Missile Type, which is a unit.] --------
• Einheit - Create 1 Dummy Chain FL Effect for (Owner of (Picked unit)) at TemporaryPoint[1] facing TemporaryPoint[2]
• -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [The Missile Type, which is a unit.] --------
• Einheitengruppe - Add (Last created unit) to PowerChainGroup
• -------- Save Variables --------
• Hashtabelle - Save SpellBounceRange as 0 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save SpellBounceSpeed as 1 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save SpellNumberBounces as 2 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save Handle OfTemporaryTarget as 3 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save (Load 4 of (Key (Picked unit)) from PowerChainHash) as 4 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save SpellMaximumNumberHits as 5 of (Key (Last created unit)) in PowerChainHash
• Hashtabelle - Save (Load 6 of (Key (Picked unit)) from PowerChainHash) as 6 of (Key (Last created unit)) in PowerChainHash
• -------- Clean up --------
• Custom script: call RemoveLocation (udg_TemporaryPoint[2])
• Custom script: call RemoveLocation (udg_TemporaryPoint[1])
• 'ELSE'-Aktionen
• Custom script: call DestroyGroup (udg_TemporaryGroup[2])
• Custom script: call DestroyGroup (udg_TemporaryGroup[1])
• -------- Clean Up Units That Were Hit --------
• Set TemporaryGroup[1] = (Units in (Playable map area) matching ((Load TemporaryKeySpell of (Key (Matching unit)) from PowerChainHash) Ungleich 0))
• Einheitengruppe - Pick every unit in TemporaryGroup[1] and do (Actions)
• Schleifen - Aktionen
• Hashtabelle - Save 0 as TemporaryKeySpell of (Key (Picked unit)) in PowerChainHash
• Custom script: call DestroyGroup (udg_TemporaryGroup[1])
• 'ELSE'-Aktionen
• -------- Clean Up Units That Were Hit --------
• Set TemporaryGroup[1] = (Units in (Playable map area) matching ((Load TemporaryKeySpell of (Key (Matching unit)) from PowerChainHash) Ungleich 0))
• Einheitengruppe - Pick every unit in TemporaryGroup[1] and do (Actions)
• Schleifen - Aktionen
• Hashtabelle - Save 0 as TemporaryKeySpell of (Key (Picked unit)) in PowerChainHash
• Custom script: call DestroyGroup (udg_TemporaryGroup[1])
• -------- Remove Old Dummy Unit --------
• Einheit - Kill (Picked unit)
• Einheitengruppe - Remove (Picked unit) from PowerChainGroup
• Hashtabelle - Clear all child hashtables of child (Key (Picked unit)) in PowerChainHash
• 'ELSE'-Aktionen
• Custom script: call RemoveLocation (udg_TemporaryPoint[1])
• Custom script: call RemoveLocation (udg_TemporaryPoint[2])
• 'ELSE'-Aktionen
• Auslöser - Turn off (This trigger)

And the same problem with the Reworked Fan of knifes by -BeRzErKeR- the projectile explodes on corpses!

• Fan of Knives Kopieren
• Ereignisse
• Einheit - A unit Startet den Effekt einer Fähigkeit
• Bedingungen
• (Ability being cast) Gleich Cyber goblinr ush cyber
• Aktionen
• -------- ------------------------------------------------------------ --------
• -------- Getting the spell constants --------
• -------- ------------------------------------------------------------ --------
• Set FoK_Caster = (Triggering unit)
• Set FoK_Loc1 = (Position of FoK_Caster)
• Set FoK_Ability_Level = (Level of (Ability being cast) for FoK_Caster)
• -------- ------------------------------------------------------------ --------
• -------- ------------------------------------------------------------ --------
• -------- Spell setup --------
• -------- ------------------------------------------------------------ --------
• Set FoK_Random_Path = True
• Set FoK_Random_Movement = False
• Set FoK_Knives_Count = 36
• Set FoK_Base_Damage = 75.00
• Set FoK_Detection_Area = 90.00
• Set FoK_Total_Damage = (FoK_Base_Damage x (Real(FoK_Ability_Level)))
• Set FoK_Distance = 5000.00
• Set FoK_Speed = 15.00
• Set FoK_Spiral_Angle = 4.00
• -------- ------------------------------------------------------------ --------
• -------- ------------------------------------------------------------ --------
• Auslöser - Turn on Fan of Knives Execution <gen>
• For each (Integer A) from 1 to FoK_Knives_Count, do (Actions)
• Schleifen - Aktionen
• -------- ------------------------------------------------------------ --------
• -------- Creating all the daggers, setting their settings and saving reals into hashtable --------
• -------- ------------------------------------------------------------ --------
• Set FoK_Angle = ((360.00 / (Real(FoK_Knives_Count))) x (Real((Integer A))))
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• FoK_Random_Path Gleich True
• 'THEN'-Aktionen
• Set FoK_Loc2 = (FoK_Loc1 offset by (Random real number between 0.00 and 100.00) towards FoK_Angle degrees)
• Einheit - Create 1 Dummy for (Owner of FoK_Caster) at FoK_Loc2 facing FoK_Angle degrees
• Animation - Change (Last created unit)'s animation speed to 45.00% of its original speed
• Einheitengruppe - Add (Last created unit) to FoK_Dummy_Group
• -------- ------------------------------------------------------------ --------
• Hashtabelle - Save Handle OfFoK_Caster as (Key caster) of (Key (Last created unit)) in FoK_Table
• Hashtabelle - Save FoK_Distance as (Key distance) of (Key (Last created unit)) in FoK_Table
• Hashtabelle - Save FoK_Speed as (Key speed) of (Key (Last created unit)) in FoK_Table
• Hashtabelle - Save FoK_Total_Damage as (Key damage) of (Key (Last created unit)) in FoK_Table
• -------- ------------------------------------------------------------ --------
• -------- Removing used locations --------
• -------- ------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_FoK_Loc2)
• 'ELSE'-Aktionen
• -------- ------------------------------------------------------------ --------
• Einheit - Create 1 Dummy for (Owner of FoK_Caster) at FoK_Loc1 facing FoK_Angle degrees
• Animation - Change (Last created unit)'s animation speed to 45.00% of its original speed
• Einheitengruppe - Add (Last created unit) to FoK_Dummy_Group
• -------- ------------------------------------------------------------ --------
• Hashtabelle - Save Handle OfFoK_Caster as (Key caster) of (Key (Last created unit)) in FoK_Table
• Hashtabelle - Save FoK_Distance as (Key distance) of (Key (Last created unit)) in FoK_Table
• Hashtabelle - Save FoK_Speed as (Key speed) of (Key (Last created unit)) in FoK_Table
• Hashtabelle - Save FoK_Total_Damage as (Key damage) of (Key (Last created unit)) in FoK_Table
• Custom script: call RemoveLocation(udg_FoK_Loc1)

• Fan of Knives Execution
• Ereignisse
• Zeit - Every 0.03 seconds of game time
• Bedingungen
• Aktionen
• -------- ================================================================== --------
• -------- LEAVE THIS TRIGGER AS IT IS --------
• -------- Things that you can change will be marked with a star [ * ] --------
• -------- ================================================================== --------
• Einheitengruppe - Pick every unit in FoK_Dummy_Group and do (Actions)
• Schleifen - Aktionen
• -------- ------------------------------------------------------------ --------
• -------- ------------------------------------------------------------ --------
• Set FoK_Distance = (Load (Key distance) of (Key (Picked unit)) from FoK_Table)
• Set FoK_Speed = (Load (Key speed) of (Key (Picked unit)) from FoK_Table)
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• FoK_Distance GrÃ¶ÃŸer als 0.00
• 'THEN'-Aktionen
• -------- ------------------------------------------------------------ --------
• -------- Setting the path of the knives and moving the daggers --------
• -------- ------------------------------------------------------------ --------
• Set FoK_Caster = (Load (Key caster) of (Key (Picked unit)) in FoK_Table)
• Hashtabelle - Save (FoK_Distance - FoK_Speed) as (Key distance) of (Key (Picked unit)) in FoK_Table
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• FoK_Random_Movement Gleich True
• 'THEN'-Aktionen
• Set FoK_Facing = ((Facing of (Picked unit)) + (Random real number between 3.00 and 12.00))
• 'ELSE'-Aktionen
• Set FoK_Facing = ((Facing of (Picked unit)) + FoK_Spiral_Angle)
• Set FoK_Loc3 = (Position of (Picked unit))
• Set FoK_Loc4 = (FoK_Loc3 offset by FoK_Speed towards FoK_Facing degrees)
• Einheit - Move (Picked unit) instantly to FoK_Loc4, facing FoK_Facing degrees
• -------- ------------------------------------------------------------ --------
• -------- Detecting if any enemy unit is in the rage of a dagger --------
• -------- ------------------------------------------------------------ --------
• Set FoK_Damage_Group = (Units within FoK_Detection_Area of FoK_Loc4 matching ((((Matching unit) is Ein Gebäude) Gleich False) and ((((Matching unit) is dead) Gleich False) and (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Gleich True))))
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• (Number of units in FoK_Damage_Group) GrÃ¶ÃŸer gleich 1
• 'THEN'-Aktionen
• Einheit - Kill (Picked unit)
• Einheit - Remove (Picked unit) from the game
• Einheitengruppe - Remove (Picked unit) from FoK_Dummy_Group
• Set FoK_Total_Damage = (Load (Key damage) of (Key (Picked unit)) from FoK_Table)
• -------- ------------------------------------------------------------ --------
• -------- Damaging the unit --------
• -------- ------------------------------------------------------------ --------
• Einheitengruppe - Pick every unit in FoK_Damage_Group and do (Actions)
• Schleifen - Aktionen
• Einheit - Cause FoK_Caster to damage (Picked unit), dealing FoK_Total_Damage damage of attack type Zaubersprüche and damage type Unbekannt
• -------- ------------------------------------------------------------ --------
• -------- * --------
• -------- You can change the special effects --------
• -------- ------------------------------------------------------------ --------
• Spezialeffekt - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
• Spezialeffekt - Destroy (Last created special effect)
• Spezialeffekt - Create a special effect attached to the origin of (Picked unit) using Abilities\Weapons\MeatwagonMissile\MeatwagonMissile.mdl
• Spezialeffekt - Destroy (Last created special effect)
• -------- * --------
• -------- ------------------------------------------------------------ --------
• -------- ------------------------------------------------------------ --------
• -------- Destroying the used unit group --------
• -------- ------------------------------------------------------------ --------
• Custom script: call DestroyGroup(udg_FoK_Damage_Group)
• -------- ------------------------------------------------------------ --------
• -------- Turning off tis trigger, if there are currently 0 knives on the map --------
• -------- ------------------------------------------------------------ --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• (Number of units in FoK_Dummy_Group) Gleich 0
• 'THEN'-Aktionen
• Auslöser - Turn off Fan of Knives Execution <gen>
• 'ELSE'-Aktionen
• 'ELSE'-Aktionen
• -------- ------------------------------------------------------------ --------
• -------- Removing used locations --------
• -------- ------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_FoK_Loc3)
• Custom script: call RemoveLocation(udg_FoK_Loc4)
• 'ELSE'-Aktionen
• -------- ------------------------------------------------------------ --------
• -------- Ending the spell, clearing the hashtable and removing units --------
• -------- ------------------------------------------------------------ --------
• Einheit - Kill (Picked unit)
• Einheitengruppe - Remove (Picked unit) from FoK_Dummy_Group
• Hashtabelle - Clear all child hashtables of child (Key (Picked unit)) in FoK_Table
• -------- ------------------------------------------------------------ --------
• -------- Turning off tis trigger, if there are currently 0 knives on the map --------
• -------- ------------------------------------------------------------ --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• (Number of units in FoK_Dummy_Group) Gleich 0
• 'THEN'-Aktionen
• Auslöser - Turn off Fan of Knives Execution <gen>
• 'ELSE'-Aktionen

I hope anyone can help me with this problem cuz i dont know how to fix it!

-Atami

Last edited:

#### D4RK_G4ND4LF

Level 19
"Is Unit Alive" checks if "Life of Unit > 0.00"
so if you have another trigger which heals units it might cause that
I also remember someone who wanted a fan of knifes which heals instead of dealing damage
the solution was to shift-click the damage value and change it to something negative
if dead targets are not excluded explicitly it might heal (damage) dead units as well

#### Atami

Level 5
"Is Unit Alive" checks if "Life of Unit > 0.00"
so if you have another trigger which heals units it might cause that
I also remember someone who wanted a fan of knifes which heals instead of dealing damage
the solution was to shift-click the damage value and change it to something negative
if dead targets are not excluded explicitly it might heal (damage) dead units as well

Okay i set the damage to something negative and it wont work too. Same thing happen.!!!

#### Bannar

Code Reviewer
Level 24
Post here your map, i dont get it, Gandals said the true.

[Trigger] Trigger problem!!
Replies
7
Views
618
Replies
6
Views
624
Replies
9
Views
351
A
Replies
0
Views
279
Ardenian
A
Replies
27
Views
602