Just started making spells with hashtables again after almost a year away from it. I was amazed that this spell worked the very first time I tested it, but need to make sure it is efficient as far as GUI goes.
Here is what it is supposed to do:
Unit casts it in a target direction, a projectile goes in target direction for 2500 distance. When projectile comes in contact with enemy unit, it explodes and damages an AOE based on how far it went (25 damage at point blank, 75 damage at 1500+ range, linear increase). Projectile is unit "P.ELE-1" and every frame of the spell (0.03 sec), a unit "E.ELE-1" is spawned at the projectiles location, using the model "trap-fire" for visual effect only.
Here is the code, trigger 1 generates the projectile with all the values (angle, speed, etc) that are checked each frame in trigger 2.
Here is what it is supposed to do:
Unit casts it in a target direction, a projectile goes in target direction for 2500 distance. When projectile comes in contact with enemy unit, it explodes and damages an AOE based on how far it went (25 damage at point blank, 75 damage at 1500+ range, linear increase). Projectile is unit "P.ELE-1" and every frame of the spell (0.03 sec), a unit "E.ELE-1" is spawned at the projectiles location, using the model "trap-fire" for visual effect only.
Here is the code, trigger 1 generates the projectile with all the values (angle, speed, etc) that are checked each frame in trigger 2.
-
Lava Surge 01
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to ELE-1 Lava Surge
-
-
Actions
-
Set current_hashtable = H_LavaSurge
-
Set current_group = G_LavaSurge
-
Set temp_point = (Position of (Triggering unit))
-
Set temp_point2 = (Target point of ability being cast)
-
Set temp_real = (Angle from temp_point to temp_point2)
-
Custom script: call RemoveLocation(udg_temp_point2)
-
Set temp_point2 = (temp_point offset by 50.00 towards temp_real degrees)
-
Custom script: call RemoveLocation(udg_temp_point)
-
Unit - Create 1 P.ELE-1 Lava Surge for (Owner of (Triggering unit)) at temp_point2 facing temp_real degrees
-
Custom script: call RemoveLocation(udg_temp_point2)
-
Hashtable - Save Handle Of(Triggering unit) as (Key caster) of (Key (Last created unit)) in current_hashtable
-
Hashtable - Save temp_real as (Key angle) of (Key (Last created unit)) in current_hashtable
-
Hashtable - Save 720.00 as (Key speed) of (Key (Last created unit)) in current_hashtable
-
Hashtable - Save 50.00 as (Key distance) of (Key (Last created unit)) in current_hashtable
-
Hashtable - Save 25.00 as (Key damage) of (Key (Last created unit)) in current_hashtable
-
Unit Group - Add (Last created unit) to current_group
-
Trigger - Turn on Lava Surge 02 <gen>
-
Custom script: set udg_current_hashtable = null
-
Custom script: call DestroyGroup(udg_current_group)
-
-
-
Lava Surge 02
-
Events
-
Time - Every 0.03 seconds of game time
-
-
Conditions
-
Actions
-
Set current_hashtable = H_LavaSurge
-
Set current_group = G_LavaSurge
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in current_group) Greater than 0
-
-
Then - Actions
-
Unit Group - Pick every unit in current_group and do (Actions)
-
Loop - Actions
-
Set temp_point = (Position of (Picked unit))
-
Set temp_group = (Units within 50.00 of temp_point matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Mechanical) Equal to False) and (((Matching unit) belongs to an ally of (Owner of (Picked unit))) Equal to False))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in temp_group) Greater than 0
-
-
Then - Actions
-
Custom script: call DestroyGroup(udg_temp_group)
-
Unit - Kill (Picked unit)
-
Special Effect - Create a special effect at temp_point using Abilities\Spells\Other\Doom\DoomDeath.mdl
-
Special Effect - Destroy (Last created special effect)
-
Set temp_group = (Units within 300.00 of temp_point matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Mechanical) Equal to False) and (((Matching unit) belongs to an ally of (Owner of (Picked unit))) Equal to False))))
-
Custom script: call RemoveLocation(udg_temp_point)
-
Set temp_unit = (Load (Key caster) of (Key (Picked unit)) in current_hashtable)
-
Set temp_real = (Load (Key damage) of (Key (Picked unit)) from current_hashtable)
-
Unit Group - Remove (Picked unit) from current_group
-
Unit Group - Pick every unit in temp_group and do (Actions)
-
Loop - Actions
-
Unit - Cause temp_unit to damage (Picked unit), dealing temp_real damage of attack type Hero and damage type Normal
-
Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Items\AIfb\AIfbSpecialArt.mdl
-
Special Effect - Destroy (Last created special effect)
-
Unit Group - Remove (Picked unit) from temp_group
-
-
-
Custom script: call DestroyGroup(udg_temp_group)
-
-
Else - Actions
-
Unit - Create 1 E.ELE-1 Lava Surge for (Owner of (Picked unit)) at temp_point facing Default building facing degrees
-
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
-
Set temp_point2 = (temp_point offset by ((Load (Key speed) of (Key (Picked unit)) from current_hashtable) x R_FRAME_PROJECTILES) towards (Load (Key angle) of (Key (Picked unit)) from current_hashtable) degrees)
-
Unit - Move (Picked unit) instantly to temp_point2
-
Hashtable - Save ((Load (Key distance) of (Key (Picked unit)) from current_hashtable) + (Distance between temp_point and temp_point2)) as (Key distance) of (Key (Picked unit)) in current_hashtable
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Load (Key damage) of (Key (Picked unit)) from current_hashtable) Greater than or equal to 75.00
-
-
Then - Actions
-
Hashtable - Save 75.00 as (Key damage) of (Key (Picked unit)) in current_hashtable
-
-
Else - Actions
-
Hashtable - Save ((Load (Key damage) of (Key (Picked unit)) from current_hashtable) + ((Distance between temp_point and temp_point2) / 30.00)) as (Key damage) of (Key (Picked unit)) in current_hashtable
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Load (Key distance) of (Key (Picked unit)) from current_hashtable) Greater than or equal to 2500.00
-
-
Then - Actions
-
Unit - Kill (Picked unit)
-
Unit Group - Remove (Picked unit) from current_group
-
-
Else - Actions
-
-
-
-
-
-
-
Else - Actions
-
Trigger - Turn off (This trigger)
-
-
-
Custom script: set udg_current_hashtable = null
-
Custom script: call DestroyGroup(udg_current_group)
-
-