I've made a Telepost Strike spell, which basically makes then caster to teleport to the target unit and slash it 5/10/15 times. If the target unit dies and the caster still has slashes left, it proceeds to the next valid target.
Here's some info about my hashtable:
index purpose
0 damage (per slash)
1 counter (number of slashes left)
2 target unit
3 caster's position when it begins casting
4 special effect attached to weapon
5 first illusion
6 second illusion
Here's the code:
The problem is that sometimes the caster remains paused after finishing the spell. Also, sometimes the caster isn't teleported back to its original location or it doesn't find a new target (even if surrounded by enemies).
Here's some info about my hashtable:
index purpose
0 damage (per slash)
1 counter (number of slashes left)
2 target unit
3 caster's position when it begins casting
4 special effect attached to weapon
5 first illusion
6 second illusion
Here's the code:
-
Teleport Strike
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Teleport Strike
-
Actions
- Set Target = (Target unit of ability being cast)
- Set Counter = (5 x (Level of Teleport Strike for (Triggering unit)))
- Set Damage = ((Real((Agility of (Triggering unit) (Include bonuses)))) x 1.25)
- Set TempPoint = (Position of (Triggering unit))
- Hashtable - Save Damage as 0 of (Key (Triggering unit)) in TeleportStrikeTable
- Hashtable - Save Counter as 1 of (Key (Triggering unit)) in TeleportStrikeTable
- Hashtable - Save Handle OfTarget as 2 of (Key (Triggering unit)) in TeleportStrikeTable
- Hashtable - Save Handle OfTempPoint as 3 of (Key (Triggering unit)) in TeleportStrikeTable
- Unit Group - Add (Triggering unit) to TeleportStrikeGroup
- Unit - Pause (Triggering unit)
- Special Effect - Create a special effect attached to the weapon of (Triggering unit) using war3mapImported\TornadoMissile.mdx
- Hashtable - Save Handle Of(Last created special effect) as 4 of (Key (Triggering unit)) in TeleportStrikeTable
- Trigger - Turn on Teleport Strike Effect <gen>
-
Events
-
Teleport Strike Effect
-
Events
- Time - Every 0.30 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in TeleportStrikeGroup and do (Actions)
-
Loop - Actions
- Set Counter = (Load 1 of (Key (Picked unit)) from TeleportStrikeTable)
- Set Damage = (Load 0 of (Key (Picked unit)) from TeleportStrikeTable)
- Set Caster = (Picked unit)
- Set Target = (Load 2 of (Key (Picked unit)) in TeleportStrikeTable)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Counter Greater than 0
-
Then - Actions
- Set TempPoint = (Position of Caster)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Target is dead) Equal to True
- (Target has buff Invulnerable) Equal to True
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Set TempGroup = (Units within 800.00 of TempPoint matching ((((Owner of (Matching unit)) is an ally of (Owner of (Picked unit))) Equal to False) and ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is M
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in TempGroup) Equal to 0
-
Then - Actions
- Custom script: call RemoveLocation (udg_TempPoint)
- Custom script: call DestroyGroup (udg_TempGroup)
- Set Counter = 0
- Hashtable - Save Counter as 1 of (Key (Picked unit)) in TeleportStrikeTable
- Skip remaining actions
- Else - Actions
-
If - Conditions
- Set Target = (Random unit from TempGroup)
- Custom script: call DestroyGroup (udg_TempGroup)
- Else - Actions
-
If - Conditions
- Set TempPoint3 = (Position of Target)
- Set TempPoint2 = (TempPoint3 offset by 50.00 towards (Angle from TempPoint to TempPoint3) degrees)
- Unit - Move Caster instantly to TempPoint2, facing (Angle from TempPoint2 to TempPoint) degrees
- Set TempUnit = (Load 6 of (Key (Picked unit)) in TeleportStrikeTable)
- Unit - Remove TempUnit from the game
- Set TempUnit = (Load 5 of (Key (Picked unit)) in TeleportStrikeTable)
- Hashtable - Save Handle Of(Last created unit) as 6 of (Key (Picked unit)) in TeleportStrikeTable
- Set CloneLocation = TempPoint2
- Set ClonedUnit = Caster
- Trigger - Run Clone Unit <gen> (ignoring conditions)
- Animation - Change (Last created unit)'s vertex coloring to (30.00%, 30.00%, 100.00%) with 40.00% transparency
- Unit - Add Zero Damage (item) to (Last created unit)
- Unit - Remove classification of A Hero from (Last created unit)
- Hashtable - Save Handle Of(Last created unit) as 5 of (Key (Picked unit)) in TeleportStrikeTable
- Special Effect - Create a special effect at TempPoint2 using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
- Special Effect - Destroy (Last created special effect)
- Animation - Play Caster's attack animation
- Unit - Cause Caster to damage Target, dealing Damage damage of attack type Spells and damage type Enhanced
- Custom script: call RemoveLocation (udg_TempPoint)
- Custom script: call RemoveLocation (udg_TempPoint3)
- Custom script: call RemoveLocation (udg_TempPoint2)
- Set Counter = (Counter - 1)
- Hashtable - Save Counter as 1 of (Key (Picked unit)) in TeleportStrikeTable
- Hashtable - Save Handle OfTarget as 2 of (Key (Picked unit)) in TeleportStrikeTable
-
Else - Actions
- Set TempUnit = (Load 6 of (Key (Picked unit)) in TeleportStrikeTable)
- Unit - Remove TempUnit from the game
- Set TempUnit = (Load 5 of (Key (Picked unit)) in TeleportStrikeTable)
- Unit - Remove TempUnit from the game
- Set TempPoint = (Load 3 of (Key (Picked unit)) in TeleportStrikeTable)
- Unit - Move Caster instantly to TempPoint
- Custom script: call RemoveLocation (udg_TempPoint)
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in FireBreathTable
- Unit - Unpause (Picked unit)
- Set TempEffect = (Load 4 of (Key (Picked unit)) in TeleportStrikeTable)
- Special Effect - Destroy TempEffect
- Unit Group - Remove (Picked unit) from TeleportStrikeGroup
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in TeleportStrikeGroup) Equal to 0
-
Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
If - Conditions
-
Loop - Actions
-
Unit Group - Pick every unit in TeleportStrikeGroup and do (Actions)
-
Events