Burning ArrowThe hero shoots a burning arrow that flies a great distance towards the targeted point, dealing damage to all units in a line that it hits. Additionally, the arrow's intense heat ignites the ground below it as it travels, creating secondary explosions for extra damage and burning units over time.
Level 1 - Range -750, Arrow Damage - 75
Level 2 - Range -1000, Arrow Damage - 100
Level 3 - Range -1250, Arrow Damage - 125
Hashtable

Events


Map initialization

Conditions

Actions


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


-------- We create a hashtable --------


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


Hashtable - Create a hashtable


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


-------- And now we set it to a variable, to know which one to use --------


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


Set BA_Hashtable = (Last created hashtable)
BA Init
BA Init

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Burning Arrow

Actions


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


-------- We incarase the number of run triggers, to keep running loop trigger --------


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


Set BA_To_Finish = (BA_To_Finish + 1)


-------- We set a position of caster, to don`t leak in setting with polar offset --------


Set BA_Startpt = (Position of (Triggering unit))


-------- We set a target point of ability, to count the angle, where the arrow will be created --------


Set BA_Targetpt = (Target point of ability being cast)


-------- We set the level of ability, for further setting levels of flamestrikes for dummies --------


Set BA_Flame_Lvl = (Level of Burning Arrow for (Triggering unit))


-------- Now we set the distance --------


-------- (how far the arrow will fly) --------


Set BA_Distance = (500 + (250 x (Level of Burning Arrow for (Triggering unit))))


-------- We set what will be the instant damage of arrow --------


Set BA_Damage = (50.00 + (25.00 x (Real((Level of Burning Arrow for (Triggering unit))))))


-------- We set the angle, In which way the arrow will fly --------


Set BA_Arrow_Angle = (Angle from BA_Startpt to BA_Targetpt)


-------- We set the point, where the arrow will be created --------


Set BA_Creatept = (BA_Startpt offset by 75.00 towards BA_Arrow_Angle degrees)


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


-------- We create the arrow --------


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


Unit - Create 1 Dummy ( Arrow ) for (Owner of (Triggering unit)) at BA_Creatept facing BA_Arrow_Angle degrees


-------- We turn collision off for the arrow, to don`t let it block on units --------


Unit - Turn collision for (Last created unit) Off


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


-------- We clean the leaks, cause we won`t need these locations no longer --------


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


Custom script: call RemoveLocation (udg_BA_Startpt)


Custom script: call RemoveLocation (udg_BA_Targetpt)


Custom script: call RemoveLocation (udg_BA_Creatept)


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


-------- Now we store the data to hashtables --------


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


-------- Here we store the damage to hashtable --------


Hashtable - Save BA_Damage as 0 of (Key (Last created unit)) in BA_Hashtable


-------- This data is our "counter" --------


-------- (More about a "counter" in README) --------


Hashtable - Save 0 as 1 of (Key (Last created unit)) in BA_Hashtable


-------- We store a distance to the hashtable --------


Hashtable - Save (BA_Distance / 25) as 2 of (Key (Last created unit)) in BA_Hashtable


-------- We store the level of "Burning Arrow" to hashtable --------


Hashtable - Save BA_Flame_Lvl as 3 of (Key (Last created unit)) in BA_Hashtable


-------- We store the angle, to make arrow move in only one way --------


Hashtable - Save BA_Arrow_Angle as 4 of (Key (Last created unit)) in BA_Hashtable


-------- Here we set the counter of flamestrikes --------


-------- (distance between them) --------


-------- (More about this "counter" in README too) --------


Hashtable - Save 0 as 5 of (Key (Last created unit)) in BA_Hashtable


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


-------- We add the arrow to the group --------


-------- (In loop trigger it will make arrow move) --------


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


Unit Group - Add (Last created unit) to BA_Arrows


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


-------- Here we "check" if the loop trigger is already running, because if is, there is no need to turn it on again --------


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


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



If - Conditions




(Number of units in BA_Arrows) Equal to 1



Then - Actions




Trigger - Turn on BA Loop <gen>



Else - Actions


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


-------- End of this trigger, now look at the loop trigger --------


-------- ---------------- --------
BA Loop

Event


Time - Every 0.03 seconds of game time

Conditions

Actions


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


-------- We pick all the arrows to move them --------


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


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



Loop - Actions




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




-------- Here we check if our counter is greater than max distance --------




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




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





If - Conditions






(Load 1 of (Key (Picked unit)) from BA_Hashtable) Less than or equal to (Load 2 of (Key (Picked unit)) from BA_Hashtable)





Then - Actions






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






-------- We incarase our counter, to make the spell finish somewhen --------






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






Hashtable - Save ((Load 1 of (Key (Picked unit)) from BA_Hashtable) + 1) as 1 of (Key (Picked unit)) in BA_Hashtable






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






-------- We load the damage, which will be dealed to units within AoE of arrow to make life easier --------






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






Set BA_Dealdmg = (Load 0 of (Key (Picked unit)) from BA_Hashtable)






-------- We set currently picked arrow to a variable to make life easier --------






Set BA_Arrow = (Picked unit)






-------- We set the position of the arrow, to don`t leak in polar projection --------






Set BA_Arrowpt = (Position of BA_Arrow)






-------- We set the point, the arrow will be moved in --------






Set BA_Movept = (BA_Arrowpt offset by 25.00 towards (Load 4 of (Key (Picked unit)) from BA_Hashtable) degrees)






-------- We move the arrow --------






Unit - Move BA_Arrow instantly to BA_Movept






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






-------- Now we will damage the units "touched" by our arrow --------






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






-------- We set the units which are very close to arrow to a variable to don`t leak --------






Set BA_Victims = (Units within 50.00 of BA_Movept matching ((((Matching unit) belongs to an enemy of (Owner of BA_Arrow)) Equal to True) and (((Matching unit) is alive) Equal to True)))






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







Loop - Actions








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








-------- We damage these units --------








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








Unit - Cause BA_Arrow to damage (Picked unit), dealing BA_Dealdmg damage of attack type Spells and damage type Normal








-------- We add nice SFX --------








Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl








-------- We remove special effect, to don`t leak --------








Special Effect - Destroy (Last created special effect)






-------- We remove leaking group --------






Custom script: call DestroyGroup (udg_BA_Victims)






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






-------- Now flamestrikes --------






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






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







If - Coditions








(Load 5 of (Key (Picked unit)) from BA_Hashtable) Equal to 5







Then - Actions








-------- If our counter value is as big as we wanted, we set it to 0 to make it start again --------








Hashtable - Save 0 as 5 of (Key (Picked unit)) in BA_Hashtable








-------- We create dummy unit, which will cast the flamestrike --------








Unit - Create 1 Dummy ( Unit ) for (Owner of BA_Arrow) at BA_Arrowpt facing Default building facing degrees








-------- We make it die --------








Unit - Add a 1.00 second Generic expiration timer to (Last created unit)








-------- We add a flamestrike to dummy -------








-------- ( If you have already dummy unit on your map, you can simply just change summy unit I used to yours, and it will work ) --------








Unit - Add Flame ( DUMMY ) to (Last created unit)








-------- We set the level of flamestrike to tlevel of burning arrow for caster --------








Unit - Set level of Flame ( DUMMY ) for (Last created unit) to (Load 3 of (Key (Picked unit)) from BA_Hashtable)








-------- We order dummy to cast flamestrike --------








Unit - Order (Last created unit) to Human Blood Mage - Flame Strike BA_Movept







Else - Actions








-------- If the counter value is not big enaugh, we incarase it --------








Hashtable - Save ((Load 5 of (Key (Picked unit)) from BA_Hashtable) + 1) as 5 of (Key (Picked unit)) in BA_Hashtable







Albo - Akcje








-------- If the counter value is not big enaugh, we incarase it --------








Hashtable - Save ((Load 5 of (Key (Picked unit)) from BA_Hashtable) + 1) as 5 of (Key (Picked unit)) in BA_Hashtable






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






-------- We clean location, because we won`t need them again --------






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






Custom script: call RemoveLocation (udg_BA_Arrowpt)






Custom script: call RemoveLocation (udg_BA_Movept)





Else - Actions






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






-------- If the arrow has reached the max distance, we clear the hashtable, to remove the data, we won`t need agtain --------






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






Hashtable - Clear all child hashtables of child (Key (Picked unit)) in BA_Hashtable






-------- We remove the arrow from moving group --------






Unit Group - Remove (Picked unit) from BA_Arrows






-------- We kill it :( --------






Unit - Kill (Picked unit)






-------- And we decrase the number, which will turn off the trigger, if there are no arrows flying --------






Set BA_To_Finish = (BA_To_Finish - 1)


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


-------- And this is what we do now --------


-------- If there are no arrows on the map now, we turn loop trigger off, to stop using memory, when it`s not needed --------


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


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



If - Condition




BA_To_Finish Equal to 0



Then - Actions




Trigger - Turn off (This trigger)



Else - Actions
Set BA_Distance = (500 + (250 x (Level of Burning Arrow for (Triggering unit))))
Set BA_Damage = (50.00 + (25.00 x (Real((Level of Burning Arrow for (Triggering unit))))))
Set BA_Distance = (500 + (250 x BA_Flame_Lvl))
Set BA_Damage = (50.00 + (25.00 x (Real(BA_Flame_Lvl))))