- Joined
- Jun 21, 2013
- Messages
- 116
I need an ability that would target a unit, then the caster would get 522 movement speed and charge into the target. Upon impact, all enemies surrounding the caster would get a debuff that makes them miss attacks.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Charge

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Animate Dead

Actions


Set Caster = (Triggering unit)


Set Point_Of_Caster = (Position of Caster)


Set Target = (Target unit of ability being cast)


Set Point_Of_Target = (Position of Target)


Animation - Change Caster's animation speed to 150.00% of its original speed


Unit - Set Caster movement speed to 522.00


Unit - Pause Caster


Animation - Play Caster's Walk Defend ( Or Whatever ) animation


Trigger - Turn on Charge Loop <gen>


Wait until ((Distance between Point_Of_Caster and Point_Of_Target) Less than or equal to 100.00), checking every 0.10 seconds


Trigger - Turn off Charge Loop <gen>


Animation - Change Caster's animation speed to 100.00% of its original speed


Unit - Set Caster movement speed to (Default movement speed of Caster)


Unit - Unpause Caster


Set Caster = No unit


Set Target = No unit


Custom script: call RemoveLocation(udg_Point_Of_Caster)


Custom script: call RemoveLocation(udg_Point_Of_Target)


Custom script: call RemoveLocation(udg_Next_Charge_Point)


Custom script: call DestroyGroup(udg_Surrounded_Units)
Charge Loop

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


Set Point_Of_Caster = (Position of Caster)


Set Point_Of_Target = (Position of Target)


Set Next_Charge_Point = (Point_Of_Caster offset by 40.00 towards (Facing of Caster) degrees)


Unit - Move Caster instantly to Next_Charge_Point, facing (Facing of Caster) degrees


Set Surrounded_Units = (Units within 300.00 of Point_Of_Caster matching (((Matching unit) belongs to an enemy of (Owner of Caster)) Equal to True))


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



Loop - Actions




-------- Your debuff --------


Custom script: call RemoveLocation(udg_Point_Of_Caster)


Custom script: call RemoveLocation(udg_Point_Of_Target)


Custom script: call RemoveLocation(udg_Next_Charge_Point)


Custom script: call DestroyGroup(udg_Surrounded_Units)
Charge Start

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Your_Ability

Actions


-------- set up variables --------


Set Caster = Blademaster 0002 <gen>


Set TargetPoint = (Target point of ability being cast)


-------- ------------------------------------------------------- --------


Unit - Make Caster face TargetPoint over 0.00 seconds


Unit - Pause Caster


Animation - Change Caster's animation speed to 150.00% of its original speed


-------- ------------------------------------------------------- --------


-------- a custom script, the number there is the index number of "walk" animation (this differs per unit) --------


Custom script: call SetUnitAnimationByIndex(udg_Caster, 6)


-------- ------------------------------------------------------- --------


Trigger - Turn on Charge Loop <gen>
Charge Loop

Events


Time - Every 0.02 seconds of game time

Conditions

Actions


Set p1 = (Position of Caster)


-------- Checks distance between TargetPoint and caster's current location p1 --------


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



If - Conditions




(Distance between TargetPoint and p1) Greater than 10.44



Then - Actions




-------- It is not close enough, so we offset caster a little bit towards TargetPoint --------




Set p2 = (p1 offset by 10.44 towards (Angle from p1 to TargetPoint) degrees)




-------- ------------------------------------------------------- --------




-------- ------------------------------------------------------- --------




-------- We find X and Y coordiantes of p2 --------




Set x = (X of p2)




Set y = (Y of p2)




-------- ------------------------------------------------------- --------




-------- ------------------------------------------------------- --------




-------- This moves the caster, it moves Caster through any pathing, so you will "run" up/down cliffs, over deep water, etc. but you will also not be blocked by other units --------




-------- It moves caster by moving him to X and Y coordinates which we set up a few lines above --------




Custom script: call SetUnitX( udg_Caster, udg_x)




Custom script: call SetUnitY( udg_Caster, udg_y)




-------- ------------------------------------------------------- --------




-------- ------------------------------------------------------- --------




-------- This removes memory leaks. --------




Custom script: call RemoveLocation(udg_p1)




Custom script: call RemoveLocation(udg_p2)



Else - Actions




-------- Caster is close enough to TargetPoint, we move Caster one last time and end charge spell --------




Trigger - Turn off (This trigger)




-------- ------------------------------------------------------- --------




-------- We find X and Y coordinates of TargetPoint and move Caster there --------




Set x = (X of TargetPoint)




Set y = (Y of TargetPoint)




Custom script: call SetUnitX( udg_Caster, udg_x)




Custom script: call SetUnitY( udg_Caster, udg_y)




-------- ------------------------------------------------------- --------




-------- ------------------------------------------------------- --------




-------- Resets Caster's animation speed and current animation to defaults and create special effect --------




Animation - Reset Caster's animation




Animation - Change Caster's animation speed to 100.00% of its original speed




Special Effect - Create a special effect at TargetPoint using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl




Special Effect - Destroy (Last created special effect)




-------- ------------------------------------------------------- --------




-------- ------------------------------------------------------- --------




-------- Stops Caster to null his current order and unpauses him --------




Unit - Order Caster to Stop




Unit - Unpause Caster




Set Caster = No unit




-------- ------------------------------------------------------- --------




-------- ------------------------------------------------------- --------




-------- Removes leaks --------




Custom script: call RemoveLocation(udg_TargetPoint)




Custom script: call RemoveLocation(udg_p1)




Set Caster = No unit
