- Joined
- Apr 24, 2012
- Messages
- 5,099
-
TK Setup
-

Events
-


Map initialization
-
-

Conditions
-

Actions
-


Custom script: set udg_TK_Hash = InitHashtable()
-


-------- CONFIGURATION --------
-


-------- Determines the speed of the Tree --------
-


Set TK_TreeSpeed = 37.50
-


-------- Determines the tree destroy radius while knocbacked --------
-


Set TK_TreeDestroyRadius = 250.00
-


-------- Note:That will be also used to knockback units --------
-


-------- Determines the knocback distance of the units/trees --------
-


Set TK_KBDistanceBase = 200.00
-


Set TK_KBDistancePerLevel = 100.00
-


-------- Determines the distance the main knocbacked tree can go --------
-


Set TK_TreeDistanceBase = 750.00
-


Set TK_TreeDistancePerLevel = 250.00
-


-------- Determines the damage per level --------
-


Set TK_DamageBase = 100.00
-


-------- Determines the damage multiplier --------
-


Set TK_DamageBaseX = 1.00
-


Set TK_DamagePerLevelX = 1.00
-


-------- Note:that is the multiplier --------
-


-------- Determines the knockback sfx --------
-


Set TK_KnocbackSFX = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
-


-------- Tree Setup --------
-


Set TK_CutSysLoc = (Center of (Playable map area))
-


Unit - Create 1 Peasant for Neutral Passive at TK_CutSysLoc facing Default building facing degrees
-


Set TK_Cutter = (Last created unit)
-


Unit - Hide TK_Cutter
-


Unit - Make TK_Cutter Invulnerable
-


Set TK_DestroyOrder = harvest
-


Custom script: call RemoveLocation(udg_TK_CutSysLoc)
-
-
-
TK Cast
-

Events
-


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

Conditions
-


(Ability being cast) Equal to Tree Knocback
-
-

Actions
-


-------- Variables --------
-


Set TK_Caster = (Triggering unit)
-


Set TK_TargetTree = (Target destructible of ability being cast)
-


Set TK_Owner = (Triggering player)
-


Set TK_Level = (Level of Tree Knocback for TK_Caster)
-


-------- Creating Fake Tree --------
-


Set TK_Loc = (Position of TK_TargetTree)
-


Set TK_CasterLoc = (Position of TK_Caster)
-


Unit - Create 1 TK Dummy Tree for TK_Owner at TK_Loc facing Default building facing degrees
-


Set TK_Dummy = (Last created unit)
-


Custom script: set udg_TK_DummyKey = GetHandleId(udg_TK_Dummy)
-


Custom script: call UnitAddAbility(udg_TK_Dummy,'Aloc')
-


-------- Saving Variables --------
-


Set TK_DummyAngle = (Angle from TK_CasterLoc to TK_Loc)
-


Hashtable - Save TK_Level as 0 of TK_DummyKey in TK_Hash
-


Hashtable - Save Handle OfTK_Owner as 1 of TK_DummyKey in TK_Hash
-


Hashtable - Save TK_DummyAngle as 2 of TK_DummyKey in TK_Hash
-


Hashtable - Save (Strength of TK_Caster (Include bonuses)) as (Key Str) of TK_DummyKey in TK_Hash
-


-------- Starting Loop --------
-


Unit Group - Add TK_Dummy to TK_LoopGroup
-


Trigger - Turn on TK Loop <gen>
-


-------- LEAK --------
-


Custom script: call RemoveLocation(udg_TK_Loc)
-


Custom script: call RemoveLocation(udg_TK_CasterLoc)
-
-
-
TK Loop
-

Events
-


Time - Every 0.03 seconds of game time
-
-

Conditions
-

Actions
-


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



If - Conditions
-




(TK_LoopGroup is empty) Equal to False
-
-



Then - Actions
-




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





Loop - Actions
-






Set TK_U = (Picked unit)
-






Custom script: set udg_TK_UKey = GetHandleId(udg_TK_U)
-






-------- Loading --------
-






Set TK_Level = (Load 0 of TK_UKey from TK_Hash)
-






Set TK_Owner = (Load 1 of TK_UKey in TK_Hash)
-






Set TK_Angle = (Load 2 of TK_UKey from TK_Hash)
-






Set TK_DistanceTravelled = (Load 4 of TK_UKey from TK_Hash)
-






Set TK_MaxDistance = (TK_TreeDistanceBase + (TK_TreeDistancePerLevel x (Real(TK_Level))))
-






Set TK_ULoc = (Position of TK_U)
-






-------- Checking if the tree hasnt reach its max distance --------
-






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







If - Conditions
-








TK_DistanceTravelled Less than TK_MaxDistance
-
-







Then - Actions
-








Set TK_Offset = (TK_ULoc offset by TK_TreeSpeed towards TK_Angle degrees)
-








Unit - Move TK_U instantly to TK_Offset
-








Custom script: call RemoveLocation(udg_TK_Offset)
-








-------- SFX --------
-








Special Effect - Create a special effect at TK_ULoc using TK_KnocbackSFX
-








Special Effect - Destroy (Last created special effect)
-








Unit - Make TK_U face ((Facing of TK_U) + 12.00) over 0.00 seconds
-








-------- Tree Knocback --------
-








Destructible - Pick every destructible within TK_TreeDestroyRadius of TK_ULoc and do (Actions)
-









Loop - Actions
-










Set TK_TempTree = (Picked destructible)
-










Custom script: call IssueTargetOrder(udg_TK_Cutter,udg_TK_DestroyOrder,udg_TK_TempTree)
-










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











If - Conditions
-












And - All (Conditions) are true
-













Conditions
-














(Current order of TK_Cutter) Equal to (Order(TK_DestroyOrder))
-














(Current life of TK_TempTree) Greater than 0.00
-
-
-
-











Then - Actions
-












Set TK_TempTreeLoc = (Position of TK_TempTree)
-












Destructible - Kill TK_TempTree
-












Unit - Create 1 TK Dummy Tree for TK_Owner at TK_TempTreeLoc facing Default building facing degrees
-












Set TK_Dummy = (Last created unit)
-












Custom script: set udg_TK_DummyKey = GetHandleId(udg_TK_Dummy)
-












Custom script: call UnitAddAbility(udg_TK_Dummy,'Aloc')
-












-------- Adding knockback --------
-












Set KB2D_Target = TK_Dummy
-












Set KB2D_Angle = (Angle from TK_ULoc to TK_TempTreeLoc)
-












Set KB2D_Key = TK_DummyKey
-












Set KB2D_Distance = (TK_KBDistanceBase + (TK_KBDistancePerLevel x (Real(TK_Level))))
-












Set KB2D_Duration = 1.00
-












Custom script: call ExecuteFunc("ApplyKnockbackEffect")
-












Custom script: call RemoveLocation(udg_TK_TempTreeLoc)
-
-











Else - Actions
-
-










Unit - Order TK_Cutter to Stop
-
-
-








-------- Unit Knockback --------
-








Set TK_TempGroup = (Units within TK_TreeDestroyRadius of TK_ULoc)
-








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









Loop - Actions
-










Set TK_TempU = (Picked unit)
-










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











If - Conditions
-












And - All (Conditions) are true
-













Conditions
-














(TK_TempU is A structure) Equal to False
-














(TK_TempU is Magic Immune) Equal to False
-














(TK_TempU is alive) Equal to True
-














(TK_TempU belongs to an enemy of TK_Owner) Equal to True
-














(TK_TempU is in KB2D_LoopGroup) Equal to False
-
-
-
-











Then - Actions
-












Unit - Cause TK_U to damage TK_TempU, dealing TK_Damage damage of attack type Spells and damage type Normal
-












Custom script: set udg_TK_TempKey = GetHandleId(udg_TK_TempU)
-












Set TK_TempLoc = (Position of TK_TempU)
-












-------- Saving Variables --------
-












Set KB2D_Target = TK_TempU
-












Set KB2D_Angle = (Angle from TK_ULoc to TK_TempLoc)
-












Set KB2D_Key = TK_TempKey
-












Set TK_Damage = (TK_DamageBase + ((TK_DamageBaseX + (TK_DamagePerLevelX x (Real(TK_Level)))) x (Real((Load (Key Str) of TK_UKey from TK_Hash)))))
-












Set KB2D_Distance = (TK_KBDistanceBase + (TK_KBDistancePerLevel x (Real(TK_Level))))
-












Set KB2D_Duration = 1.00
-












Custom script: call ExecuteFunc("ApplyKnockbackEffect")
-












-------- LEAK --------
-












Custom script: call RemoveLocation(udg_TK_TempLoc)
-
-











Else - Actions
-
-
-
-








Hashtable - Save (TK_DistanceTravelled + TK_TreeSpeed) as 4 of TK_UKey in TK_Hash
-








-------- LEAK --------
-








Custom script: call DestroyGroup(udg_TK_TempGroup)
-
-







Else - Actions
-








Unit - Remove TK_U from the game
-








Hashtable - Clear all child hashtables of child TK_UKey in TK_Hash
-








Unit Group - Remove TK_U from TK_LoopGroup
-
-
-






Custom script: call RemoveLocation(udg_TK_ULoc)
-
-
-
-



Else - Actions
-




Trigger - Turn off (This trigger)
-
-
-
-
Here is the link for the system:
https://www.hiveworkshop.com/forums/spells-569/knockback-v1-6-v1-0-a-223634/
Map file of this spell:


