Moderator
M
Moderator
11:28, 31st Dec 2009
TriggerHappy:
The coding seemed fine but the effect was fairly boring.
TriggerHappy:
The coding seemed fine but the effect was fairly boring.
Events

Unit - A unit Starts the effect of an ability
Conditions

(Ability being cast) Equal to Mind Flay
Actions

Set MindFlay_Max = (MindFlay_Max + 1)

Set MindFlay_Caster[MindFlay_Max] = (Triggering unit)

Set MindFlay_Target[MindFlay_Max] = (Target unit of ability being cast)

Set loc = (Position of MindFlay_Caster[MindFlay_Max])

-------- If the length of the lightning is 0 it won't be shown --------

-------- This way we can prevent stupid flickering --------

Lightning - Create a Finger of Death lightning effect from source loc to target loc

Set MindFlay_Lightning[MindFlay_Max] = (Last created lightning effect)

-------- Set dmg here --------

Set MindFlay_Damage[MindFlay_Max] = ((Real((Level of (Ability being cast) for MindFlay_Caster[MindFlay_Max]))) x (Real((Intelligence of MindFlay_Caster[MindFlay_Max] (Include bonuses)))))

-------- The target will take dmg everytime the counter has reached the max value --------

Set MindFlay_Counter[MindFlay_Max] = 0.00

-------- The loop trigger is executed roughly 33 times a second so setting the max thing to 33 will make the caster deal dmg every second --------

Set MindFlay_Counter_Max[MindFlay_Max] = 33.00

-------- Turn on the trigger --------

Trigger - Turn on Mind Flay Loop <gen>

Trigger - Turn on Mind Flay Stop Casting <gen>

Custom script: call RemoveLocation( udg_loc )
Events

Time - Every 0.03 seconds of game time
Conditions
Actions

-------- Standard indexing --------

-------- See the tutorial section for this --------

-------- There are also some spell examples explaning this quite well --------

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


Loop - Actions



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




If - Conditions





(Current order of MindFlay_Caster[i]) Equal to (Order(channel))





MindFlay_Caster[i] Not equal to No unit





MindFlay_Target[i] Not equal to No unit





(Life of MindFlay_Caster[i]) Greater than 0.00





(Life of MindFlay_Target[i]) Greater than 0.00





(MindFlay_Target[i] is visible to (Owner of MindFlay_Caster[i])) Equal to True





(MindFlay_Target[i] is Magic Immune) Equal to False




Then - Actions





-------- If everything is alright the spell will be casted --------





Set MindFlay_Counter[i] = (MindFlay_Counter[i] + 1.00)





-------- If the counter is equal to some value we deal dmg --------





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






If - Conditions







MindFlay_Counter[i] Equal to MindFlay_Counter_Max[i]






Then - Actions







-------- Reset the counter --------







Set MindFlay_Counter[i] = 0.00







-------- And deal dmg --------







Unit - Cause MindFlay_Caster[i] to damage MindFlay_Target[i], dealing MindFlay_Damage[i] damage of attack type Spells and damage type Normal







-------- With a nice special effect of cause --------







Special Effect - Create a special effect attached to the origin of MindFlay_Target[i] using Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl







Special Effect - Destroy (Last created special effect)







-------- Show damage with floating text --------







Floating Text - Create floating text that reads (String((Integer(MindFlay_Damage[i])))) above MindFlay_Target[i] with Z offset 0.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency







Floating Text - Set the velocity of (Last created floating text) to 90.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 2.00 seconds







-------- And hide it for all players which should be unable to see it --------







Set playergroup = (All players matching ((MindFlay_Target[i] is visible to (Matching player)) Equal to False))







Floating Text - Hide (Last created floating text) for playergroup







Custom script: call DestroyForce( udg_playergroup )






Else - Actions





Set loc = (Position of MindFlay_Caster[i])





Set loc2 = (Position of MindFlay_Target[i])





-------- Here we get the units flying height, the height of the location it is at and add an extra 35 to max the lightning center the unit --------





-------- This won't work perfectly for flying units at the edge of cliffs or similar cause the shown flying height of units at the edge of cliffs is bugged --------





-------- Blame blizzard for this :P --------





-------- Works with units with storm crow form though --------





Custom script: set udg_r = GetLocationZ(udg_loc)+GetUnitFlyHeight(udg_MindFlay_Caster[udg_i])+35





Custom script: set udg_a = GetLocationZ(udg_loc2)+GetUnitFlyHeight(udg_MindFlay_Target[udg_i])+35





-------- This is like the GUI move lightning function except 2 things --------





-------- We can set its z-position and say if it shall be rendered in fog or not --------





-------- The "true" in it means it shall not be shown to players who can't see the units either --------





Custom script: call MoveLightningEx(udg_MindFlay_Lightning[udg_i],true,GetLocationX(udg_loc),GetLocationY(udg_loc),udg_r,GetLocationX(udg_loc2),GetLocationY(udg_loc2),udg_a)





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






If - Conditions







(Distance between loc and loc2) Greater than 1000.00






Then - Actions







-------- If the distance is to big we stop everything be removing the target --------







Set MindFlay_Target[i] = No unit






Else - Actions





Custom script: call RemoveLocation( udg_loc )





Custom script: call RemoveLocation( udg_loc2 )




Else - Actions





-------- Else we destroy everything and sort data --------





Lightning - Destroy MindFlay_Lightning[i]





Set MindFlay_Caster[i] = MindFlay_Caster[MindFlay_Max]





Set MindFlay_Target[i] = MindFlay_Target[MindFlay_Max]





Set MindFlay_Counter[i] = MindFlay_Counter[MindFlay_Max]





Set MindFlay_Counter_Max[i] = MindFlay_Counter_Max[MindFlay_Max]





Set MindFlay_Damage[i] = MindFlay_Damage[MindFlay_Max]





Set MindFlay_Lightning[i] = MindFlay_Lightning[MindFlay_Max]





Set MindFlay_Max = (MindFlay_Max - 1)





Set i = (i - 1)

-------- Turn of the trigger if nothing is to be calculated --------

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


If - Conditions



MindFlay_Max Less than 1


Then - Actions



Trigger - Turn off (This trigger)



Trigger - Turn off Mind Flay Stop Casting <gen>


Else - Actions
Events

Unit - A unit Is issued an order with no target

Unit - A unit Is issued an order targeting a point

Unit - A unit Is issued an order targeting an object
Conditions
Actions

-------- You may delete this trigger and all corresponding actions if you want the casters to be able to windwalk with items while channeling --------

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


Loop - Actions



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




If - Conditions





MindFlay_Caster[i] Equal to (Triggering unit)




Then - Actions





Set MindFlay_Caster[i] = No unit




Else - Actions