Moderator
M
Moderator
18:19, 17th Jan 2010
TriggerHappy:
Looks MUI and leakless to me.
TriggerHappy:
Looks MUI and leakless to me.
ASHashtable

Events


Map initialization

Conditions

Actions


-------- Creating the hashtable --------


Hashtable - Create a hashtable


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


-------- Store it into a variable --------


Set ASHashtable = (Last created hashtable)


-------- ----------------------------------------------------------------------------------------------------------------------------- --------
ASInit

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Arcane Storm

Actions


-------- Turn on the periodic trigger , realy important to make the spell work --------


Trigger - Turn on ASPeriodic <gen>


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


-------- Put the caster into a variable , note: Triggering unit is more efficient than Casting unit --------


Set ASCaster = (Triggering unit)


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


-------- Store Caster's position into a variable --------


Set ASCasterPoint = (Position of ASCaster)


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


-------- Set who own the caster --------


Set ASPlayer = (Owner of ASCaster)


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


-------- Set the aoe of the spell , note: you can change the value to what you want --------


Set ASAOE = (250.00 + (50.00 x (Real((Level of Arcane Storm for ASCaster)))))


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


-------- Set the damage of the spell, Note: you can change this value to what you want --------


Set ASDamage = (15.00 + (5.00 x (Real((Level of Arcane Storm for ASCaster)))))


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


-------- This is the time of the spell. Note you can change the value to what you want. --------


Set ASTime = 5.00


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


-------- This add the caster to a group it's important so don't touch it --------


Unit Group - Add ASCaster to ASCasterGroup


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


-------- Here I save values that I have stored before --------


-------- Dont change anything here --------


Hashtable - Save ASTime as (Key Time) of (Key (Triggering unit)) in ASHashtable


Hashtable - Save Handle OfASPlayer as 2 of (Key (Triggering unit)) in ASHashtable


Hashtable - Save ASAOE as (Key Aoe) of (Key (Triggering unit)) in ASHashtable


Hashtable - Save ASDamage as (Key Damage) of (Key (Triggering unit)) in ASHashtable


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


Custom script: call RemoveLocation(udg_ASCasterPoint)
ASPeriodic

Events


Time - Every 0.25 seconds of game time

Conditions


(ASCasterGroup is empty) Equal to False

Actions


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



Loop - Actions




Set ASCaster = (Picked unit)




Set ASCasterPoint = (Position of ASCaster)




-------- Here we load the value that I saved before --------




Set ASPlayer = (Load 2 of (Key (Picked unit)) in ASHashtable)




Set ASTime = (Load (Key Time) of (Key (Picked unit)) from ASHashtable)




Set ASDamage = (Load (Key Damage) of (Key (Picked unit)) from ASHashtable)




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




-------- Set who will can be targeted , note: you can change boolean to damage more specific unit --------




Set ASDamageGroup = (Units within ASAOE of ASCasterPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of ASPlayer) Equal to True))))




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




-------- This group will make the ray damage only 1 unit in ASDamageGroup --------




Set ASRandomGroup = (Random 1 units from ASDamageGroup)




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




-------- Here I create special effect to had eye candy and show when your spell fade off --------




Special Effect - Create a special effect attached to the origin of ASCaster using Abilities\Spells\Items\AIre\AIreTarget.mdl




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




-------- Here I delete the special effect so it don't leak --------




Special Effect - Destroy (Last created special effect)




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




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





If - Conditions






ASTime Greater than 0.00





Then - Actions






-------- This a timer system , just don't change this --------






Hashtable - Save (ASTime - 0.25) as (Key Time) of (Key (Picked unit)) in ASHashtable






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






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







Loop - Actions








-------- Set the target --------








Set ASTarget = (Picked unit)








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








-------- set his position --------








Set ASTargetPoint = (Position of ASTarget)








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








-------- Here I deal damage to the target --------








Unit - Cause ASCaster to damage ASTarget, dealing ASDamage damage of attack type Spells and damage type Normal








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








-------- Here I create an explosion at the target --------








Unit - Create 1 Arcane Storm[Explosion] for ASPlayer at ASTargetPoint facing ASTargetPoint








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








-------- Store that explosion into a variable --------








Set ASExplosion = (Last created unit)








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








-------- Make it die after 1 seconds --------








Unit - Add a 1.00 second Generic expiration timer to ASExplosion








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








-------- This loop is here to create the ray --------








For each (Integer A) from 1 to 20, do (Actions)









Loop - Actions










-------- Here I set how far in the air the ray will go.Note: you can change the value to what you want --------










Set ASRayFly = (60.00 x (Real((Integer A))))










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










-------- Here I create the unit that will make the ray --------










Unit - Create 1 Arcane Storm[Ray] for ASPlayer at ASTargetPoint facing ASTargetPoint










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










-------- Store that unit into a variable --------










Set ASRay = (Last created unit)










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










-------- this will make that unit die after 1 sec --------










Unit - Add a 1.00 second Generic expiration timer to ASRay










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










-------- This will make the ray --------










Animation - Change ASRay flying height to ASRayFly at 0.00










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








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





Else - Actions






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






-------- All those actions below will happen when the time will be 0 --------






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






-------- Here I remove the caster from the unit group that I've put him in ASInit --------






Unit Group - Remove ASCaster from ASCasterGroup






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






-------- This will close that trigger if there noone in that group --------






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







If - Conditions








(ASCasterGroup is empty) Equal to True







Then - Actions








Trigger - Turn off ASPeriodic <gen>







Else - Actions






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






-------- Here I clear Leaks --------






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






Custom script: call RemoveLocation(udg_ASTargetPoint)






Custom script: call DestroyGroup(udg_ASDamageGroup)






Custom script: call DestroyGroup(udg_ASRandomGroup)






Custom script: call RemoveLocation(udg_ASCasterPoint)






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