Hi,
I experience my variables set for a unit dies event will overwrite itself.
Take this example:
How do you make an efficient system for this? Do I really need to make local variables for every Unit Dies event or what is the smartest way (and not too complex for my brain xD) to avoid this?
I couldn't find other posts about this because I don't know how to search properly for this issue in search terms (if it exists).
I experience my variables set for a unit dies event will overwrite itself.
Take this example:
-
TFT SamiTroll Corpse Mine
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
(Level of Corpse Mine (SamiTroll) for (Killing unit)) Greater than or equal to 1
-
-
Actions
-
Set VariableSet OnDeath_UnitDying = (Triggering unit)
-
Set VariableSet OnDeath_UnitKilling = (Killing unit)
-
Set VariableSet StatUnit = OnDeath_UnitKilling
-
Trigger - Run Calculate Unit Stat Retriever <gen> (checking conditions)
-
Set VariableSet OnDeath_Real = (2.00 x StatAD)
-
Set VariableSet OnDeath_Point = (Position of OnDeath_UnitDying)
-
Special Effect - Create a special effect at OnDeath_Point using Objects\Spawnmodels\Human\FragmentationShards\FragBoomSpawn.mdl
-
Special Effect - Destroy (Last created special effect)
-
Set VariableSet OnDeath_UnitGroup = (Units within 125.00 of OnDeath_Point.)
-
Unit Group - Pick every unit in OnDeath_UnitGroup and do (Actions)
-
Loop - Actions
-
Set VariableSet OnDeath_UnitPicked = (Picked unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(OnDeath_UnitPicked is alive) Equal to True
-
(OnDeath_UnitPicked is invulnerable) Not equal to True
-
(OnDeath_UnitPicked is Magic Immune) Not equal to True
-
(OnDeath_UnitPicked belongs to an enemy of (Owner of OnDeath_UnitDying).) Equal to True
-
-
Then - Actions
-
Unit - Cause OnDeath_UnitDying to damage OnDeath_UnitPicked, dealing OnDeath_Real damage of attack type Spells and damage type Normal
-
-
Else - Actions
-
-
-
-
Custom script: call RemoveLocation(udg_OnDeath_Point)
-
Custom script: call DestroyGroup(udg_OnDeath_UnitGroup)
-
-
How do you make an efficient system for this? Do I really need to make local variables for every Unit Dies event or what is the smartest way (and not too complex for my brain xD) to avoid this?
I couldn't find other posts about this because I don't know how to search properly for this issue in search terms (if it exists).