Moderator
M
Moderator
19:16, 12th Jul 2010
TriggerHappy:
Code is good enough.
TriggerHappy:
Code is good enough.
Magic Missile Cast

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Magic Missile

Actions


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



If - Conditions




MM_Index[1] Equal to 0



Then - Actions




Trigger - Turn on Magic Missile Loop <gen>



Else - Actions


-------- Index DATA --------


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


-------- Caster DATA --------


Set MM_Caster[MM_Index[2]] = (Casting unit)


Set MM_CasterLoc[MM_Index[2]] = (Position of (Casting unit))


-------- Target DATA --------


Set MM_AttackLoc[MM_Index[2]] = (Target point of ability being cast)


-------- Direction DATA --------


Set MM_Distance[MM_Index[2]] = (Distance between MM_CasterLoc[MM_Index[2]] and MM_AttackLoc[MM_Index[2]])


Set MM_Angle[MM_Index[2]] = (Angle from MM_CasterLoc[MM_Index[2]] to MM_AttackLoc[MM_Index[2]])


-------- Configurable DATA --------


Set MM_BallMaxDistance[MM_Index[2]] = (300.00 + (50.00 x (Real((Level of Magic Missile for (Triggering unit))))))


Set MM_HPSteal[MM_Index[2]] = (5.00 + (5.00 x (Real((Level of Magic Missile for (Triggering unit))))))


Set MM_Speed[MM_Index[2]] = (MM_Distance[MM_Index[2]] / (150.00 / 3.00))


Set MM_CurrentDistance[MM_Index[2]] = 50.00


Set MM_BallTurnSpeed[MM_Index[2]] = 10.00


Set MM_MaxHeight[MM_Index[2]] = 2000.00


Set MM_BallSpeed[MM_Index[2]] = 15.00


Set MM_BallAoE[MM_Index[2]] = 100.00


Set MM_BallNumber[MM_Index[2]] = 4


Set MM_BallBounce[MM_Index[2]] = 4


Set MM_Damage[MM_Index[2]] = 50


Set MM_Effect[1] = war3mapImported\AncientExplode.mdx


Set MM_Effect[2] = Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmDamage.mdl


-------- Reset DATA --------


Set MM_BallDirection[MM_Index[2]] = True


Set MM_Finish[MM_Index[2]] = False


Set MM_Booleen[MM_Index[2]] = False


-------- ! Starting ! --------


Set MM_MoveLoc[MM_Index[2]] = (MM_CasterLoc[MM_Index[2]] offset by MM_CurrentDistance[MM_Index[2]] towards MM_Angle[MM_Index[2]] degrees)


Unit - Create 1 Magic Missile DUMMY 1 for (Owner of (Casting unit)) at MM_MoveLoc[MM_Index[2]] facing Default building facing degrees


Set MM_Dummy[MM_Index[2]] = (Last created unit)


Custom script: call RemoveLocation( udg_MM_MoveLoc[ udg_MM_Index[ 2 ] ] )
Magic Missile Loop

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


Set MM_Index[1] = 0


For each (Integer MM_Index[3]) from 1 to MM_Index[2], do (Actions)



Loop - Actions




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





If - Conditions






MM_Booleen[MM_Index[3]] Equal to False





Then - Actions






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






Set MM_CurrentDistance[MM_Index[3]] = (MM_CurrentDistance[MM_Index[3]] + MM_Speed[MM_Index[3]])






Set MM_Height[MM_Index[3]] = (((MM_MaxHeight[MM_Index[3]] / MM_Distance[MM_Index[3]]) x (MM_Distance[MM_Index[3]] - MM_CurrentDistance[MM_Index[3]])) x (MM_CurrentDistance[MM_Index[3]] / MM_Distance[MM_Index[3]]))






Set MM_MoveLoc[MM_Index[3]] = (MM_CasterLoc[MM_Index[3]] offset by MM_CurrentDistance[MM_Index[3]] towards MM_Angle[MM_Index[3]] degrees)






Animation - Change MM_Dummy[MM_Index[3]] flying height to MM_Height[MM_Index[3]] at 500000000.00






Unit - Move MM_Dummy[MM_Index[3]] instantly to MM_MoveLoc[MM_Index[3]], facing MM_AttackLoc[MM_Index[3]]






Custom script: call RemoveLocation( udg_MM_MoveLoc[ udg_MM_Index[ 3 ] ] )






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







If - Conditions








MM_CurrentDistance[MM_Index[3]] Greater than or equal to MM_Distance[MM_Index[3]]







Then - Actions








Set MM_Booleen[MM_Index[3]] = True








Set MM_Angle[MM_Index[3]] = 0.00








Set MM_CurrentDistance[MM_Index[3]] = 0.00








For each (Integer A) from 1 to MM_BallNumber[MM_Index[3]], do (Actions)









Loop - Actions










Set MM_MoveLoc[MM_Index[3]] = (MM_AttackLoc[MM_Index[3]] offset by MM_CurrentDistance[MM_Index[3]] towards ((360.00 / (Real(MM_BallNumber[MM_Index[3]]))) x (Real((Integer A)))) degrees)










Unit - Create 1 Magic Missile DUMMY 2 for (Owner of MM_Caster[MM_Index[3]]) at MM_MoveLoc[MM_Index[3]] facing ((360.00 / (Real(MM_BallNumber[MM_Index[3]]))) x (Real((Integer A)))) degrees










Set MM_BallDummy[((MM_Index[3] x MM_BallNumber[MM_Index[3]]) + (Integer A))] = (Last created unit)










Custom script: call RemoveLocation( udg_MM_MoveLoc[ udg_MM_Index[ 3 ] ] )








Unit - Kill MM_Dummy[MM_Index[3]]








Special Effect - Create a special effect at MM_AttackLoc[MM_Index[3]] using MM_Effect[1]








Special Effect - Destroy (Last created special effect)







Else - Actions





Else - Actions






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






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







If - Conditions








MM_BallBounce[MM_Index[3]] Greater than 0







Then - Actions








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









If - Conditions










MM_BallDirection[MM_Index[3]] Equal to True









Then - Actions










Set MM_CurrentDistance[MM_Index[3]] = (MM_CurrentDistance[MM_Index[3]] + MM_BallSpeed[MM_Index[3]])









Else - Actions










Set MM_CurrentDistance[MM_Index[3]] = (MM_CurrentDistance[MM_Index[3]] - MM_BallSpeed[MM_Index[3]])








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









If - Conditions










MM_CurrentDistance[MM_Index[3]] Greater than or equal to MM_BallMaxDistance[MM_Index[3]]









Then - Actions










Set MM_BallDirection[MM_Index[3]] = False









Else - Actions








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









If - Conditions










MM_CurrentDistance[MM_Index[3]] Less than or equal to 0.00









Then - Actions










Set MM_BallDirection[MM_Index[3]] = True










Set MM_BallBounce[MM_Index[3]] = (MM_BallBounce[MM_Index[3]] - 1)









Else - Actions








Set MM_Angle[MM_Index[3]] = (MM_Angle[MM_Index[3]] + MM_BallTurnSpeed[MM_Index[3]])








For each (Integer A) from 1 to MM_BallNumber[MM_Index[3]], do (Actions)









Loop - Actions










Set MM_MoveLoc[MM_Index[3]] = (MM_AttackLoc[MM_Index[3]] offset by MM_CurrentDistance[MM_Index[3]] towards (((360.00 / (Real(MM_BallNumber[MM_Index[3]]))) x (Real((Integer A)))) + MM_Angle[MM_Index[3]]) degrees)










Unit - Move MM_BallDummy[((MM_Index[3] x MM_BallNumber[MM_Index[3]]) + (Integer A))] instantly to MM_MoveLoc[MM_Index[3]]










Set MM_TempDamageGroup = (Units within MM_BallAoE[MM_Index[3]] of MM_MoveLoc[MM_Index[3]])










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











Loop - Actions












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













If - Conditions














((Picked unit) belongs to an enemy of (Owner of MM_Caster[MM_Index[3]])) Equal to True













Then - Actions














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















If - Conditions
















((Picked unit) is alive) Equal to True















Then - Actions
















Set MM_BallHPSteal[((MM_Index[3] x MM_BallNumber[MM_Index[3]]) + (Integer A))] = (MM_BallHPSteal[((MM_Index[3] x MM_BallNumber[MM_Index[3]]) + (Integer A))] + MM_HPSteal[MM_Index[3]])
















Unit - Cause MM_Caster[MM_Index[3]] to damage (Picked unit), dealing MM_HPSteal[MM_Index[3]] damage of attack type Chaos and damage type Demolition
















Special Effect - Create a special effect attached to the origine of (Picked unit) using MM_Effect[2]
















Special Effect - Destroy (Last created special effect)















Else - Actions













Else - Actions










Destructible - Pick every destructible within MM_BallAoE[MM_Index[3]] of MM_MoveLoc[MM_Index[3]] and do (Actions)











Loop - Actions












Destructible - Kill (Picked destructible)










Custom script: call RemoveLocation( udg_MM_MoveLoc[ udg_MM_Index[ 2 ] ] )








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









If - Conditions










MM_BallBounce[MM_Index[3]] Equal to 0









Then - Actions










Set MM_CurrentDistance[MM_Index[3]] = 0.00










Set MM_Angle[MM_Index[3]] = (Angle from MM_AttackLoc[MM_Index[3]] to MM_CasterLoc[MM_Index[3]])










Set MM_MoveLoc[MM_Index[3]] = (MM_AttackLoc[MM_Index[3]] offset by MM_CurrentDistance[MM_Index[3]] towards MM_Angle[MM_Index[3]] degrees)










Unit - Create 1 Magic Missile DUMMY 1 for (Owner of MM_Dummy[MM_Index[3]]) at MM_MoveLoc[MM_Index[3]] facing Default building facing degrees










Set MM_Dummy[MM_Index[3]] = (Last created unit)










For each (Integer A) from 1 to MM_BallNumber[MM_Index[3]], do (Actions)











Loop - Actions












Unit - Kill MM_BallDummy[((MM_Index[3] x MM_BallNumber[MM_Index[3]]) + (Integer A))]










Custom script: call RemoveLocation( udg_MM_MoveLoc[ udg_MM_Index[ 3 ] ] )










Custom script: call RemoveLocation( udg_MM_CasterLoc[ udg_MM_Index[ 3 ] ] )









Else - Actions







Else - Actions








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









If - Conditions










MM_CurrentDistance[MM_Index[3]] Less than or equal to MM_Distance[MM_Index[3]]









Then - Actions










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










Set MM_CasterLoc[MM_Index[3]] = (Position of MM_Caster[MM_Index[3]])










Set MM_Angle[MM_Index[3]] = (Angle from MM_AttackLoc[MM_Index[3]] to MM_CasterLoc[MM_Index[3]])










Set MM_Distance[MM_Index[3]] = (Distance between MM_AttackLoc[MM_Index[3]] and MM_CasterLoc[MM_Index[3]])










Set MM_CurrentDistance[MM_Index[3]] = (MM_CurrentDistance[MM_Index[3]] + MM_Speed[MM_Index[3]])










Set MM_Speed[MM_Index[3]] = (MM_Distance[MM_Index[3]] / (150.00 / 3.00))










Set MM_Height[MM_Index[3]] = (((MM_MaxHeight[MM_Index[3]] / MM_Distance[MM_Index[3]]) x (MM_Distance[MM_Index[3]] - MM_CurrentDistance[MM_Index[3]])) x (MM_CurrentDistance[MM_Index[3]] / MM_Distance[MM_Index[3]]))










Set MM_MoveLoc[MM_Index[3]] = (MM_AttackLoc[MM_Index[3]] offset by MM_CurrentDistance[MM_Index[3]] towards MM_Angle[MM_Index[3]] degrees)










Animation - Change MM_Dummy[MM_Index[3]] flying height to MM_Height[MM_Index[3]] at 500000000.00










Unit - Move MM_Dummy[MM_Index[3]] instantly to MM_MoveLoc[MM_Index[3]], facing MM_CasterLoc[MM_Index[3]]










Custom script: call RemoveLocation( udg_MM_MoveLoc[ udg_MM_Index[ 3 ] ] )










Custom script: call RemoveLocation( udg_MM_CasterLoc[ udg_MM_Index[ 3 ] ] )









Else - Actions










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











If - Conditions












MM_Finish[MM_Index[3]] Equal to False











Then - Actions












Set MM_CasterLoc[MM_Index[3]] = (Position of MM_Caster[MM_Index[3]])












Set MM_Finish[MM_Index[3]] = True












Set MM_HPSteal[MM_Index[3]] = 0.00












For each (Integer A) from 1 to MM_BallNumber[MM_Index[3]], do (Actions)













Loop - Actions














Unit - Set life of MM_Caster[MM_Index[3]] to ((Life of MM_Caster[MM_Index[3]]) + MM_BallHPSteal[((MM_Index[3] x MM_BallNumber[MM_Index[3]]) + (Integer A))])














Set MM_HPSteal[MM_Index[3]] = (MM_HPSteal[MM_Index[3]] + MM_BallHPSteal[((MM_Index[3] x MM_BallNumber[MM_Index[3]]) + (Integer A))])












Unit - Kill MM_Dummy[MM_Index[3]]












Special Effect - Create a special effect at MM_CasterLoc[MM_Index[3]] using MM_Effect[1]












Special Effect - Destroy (Last created special effect)












Floating Text - Create floating text that reads (String(MM_HPSteal[MM_Index[3]])) above MM_Caster[MM_Index[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.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 color of (Last created floating text) to (25.00%, 25.00%, 100.00%) with 0.00% transparency












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












Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds












Custom script: call RemoveLocation( udg_MM_AttackLoc[ udg_MM_Index[ 3 ] ] )












Custom script: call DestroyGroup( udg_MM_TempDamageGroup )











Else - Actions


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



If - Conditions




MM_Index[1] Equal to 0



Then - Actions




Trigger - Turn off (This trigger)




Set MM_Index[2] = 0



Else - Actions
| Change Log | Current Version : V.1.0.0.c |
| Version | Change |
| V.1.0.0.a | - Initiale Release |
| V.1.0.0.b | - Remove Integer A - Add Documentation To Magic Missile Cast - Add Documentation How To Import? |
| V.1.0.0.c | - Fixed Some Gramatical Error (My english su**) |