Moderator
M
Moderator
02:06, 1st Dec 2009
TriggerHappy:
Nice Spell. Sorry for the leak misunderstanding.
TriggerHappy:
Nice Spell. Sorry for the leak misunderstanding.
Events

Unit - A unit Starts the effect of an ability
Conditions

(Ability being cast) Equal to Vortex of Destruction
Actions

Set loc = (Position of (Triggering unit))

Set loc2 = (Target point of ability being cast)

-------- Launching Angle --------

Set a = (Angle from loc to loc2)

Set Vortex_Max = (Vortex_Max + 1)

-------- Caster --------

Set Vortex_Caster[Vortex_Max] = (Triggering unit)

-------- Damage per sphere --------

Set Vortex_Damage[Vortex_Max] = 30.00

-------- Total damage dealt --------

Set Vortex_Heal[(Vortex_Max x 3)] = 0.00

-------- Percentage of heal of total damage --------

Set Vortex_Heal[((Vortex_Max x 3) + 1)] = 0.10

-------- Heal per tree --------

Set Vortex_Heal[((Vortex_Max x 3) + 2)] = 10.00

-------- Normal AoE --------

Set Vortex_AoE[(Vortex_Max x 2)] = 200.00

-------- AoE at the end --------

Set Vortex_AoE[((Vortex_Max x 2) + 1)] = 400.00

-------- Damage Sfx --------

Set Vortex_Sfx[(Vortex_Max x 4)] = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl

-------- End Damage Sfx --------

Set Vortex_Sfx[((Vortex_Max x 4) + 1)] = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl

-------- Heal Sfx --------

Set Vortex_Sfx[((Vortex_Max x 4) + 2)] = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl

-------- Tree Kill Sfx --------

Set Vortex_Sfx[((Vortex_Max x 4) + 3)] = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl

-------- Speed --------

Set Vortex_Speed[(Vortex_Max x 3)] = 25.00

-------- To improve performance we save x- and y-Speed (so we don't have to calculate them again and again) --------

-------- Vertical Speed --------

Set Vortex_Speed[((Vortex_Max x 3) + 1)] = (Vortex_Speed[(Vortex_Max x 3)] x (Cos(a)))

-------- Horizontal Speed --------

Set Vortex_Speed[((Vortex_Max x 3) + 2)] = (Vortex_Speed[(Vortex_Max x 3)] x (Sin(a)))

-------- Distance traveled --------

Set Vortex_Distance[(Vortex_Max x 2)] = 0.00

-------- Max Distance --------

Set Vortex_Distance[((Vortex_Max x 2) + 1)] = (Distance between loc and loc2)

-------- Sphere Rotation Speed --------

Set Vortex_Rotation_Speed[Vortex_Max] = 10.00

-------- Distance between main missile and spheres --------

Set Vortex_Radius[Vortex_Max] = 100.00

-------- Creating the main missile --------

Unit - Create 1 Vortex_Dummy for (Owner of (Triggering unit)) at loc facing a degrees

-------- Remember: To change flying heigt with this your dummy mustn't fly but he must have the storm crow ability --------

Animation - Change (Last created unit) flying height to 200.00 at 0.00

Animation - Change (Last created unit)'s size to (300.00%, 300.00%, 300.00%) of its original size

-------- Setting the main missile --------

Set Vortex_Missile[Vortex_Max] = (Last created unit)

-------- Cause we can't add or remvoe units from groups which aren't created yet we need to create them --------

-------- Initializing group if not created yet --------

-------- To prevent new groups from being destroyed --------

Custom script: set bj_wantDestroyGroup = false

Custom script: if udg_Vortex_Sphere[udg_Vortex_Max] == null then

Set Vortex_Sphere[Vortex_Max] = (Random 0 units from Vortex_Sphere[0])

Custom script: endif

-------- Initializing group if not created yet --------

Custom script: if udg_Vortex_Struck[udg_Vortex_Max] == null then

Set Vortex_Struck[Vortex_Max] = (Random 0 units from Vortex_Struck[0])

Custom script: endif

-------- Creating spheres and adding them to their corresponding group --------

For each (Integer i) from 1 to ((Level of Vortex of Destruction for (Triggering unit)) x 3), do (Actions)


Loop - Actions



Unit - Create 1 Vortex_Dummy for (Owner of (Triggering unit)) at loc facing a degrees



Unit Group - Add (Last created unit) to Vortex_Sphere[Vortex_Max]

-------- Creating a dummy to check if a destructible is a tree --------

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


If - Conditions



harvester Not equal to No unit



(harvester is dead) Equal to False


Then - Actions


Else - Actions



Unit - Create 1 Peasant for Neutral Passive at loc facing 0.00 degrees



Set harvester = (Last created unit)



Unit - Hide (Last created unit)

-------- Removing leaks --------

Custom script: call RemoveLocation( udg_loc )

Custom script: call RemoveLocation( udg_loc2 )

-------- Turning on the main trigger --------

Trigger - Turn on VortexLoop <gen>
Events

Time - Every 0.03 seconds of game time
Conditions
Actions

-------- Loop threw all instances and.... --------

For each (Integer i) from 1 to Vortex_Max, do (Actions)


Loop - Actions



-------- Increase distance traveled --------



Set Vortex_Distance[(i x 2)] = (Vortex_Distance[(i x 2)] + Vortex_Speed[(i x 3)])



-------- Check if: --------



-------- Caster and main missile are alive --------



-------- Not removed --------



-------- Within the map bounds --------



-------- Spheres left --------



-------- Travaled distance less than or equal to max distance --------



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




If - Conditions





Vortex_Caster[i] Not equal to No unit





Vortex_Missile[i] Not equal to No unit





(Vortex_Caster[i] is dead) Equal to False





(Vortex_Missile[i] is dead) Equal to False





((Playable map area) contains Vortex_Missile[i]) Equal to True





(Vortex_Sphere[i] is empty) Equal to False





Vortex_Distance[(i x 2)] Less than or equal to Vortex_Distance[((i x 2) + 1)]




Then - Actions





-------- Set x- and y-position of the main missile --------





Custom script: set udg_x = GetUnitX( udg_Vortex_Missile[udg_i] )





Custom script: set udg_y = GetUnitY( udg_Vortex_Missile[udg_i] )





-------- Move position forward --------





Set x = (x + Vortex_Speed[((i x 3) + 1)])





Set y = (y + Vortex_Speed[((i x 3) + 2)])





-------- Move main missile to new position --------





Custom script: call SetUnitX( udg_Vortex_Missile[udg_i], udg_x )





Custom script: call SetUnitY( udg_Vortex_Missile[udg_i], udg_y )





Set loc = (Point(x, y))





Custom script: set bj_wantDestroyGroup = true





-------- Pick all valid enemys --------





Unit Group - Pick every unit in (Units within Vortex_AoE[(i x 2)] of loc matching ((((((Matching unit) is A structure) Equal to False) and (((Matching unit) is dead) Equal to False)) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is Magic Immune) Equal to Fa and do (Actions)






Loop - Actions







-------- Add to debug group so they won't be damaged again --------







Unit Group - Add (Picked unit) to Vortex_Struck[i]







-------- Deal damage equal to the number of spheres * damage --------







Unit - Cause Vortex_Caster[i] to damage (Picked unit), dealing ((Real((Number of units in Vortex_Sphere[i]))) x Vortex_Damage[i]) damage of attack type Spells and damage type Normal







-------- Save total damage dealt * decrement --------







Set Vortex_Heal[(i x 3)] = (Vortex_Heal[(i x 3)] + (((Real((Number of units in Vortex_Sphere[i]))) x Vortex_Damage[i]) x Vortex_Heal[((i x 3) + 1)]))







-------- Create special effect --------







Special Effect - Create a special effect attached to the origin of (Picked unit) using Vortex_Sfx[(i x 4)]







Special Effect - Destroy (Last created special effect)







-------- Remove a sphere from the sphere group --------







Set u = (Random unit from Vortex_Sphere[i])







Unit Group - Remove u from Vortex_Sphere[i]







Unit - Remove u from the game





-------- Aplly tree check and kill tree --------





Destructible - Pick every destructible within Vortex_AoE[(i x 2)] of loc and do (Actions)






Loop - Actions







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








If - Conditions









((Picked destructible) is dead) Equal to False








Then - Actions









Custom script: call SetUnitX( udg_harvester, udg_x )









Custom script: call SetUnitY( udg_harvester, udg_y )









Unit - Order harvester to Harvest (Picked destructible)









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










If - Conditions











(Current order of harvester) Equal to (Order(harvest))










Then - Actions











-------- Increase total damage by tree ammount --------











Set Vortex_Heal[(i x 3)] = (Vortex_Heal[(i x 3)] + Vortex_Heal[((i x 3) + 2)])











Set loc2 = (Position of (Picked destructible))











Special Effect - Create a special effect at loc2 using Vortex_Sfx[((i x 4) + 3)]











Special Effect - Destroy (Last created special effect)











Destructible - Kill (Picked destructible)











Custom script: call RemoveLocation( udg_loc2 )










Else - Actions









Unit - Order harvester to Stop








Else - Actions





-------- Increase rotation angle by rotation speed --------





Set Vortex_Rotation_Angle[i] = ((Vortex_Rotation_Angle[i] + Vortex_Rotation_Speed[i]) mod 360.00)





Set i2 = 0





-------- Rotate spheres around main missile --------





-------- Actually it is too complicated to explain why this works without pictures so I won't :P --------





Unit Group - Pick every unit in Vortex_Sphere[i] and do (Actions)






Loop - Actions







Set a = (Vortex_Rotation_Angle[i] + ((360.00 / (Real((Number of units in Vortex_Sphere[i])))) x (Real(i2))))







Animation - Change (Picked unit) flying height to (((Sin(a)) x Vortex_Radius[i]) + ((Current flying height of Vortex_Missile[i]) + 45.00)) at 0.00







Set x2 = (x + ((Sin((Facing of Vortex_Missile[i]))) x ((Cos(a)) x Vortex_Radius[i])))







Set y2 = (y + ((Cos((Facing of Vortex_Missile[i]))) x ((Cos(a)) x Vortex_Radius[i])))







Set x2 = (x + ((Cos(((Facing of Vortex_Missile[i]) + 90.00))) x ((Cos(a)) x Vortex_Radius[i])))







Set y2 = (y + ((Sin(((Facing of Vortex_Missile[i]) + 90.00))) x ((Cos(a)) x Vortex_Radius[i])))







Custom script: call SetUnitX( GetEnumUnit(), udg_x2 )







Custom script: call SetUnitY( GetEnumUnit(), udg_y2 )







Set i2 = (i2 + 1)





Custom script: call RemoveLocation( udg_loc )




Else - Actions





-------- Actions on end of travel --------





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






If - Conditions







Vortex_Caster[i] Not equal to No unit







(Vortex_Caster[i] is dead) Equal to False







Vortex_Heal[(i x 3)] Not equal to 0.00






Then - Actions







Set loc = (Position of Vortex_Missile[i])







-------- Apply heal --------







Unit - Set life of Vortex_Caster[i] to ((Life of Vortex_Caster[i]) + Vortex_Heal[(i x 3)])







Special Effect - Create a special effect attached to the origin of Vortex_Caster[i] using Vortex_Sfx[((i x 4) + 2)]







Special Effect - Destroy (Last created special effect)







-------- Display heal ammount --------







Floating Text - Create floating text that reads ((String((Integer(Vortex_Heal[(i x 3)])))) + !!) above Vortex_Caster[i] with Z offset 0.00, using font size 10.00, color (60.00%, 0.00%, 80.00%), and 0.00% transparency







Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees







Floating Text - Change (Last created floating text): Disable permanence







Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds







Custom script: set bj_wantDestroyGroup = true







-------- Pick all valid enemys (including the ones which were hit already) --------







Unit Group - Pick every unit in (Units within Vortex_AoE[((i x 2) + 1)] of loc matching ((((((Matching unit) is A structure) Equal to False) and (((Matching unit) is dead) Equal to False)) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is Magic Immune) Equal and do (Actions)








Loop - Actions









-------- Deal damage equal to total damage --------









Unit - Cause Vortex_Caster[i] to damage (Picked unit), dealing Vortex_Heal[(i x 3)] damage of attack type Spells and damage type Normal









Special Effect - Create a special effect attached to the origin of (Picked unit) using Vortex_Sfx[((i x 4) + 1)]









Special Effect - Destroy (Last created special effect)







Custom script: call RemoveLocation( udg_loc )






Else - Actions





-------- Remove main missile --------





Unit - Remove Vortex_Missile[i] from the game





-------- Remove spheres --------





Unit Group - Pick every unit in Vortex_Sphere[i] and do (Actions)






Loop - Actions







Unit - Remove (Picked unit) from the game





-------- Shift data to increase performance of loop --------





Set Vortex_Missile[i] = Vortex_Missile[Vortex_Max]





Set Vortex_Caster[i] = Vortex_Caster[Vortex_Max]





Set Vortex_Damage[i] = Vortex_Damage[Vortex_Max]





Set Vortex_Heal[(i x 3)] = Vortex_Heal[(Vortex_Max x 3)]





Set Vortex_Heal[((i x 3) + 1)] = Vortex_Heal[((Vortex_Max x 3) + 1)]





Set Vortex_Heal[((i x 3) + 2)] = Vortex_Heal[((Vortex_Max x 3) + 2)]





Set Vortex_AoE[(i x 2)] = Vortex_AoE[(Vortex_Max x 2)]





Set Vortex_AoE[((i x 2) + 1)] = Vortex_AoE[((Vortex_Max x 2) + 1)]





Set Vortex_Speed[(i x 3)] = Vortex_Speed[(Vortex_Max x 3)]





Set Vortex_Speed[((i x 3) + 1)] = Vortex_Speed[((Vortex_Max x 3) + 1)]





Set Vortex_Speed[((i x 3) + 2)] = Vortex_Speed[((Vortex_Max x 3) + 2)]





Set Vortex_Rotation_Speed[i] = Vortex_Rotation_Speed[Vortex_Max]





Set Vortex_Rotation_Angle[i] = Vortex_Rotation_Angle[Vortex_Max]





Set Vortex_Radius[i] = Vortex_Radius[Vortex_Max]





Set Vortex_Distance[(i x 2)] = Vortex_Distance[(Vortex_Max x 2)]





Set Vortex_Distance[((i x 2) + 1)] = Vortex_Distance[((Vortex_Max x 2) + 1)]





Set Vortex_Sfx[(i x 4)] = Vortex_Sfx[(Vortex_Max x 4)]





Set Vortex_Sfx[((i x 4) + 1)] = Vortex_Sfx[((Vortex_Max x 4) + 1)]





Set Vortex_Sfx[((i x 4) + 2)] = Vortex_Sfx[((Vortex_Max x 4) + 2)]





Set Vortex_Sfx[((i x 4) + 3)] = Vortex_Sfx[((Vortex_Max x 4) + 3)]





Unit Group - Remove all units from Vortex_Struck[i]





Unit Group - Add all units of Vortex_Struck[Vortex_Max] to Vortex_Struck[i]





Unit Group - Remove all units from Vortex_Struck[Vortex_Max]





Unit Group - Remove all units from Vortex_Sphere[i]





Unit Group - Add all units of Vortex_Sphere[Vortex_Max] to Vortex_Sphere[i]





Unit Group - Remove all units from Vortex_Sphere[Vortex_Max]





-------- Decrease loop integer --------





Set Vortex_Max = (Vortex_Max - 1)





Set i = (i - 1)

-------- Turn trigger off if there are no instances left --------

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


If - Conditions



Vortex_Max Less than 1


Then - Actions



Trigger - Turn off (This trigger)


Else - Actions