- Joined
- Aug 13, 2013
- Messages
- 1,709
The loop trigger doesn't reduce the active instances of the spell ://///. But stopping the unit is working properly, I wonder why this happen
(((
I add comments so that it is easily to understand my practicing stages in the demo spell ^^.
I attached the test map in the demo stages spell if you want to test it
.
Description:
The caster will release a rock boulder to his position and the rock boulder will move to the target, when the rock boulder hits the target,
It will knockback the target.
I add comments so that it is easily to understand my practicing stages in the demo spell ^^.
I attached the test map in the demo stages spell if you want to test it
Description:
The caster will release a rock boulder to his position and the rock boulder will move to the target, when the rock boulder hits the target,
It will knockback the target.
-
Init
-

Events
-


Map initialization
-
-

Conditions
-

Actions
-


Hashtable - Create a hashtable
-


Set Hashtable = (Last created hashtable)
-
-
-
Execution
-

Events
-


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

Conditions
-


(Ability being cast) Equal to |cff808080Rock Boulder|r [|cffffcc00 R |r]
-
-

Actions
-


-------- This is just a demo spell --------
-


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



If - Conditions
-




instances Equal to 0
-
-



Then - Actions
-




Trigger - Turn on Loop <gen>
-
-



Else - Actions
-
-


-------- increase instances --------
-


Set instances = (instances + 1)
-


-------- caster --------
-


Set Caster = (Triggering unit)
-


-------- target --------
-


Set Target = (Target unit of ability being cast)
-


-------- the position of the caster --------
-


Set casterposition = (Position of Caster)
-


-------- creating missile rock boulder --------
-


Unit - Create 1 Rock Boulder for (Triggering player) at casterposition facing Default building facing degrees
-


Set missile = (Last created unit)
-


-------- the id of rock boulder missile --------
-


Custom script: set udg_ID = GetHandleId ( udg_missile )
-


-------- the datas and values needed when moving missile --------
-


Set range = 25.00
-


Set missilespeed = 13.00
-


Set missiledamage = 150.00
-


Set stage = 1
-


-------- saving datas --------
-


Hashtable - Save Handle OfCaster as 1 of ID in Hashtable
-


Hashtable - Save Handle OfTarget as 2 of ID in Hashtable
-


Hashtable - Save range as 3 of ID in Hashtable
-


Hashtable - Save missilespeed as 4 of ID in Hashtable
-


Hashtable - Save missiledamage as 5 of ID in Hashtable
-


Hashtable - Save stage as 6 of ID in Hashtable
-


-------- adding the missile to the group --------
-


Unit Group - Add missile to Group
-


-------- This debug msg shows in the screen --------
-


Custom script: call BJDebugMsg("instances: " + I2S(udg_instances))
-


-------- remove leaks --------
-


Custom script: call RemoveLocation ( udg_casterposition )
-
-
-
Loop
-

Events
-


Time - Every 0.03 seconds of game time
-
-

Conditions
-

Actions
-


-------- This is just a demo spell --------
-


Unit Group - Pick every unit in Group and do (Actions)
-



Loop - Actions
-




Set missile = (Picked unit)
-




Custom script: set udg_ID = GetHandleId ( udg_missile )
-




Set stage = (Load 6 of ID from Hashtable)
-




-------- Stage 1 = Move the missile --------
-




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





If - Conditions
-






stage Equal to 1
-
-





Then - Actions
-






Set Target = (Load 2 of ID in Hashtable)
-






Set missilespeed = (Load 4 of ID from Hashtable)
-






Set missileposition = (Position of missile)
-






Set targetposition = (Position of Target)
-






Set angle = (Angle from missileposition to targetposition)
-






Set movement = (missileposition offset by missilespeed towards angle degrees)
-






Unit - Move missile instantly to movement
-






Set dist = (Distance between missileposition and targetposition)
-






Set range = (Load 3 of ID from Hashtable)
-






-------- When the distance of the missile and target is less than in 50 range then --------
-






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







If - Conditions
-








dist Less than or equal to range
-
-







Then - Actions
-








Set Caster = (Load 1 of ID in Hashtable)
-








Set missiledamage = (Load 5 of ID from Hashtable)
-








-------- damage --------
-








Unit - Cause Caster to damage Target, dealing missiledamage damage of attack type Spells and damage type Normal
-








-------- kill the missile --------
-








Unit - Kill missile
-








Set kbspeed = 12.00
-








Set kbangle = (Angle from missileposition to targetposition)
-








Set maxdist = 400.00
-








Set kbspeedcounter = 0.00
-








-------- set the stage of the spell to 2 --------
-








Set stage = 2
-








-------- Saving the datas that needed in knockback --------
-








Hashtable - Save Handle Of(Load 2 of ID in Hashtable) as 2 of ID in Hashtable
-








Hashtable - Save stage as 6 of ID in Hashtable
-








Hashtable - Save kbspeed as 7 of ID in Hashtable
-








Hashtable - Save kbspeedcounter as 8 of ID in Hashtable
-








Hashtable - Save kbangle as 9 of ID in Hashtable
-








Hashtable - Save maxdist as 10 of ID in Hashtable
-
-







Else - Actions
-
-






Custom script: call RemoveLocation ( udg_missileposition )
-






Custom script: call RemoveLocation ( udg_targetposition )
-
-





Else - Actions
-






-------- Stage 2 = Knockback the target --------
-






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







If - Conditions
-








stage Equal to 2
-
-







Then - Actions
-








Set Target = (Load 2 of ID in Hashtable)
-








Set targetposition = (Position of Target)
-








Set kbspeedcounter = ((Load 8 of ID from Hashtable) + kbspeed)
-








Hashtable - Save kbspeedcounter as 8 of ID in Hashtable
-








Set kbspeed = (Load 7 of ID from Hashtable)
-








Set kbangle = (Load 9 of ID from Hashtable)
-








Set kb_offset = (targetposition offset by kbspeed towards kbangle degrees)
-








Unit - Move Target instantly to kb_offset
-








Set maxdist = (Load 10 of ID from Hashtable)
-








-------- This debug msg shows in the screen --------
-








Custom script: call BJDebugMsg("instances: " + I2S(udg_instances))
-








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









If - Conditions
-










kbspeedcounter Greater than or equal to maxdist
-
-









Then - Actions
-










-------- The knockback unit can stop when it is reached the max distance but it can't reduce the instances :(( --------
-










-------- It is weird because the knockbacked unit stops when he reached the max distance but the instances never reduce :// --------
-










Hashtable - Clear all child hashtables of child ID in Hashtable
-










-------- remove the unit --------
-










Unit Group - Remove missile from Group
-










-------- I reduce the instances --------
-










Set instances = (instances - 1)
-










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











If - Conditions
-












instances Equal to 0
-
-











Then - Actions
-












-------- This debug msg never shows in the screen --------
-












Custom script: call BJDebugMsg("Turn Off")
-












Trigger - Turn off (This trigger)
-
-











Else - Actions
-
-










-------- This debug msg never shows in the screen --------
-










Custom script: call BJDebugMsg("instances: " + I2S(udg_instances))
-
-









Else - Actions
-
-








Custom script: call RemoveLocation ( udg_targetposition )
-
-







Else - Actions
-
-
-
-
-
-
-





