I've got this substitution spell based on phase shift and a dummy casting wand of illusion. However the illusion does not move unless I move my hero first. It also bugs up randomly.
When the unit is attacked, it also doesn't work the way it should between alternating hits. I think this is due to the phase shift firing off normally. Every other hit still damages my hero before the illusion is made.
I also use a movement system to detect when a unit is moving. Please tell me what is going wrong
When the unit is attacked, it also doesn't work the way it should between alternating hits. I think this is due to the phase shift firing off normally. Every other hit still damages my hero before the illusion is made.
I also use a movement system to detect when a unit is moving. Please tell me what is going wrong
-
Substitution
-

Events
-


Unit - A unit Starts the effect of an ability
-
-

Conditions
-


(Ability being cast) Equal to Substitution
-
-

Actions
-


Set Player = (Owner of (Triggering unit))
-


Set unit[0] = (Triggering unit)
-


Set TempLoc[0] = (Position of (Triggering unit))
-


Unit Group - Add unit[0] to substitution_group
-


Unit - Turn collision for unit[0] Off
-


Unit - Create 1 Dummy for Player at TempLoc[0] facing Default building facing degrees
-


Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
-


Set unit[1] = (Last created unit)
-


Unit - Add Substitution illusion to (Last created unit)
-


Custom script: set udg_key[0] = GetHandleId(udg_unit[1])
-


Hashtable - Save Handle Ofunit[0] as (Key substitution) of key[0] in spell_hash
-


Hashtable - Save UnitMoving[(Custom value of unit[0])] as (Key substitution moving) of key[0] in spell_hash
-


Custom script: call IssueTargetOrderById(udg_unit[1],852274,udg_unit[0])
-


Custom script: call RemoveLocation(udg_TempLoc[0])
-
-
-
Substitution illusion swap
-

Events
-


Unit - A unit Spawns a summoned unit
-
-

Conditions
-


((Summoned unit) is an illusion) Equal to True
-
-

Actions
-


Set unit[0] = (Summoning unit)
-


Custom script: set udg_key[0] = GetHandleId(udg_unit[0])
-


Set unit[3] = (Load (Key substitution) of key[0] in spell_hash)
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(unit[3] has buff Substitution ) Equal to True
-




(Name of (Summoned unit)) Equal to (Name of unit[3])
-
-



Then - Actions
-




Game - Display to (All players) the text: poof
-




Set unit[1] = (Summoned unit)
-




Set TempLoc[0] = (Position of unit[0])
-




Set TempLoc[1] = (Center of Region 000 <gen>) <<< (Disabled for testing)
-




Set TempLoc[1] = (TempLoc[0] offset by 256.00 towards ((Facing of unit[1]) + 180.00) degrees) <<< (For testing)
-




Unit - Turn collision for unit[1] Off
-




Custom script: call SetUnitX(udg_unit[1],GetLocationX(udg_TempLoc[0]))
-




Custom script: call SetUnitY(udg_unit[1],GetLocationY(udg_TempLoc[0]))
-




Unit - Turn collision for unit[1] On
-




Custom script: call SetUnitX(udg_unit[3],GetLocationX(udg_TempLoc[1]))
-




Custom script: call SetUnitY(udg_unit[3],GetLocationY(udg_TempLoc[1]))
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






(Load (Key substitution moving) of key[0] from spell_hash) Equal to True
-
-





Then - Actions
-






Game - Display to (All players) the text: moving
-






Set TempLoc[2] = (TempLoc[0] offset by 500.00 towards (Facing of unit[1]) degrees)
-






Unit - Order unit[1] to Move To TempLoc[2]
-






Unit - Order unit[1] to Set Rally Point To TempLoc[3]
-






Custom script: call RemoveLocation(udg_TempLoc[2])
-
-





Else - Actions
-
-




Custom script: call RemoveLocation(udg_TempLoc[0])
-




Custom script: call RemoveLocation(udg_TempLoc[1])
-
-



Else - Actions
-




Game - Display to (All players) the text: No buff
-




Set TempLoc[3] = (Position of unit[3])
-




Special Effect - Create a special effect at TempLoc[3] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
-




Special Effect - Destroy (Last created special effect)
-
-
-
-
-
Substitution auto
-

Events
-


Unit - A unit Is issued an order with no target
-
-

Conditions
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Issued order) Equal to (Order(phaseshifton))
-
-



Then - Actions
-




Unit Group - Add (Triggering unit) to substitution_group
-
-



Else - Actions
-
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Issued order) Equal to (Order(phaseshiftoff))
-
-



Then - Actions
-




Unit Group - Remove (Triggering unit) from substitution_group
-
-



Else - Actions
-
-
-
-
Substitution attack
-

Events
-


Unit - A unit Is attacked
-
-

Conditions
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




((Triggering unit) is in substitution_group) Equal to True
-
-



Then - Actions
-




Set unit[0] = (Attacked unit)
-




Set unit[1] = (Attacking unit)
-




Set TempLoc[0] = (Position of unit[0])
-




Unit - Order unit[0] to Night Elf Faerie Dragon - Phase Shift
-




Unit - Order unit[1] to Stop
-




Unit - Order unit[1] to Attack-Move To TempLoc[0]
-




Unit Group - Remove unit[0] from substitution_group
-




Custom script: call RemoveLocation(udg_TempLoc[0])
-
-



Else - Actions
-
-
-






