- Joined
- Aug 15, 2008
- Messages
- 720
Since I learned these hashtables, I was testing them.
I was creating knockback trigger with hashtable method (as wyrm tutorial)
Thing is... I want that Knockback without leaks, so I did basic memory fixing method, but then basic Knockback only knocks one unit and in other castings it doesn't knock target, he just stands at his place.
Trigger:
I was creating knockback trigger with hashtable method (as wyrm tutorial)
Thing is... I want that Knockback without leaks, so I did basic memory fixing method, but then basic Knockback only knocks one unit and in other castings it doesn't knock target, he just stands at his place.
Trigger:
-
Fire Fist
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Fire Fist
-
-
Actions
-
Set TrigUnit = (Triggering unit)
-
Set Target = (Target unit of ability being cast)
-
Set TargetUnitHandle = (Target unit of ability being cast)
-
Set TempLoc1 = (Position of TrigUnit)
-
Set TempLoc2 = (Position of Target)
-
-------- --------------- --------
-
Set FFKnockbackAngle = (Angle from TempLoc1 to TempLoc2)
-
Set FFKnockbackDistance = 20.00
-
Set RemainingTime = 1.00
-
-------- --------------- --------
-
Hashtable - Save FFKnockbackAngle as 0 of (Key TargetUnitHandle) in FFKnockbackTable
-
Hashtable - Save FFKnockbackDistance as 1 of (Key TargetUnitHandle) in FFKnockbackTable
-
Hashtable - Save RemainingTime as 2 of (Key TargetUnitHandle) in FFKnockbackTable
-
-------- --------------- --------
-
Unit Group - Add Target to FFKnockbackGroup
-
-------- --------------- --------
-
Custom script: call RemoveLocation(udg_TempLoc1)
-
Custom script: call RemoveLocation(udg_TempLoc2)
-
-
-
Fire Fist Knockback
-
Events
-
Time - Every 0.04 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in FFKnockbackGroup and do (Actions)
-
Loop - Actions
-
Set PickUnitHandle = (Picked unit)
-
Set PickUnit = (Picked unit)
-
Set TempLoc1 = (Position of PickUnit)
-
Set TempLoc2 = (TempLoc1 offset by FFKnockbackDistance towards FFKnockbackAngle degrees)
-
Set FFKnockbackAngle = (Load 0 of (Key PickUnitHandle) from FFKnockbackTable)
-
Set FFKnockbackDistance = (Load 1 of (Key PickUnitHandle) from FFKnockbackTable)
-
Set RemainingTime = (Load 2 of (Key PickUnitHandle) from FFKnockbackTable)
-
-------- --------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RemainingTime Greater than 0.00
-
-
Then - Actions
-
Unit - Move PickUnit instantly to TempLoc2
-
Special Effect - Create a special effect attached to the origin of PickUnit using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
-
-------- --------------- --------
-
Set SFX1 = (Last created special effect)
-
Special Effect - Destroy SFX1
-
-------- --------------- --------
-
Hashtable - Save (FFKnockbackDistance - 0.08) as 0 of (Key PickUnitHandle) in FFKnockbackTable
-
Hashtable - Save (RemainingTime - 0.04) as 2 of (Key PickUnitHandle) in FFKnockbackTable
-
-
Else - Actions
-
Hashtable - Clear all child hashtables of child (Key PickUnitHandle) in FFKnockbackTable
-
Unit Group - Remove PickUnit from RespawnGroup
-
-------- --------------- --------
-
Custom script: call RemoveLocation(udg_TempLoc1)
-
Custom script: call RemoveLocation(udg_TempLoc2)
-
-
-
-
-
-