Moderator
M
Moderator
14:23, 16th Jun 2010
TriggerHappy:
MUI and useful.
TriggerHappy:
MUI and useful.
Lightning Heart Init

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Lightning Heart

Actions


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


-------- Hi! --------


-------- I Hope you enjoy my spell --------


-------- Those Comments are there to explain to New(or maybe pro) what all those actions do and make them understand my work --------


-------- Note: My english isn't super good, But I tried my best to make those comments --------


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


-------- This Condition is require to make the spell work, it's there for effeciency --------


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


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



If - Conditions




LHIndex[2] Equal to 0



Then - Actions




Trigger - Turn on Lightning Heart Periodic <gen>



Else - Actions


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


-------- Those two Index seems to be same but in reality they are both realy important for MUI --------


-------- Note: MUI is the capacity to multiple unit to cast in same time and the spell will still work --------


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


Set LHIndex[1] = (LHIndex[1] + 1)


Set LHIndex[2] = (LHIndex[2] + 1)


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


-------- Here I set some data which will be required --------


-------- The player variable is important for MPI --------


-------- Note; MPI is the capacity to multiple player to cast the spell and it will still work --------


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


Set LHCaster[LHIndex[1]] = (Triggering unit)


Set LHCasterPoint = (Position of LHCaster[LHIndex[1]])


Set LHPlayer[LHIndex[1]] = (Owner of LHCaster[LHIndex[1]])


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


-------- Those 4 angle will be require to make the 4 spiral which go in the air --------


-------- And their value is their position in the offset position so they're not a the same place --------


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


Set LHAngleOne = 0.00


Set LHAngleTwo = 90.00


Set LHAngleThree = 180.00


Set LHAngleFour = 270.00


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


-------- This is important to put those variable at 0 because every time you will cast the spell the flying height will start a 0 --------


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


Set LHSpireFly = 0.00


Set LHFly = 0.00


Set LHThunderFly = 0.00


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


-------- This Real variable is here to add a bit of effect just don't change --------


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


Set LHSize = 500.00


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


-------- This real variable set the duration of the spell --------


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


Set LHTimer[LHIndex[1]] = 10.00


Set LHDamage[LHIndex[1]] = (((Mana of LHCaster[LHIndex[1]]) x (Real((Level of Lightning Heart for LHCaster[LHIndex[1]])))) / 100.00)


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


-------- Here I apply the condition to use the spell --------


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


Unit - Set mana of LHCaster[LHIndex[1]] to 0.00


Unit - Set life of LHCaster[LHIndex[1]] to ((Life of LHCaster[LHIndex[1]]) / 2.00)


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


-------- Here I put the caster into a group , I think If i don't it won't be MUI but I'm not sure... Well just don't remove that --------


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


Unit Group - Add LHCaster[LHIndex[1]] to LHCasterGroup[LHIndex[1]]


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


-------- Here we create a unit called reject ( Had a lack of name idea ) , this unit is just here to make the position to deal damage --------


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


Unit - Create 1 Lightning Heart[Reject] for LHPlayer[LHIndex[1]] at LHCasterPoint facing LHCasterPoint


Set LHReject[LHIndex[1]] = (Last created unit)


Unit - Add a LHTimer[LHIndex[1]] second Generic expiration timer to LHReject[LHIndex[1]]


Unit Group - Add LHReject[LHIndex[1]] to LHRejectGroup[LHIndex[1]]


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


-------- This loop is just to had a bit of effect just don't do anything here --------


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


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



Loop - Actions




Unit - Create 1 Lightning Heart[Thunder] for LHPlayer[LHIndex[1]] at LHCasterPoint facing LHCasterPoint




Set LHThunder = (Last created unit)




Unit - Add a LHTimer[LHIndex[1]] second Generic expiration timer to LHThunder




Animation - Change LHThunder's size to (LHSize%, LHSize%, LHSize%) of its original size




Animation - Change LHThunder's animation speed to 7.00% of its original speed




Animation - Change LHThunder flying height to LHThunderFly at 0.00




Set LHThunderFly = (LHThunderFly + 25.00)




Set LHSize = (LHSize - 50.00)


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


-------- This Loop will make the lightning spire in the middle --------


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


For each (Integer B) from 1 to 10, do (Actions)



Loop - Actions




Unit - Create 1 Lightning Heart[Spire] for LHPlayer[LHIndex[1]] at LHCasterPoint facing LHCasterPoint




Set LHSpire = (Last created unit)




Unit - Add a LHTimer[LHIndex[1]] second Generic expiration timer to LHSpire




Animation - Change LHSpire's size to (300.00%, 300.00%, 300.00%) of its original size




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




-------- Those Two actions are there to make it look like a spire --------




-------- you can change the value after the "+" to make the spire taller or smaller --------




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




Animation - Change LHSpire flying height to LHSpireFly at 0.00




Set LHSpireFly = (LHSpireFly + 150.00)


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


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



Loop - Actions




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




-------- Those 4 position are the place of all spire will start just don't change --------




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




Set LHSpiralPointOne = (LHCasterPoint offset by 200.00 towards LHAngleOne degrees)




Set LHSpiralPointTwo = (LHCasterPoint offset by 200.00 towards LHAngleTwo degrees)




Set LHSpiralPointThree = (LHCasterPoint offset by 200.00 towards LHAngleThree degrees)




Set LHSpiralPointFour = (LHCasterPoint offset by 200.00 towards LHAngleFour degrees)




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




-------- If you noticed, the section below is sperate by line , every time I create a Lightning Heart[Spiral] I create a spiral --------




-------- Just don't change anything In --------




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




Unit - Create 1 Lightning Heart[Spiral] for LHPlayer[LHIndex[1]] at LHSpiralPointOne facing LHCasterPoint




Set LHSpiralOne = (Last created unit)




Unit - Add a LHTimer[LHIndex[1]] second Generic expiration timer to LHSpiralOne




Animation - Change LHSpiralOne flying height to LHFly at 0.00




Animation - Change LHSpiralOne's size to (200.00%, 200.00%, 200.00%) of its original size




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




Unit - Create 1 Lightning Heart[Spiral] for LHPlayer[LHIndex[1]] at LHSpiralPointTwo facing LHCasterPoint




Set LHSpiralTwo = (Last created unit)




Unit - Add a LHTimer[LHIndex[1]] second Generic expiration timer to LHSpiralTwo




Animation - Change LHSpiralTwo flying height to LHFly at 0.00




Animation - Change LHSpiralTwo's size to (200.00%, 200.00%, 200.00%) of its original size




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




Unit - Create 1 Lightning Heart[Spiral] for LHPlayer[LHIndex[1]] at LHSpiralPointThree facing LHCasterPoint




Set LHSpiralThree = (Last created unit)




Unit - Add a LHTimer[LHIndex[1]] second Generic expiration timer to LHSpiralThree




Animation - Change LHSpiralThree flying height to LHFly at 0.00




Animation - Change LHSpiralThree's size to (200.00%, 200.00%, 200.00%) of its original size




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




Unit - Create 1 Lightning Heart[Spiral] for LHPlayer[LHIndex[1]] at LHSpiralPointFour facing LHCasterPoint




Set LHSpiralFour = (Last created unit)




Unit - Add a LHTimer[LHIndex[1]] second Generic expiration timer to LHSpiralFour




Animation - Change LHSpiralFour flying height to LHFly at 0.00




Animation - Change LHSpiralFour's size to (200.00%, 200.00%, 200.00%) of its original size




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




-------- Those variables are require for the spiral --------




-------- You can change the value after the "+" to see what happen. --------




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




Set LHFly = (LHFly + 50.00)




Set LHAngleOne = (LHAngleOne + 10.00)




Set LHAngleTwo = (LHAngleTwo + 10.00)




Set LHAngleThree = (LHAngleThree + 10.00)




Set LHAngleFour = (LHAngleFour + 10.00)




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




-------- All actions below are there to remove leaks WHICH IS REALY IMPORTANT --------




-------- If you don't remove leaks you could get lags, random disconnections and some others unwanted things --------




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




Custom script: call RemoveLocation(udg_LHSpiralPointOne)




Custom script: call RemoveLocation(udg_LHSpiralPointTwo)




Custom script: call RemoveLocation(udg_LHSpiralPointThree)




Custom script: call RemoveLocation(udg_LHSpiralPointFour)


Custom script: call RemoveLocation(udg_LHCasterPoint)
Lightning Heart Periodic

Events


Time - Every 0.04 seconds of game time

Conditions

Actions


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


-------- It's important to make the actions in the periodic trigger into a loop whit a custom integer --------


-------- It's imporant because it will be MUI --------


-------- And It's imporant to put a custom integer because Integer A and B could make bug and we don't want that --------


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


For each (Integer LH) from 1 to LHIndex[1], do (Actions)



Loop - Actions




Unit Group - Pick every unit in LHCasterGroup[LH] and do (Actions)





Loop - Actions






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







If - Conditions








(LHCasterGroup[LH] is empty) Equal to False







Then - Actions








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








-------- There's a timer system to avoid a useless trigger --------








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








Set LHTimer[LH] = (LHTimer[LH] - 0.04)








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









If - Conditions










LHTimer[LH] Greater than or equal to 0.00









Then - Actions










Set LHCaster[LH] = (Picked unit)










Set LHRejectPoint[LH] = (Position of LHReject[LH])










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










-------- The "300.00" is the Area of Effect of the spell feel free to change that , but make it realist atleast. --------










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










Set LHDamageGroup[LH] = (Units within 300.00 of LHRejectPoint[LH])










Unit Group - Pick every unit in LHDamageGroup[LH] and do (Actions)











Loop - Actions












Set LHTarget = (Picked unit)












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












-------- Those conditions will filter some units but you can add or remove conditions to damage more specific unit --------












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












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













If - Conditions














(LHTarget is A structure) Equal to False














(LHTarget is Mechanical) Equal to False














(LHTarget is Magic Immune) Equal to False














(LHTarget is An Ancient) Equal to False














(LHTarget belongs to an enemy of LHPlayer[LH]) Equal to True













Then - Actions














Unit - Cause LHCaster[LH] to damage LHTarget, dealing LHDamage[LH] damage of attack type Spells and damage type Normal













Else - Actions









Else - Actions










Unit Group - Remove LHCaster[LH] from LHCasterGroup[LH]










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










-------- Those actions are the part of recycling index --------










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










Set LHIndex[2] = (LHIndex[2] - 1)










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











If - Conditions












LHIndex[2] Equal to 0











Then - Actions












Set LHIndex[1] = 0












Trigger - Turn off (This trigger)











Else - Actions








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








-------- Removing Leaks --------








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








Custom script: call RemoveLocation(udg_LHRejectPoint[udg_LH])








Custom script: call DestroyGroup(udg_LHDamageGroup[udg_LH])







Else - Actions