[trigger="Mind control cast"]
Mind control cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Mind control (channeling)
Actions
-------- -------------------------------- --------
-------- DOCUMENTATION --------
-------- -------------------------------- --------
-------- This checks if the spell is already running. If it does, it destroys the last one and creates a new one. --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Casting unit) is in MC_Group) Equal to True
Then - Actions
Special Effect - Destroy MC_AttachedEffect[(Custom value of (Casting unit))]
Floating Text - Destroy MC_TextTimer[(Custom value of (Casting unit))]
Lightning - Destroy MC_LightningChain[(Custom value of (Casting unit))]
Unit Group - Remove (Casting unit) from MC_Group
Unit - Change ownership of MC_Target[(Custom value of (Casting unit))] to MC_TargetPlayer[(Custom value of (Casting unit))] and Change color
Game - Display to (All players) the text: !
Set MC_TimeElapsed[(Custom value of (Casting unit))] = 0.00
Set MC_Integer[2] = (MC_Integer[2] - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MC_Integer[2] Equal to 0
Then - Actions
Set MC_Integer[1] = 0
Trigger - Turn off Mind control loop <gen>
Else - Actions
Else - Actions
-------- This add an Integer to the index system. --------
Set MC_Integer[1] = (MC_Integer[1] + 1)
-------- This sets the caster. --------
Set MC_Caster[MC_Integer[1]] = (Casting unit)
-------- This sets the controled unit. --------
Set MC_Target[MC_Integer[1]] = (Target unit of ability being cast)
-------- This sets level settings. --------
Set MC_Level[MC_Integer[1]] = (Level of (Ability being cast) for MC_Caster[MC_Integer[1]])
-------- verify if (or eventually and directly sets to) LEVEL 1 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MC_Level[MC_Integer[1]] Equal to 1
Then - Actions
-------- This sets the maximum time of how long the unit will be controled. (The target) --------
Set MC_Time[MC_Integer[1]] = 10.00
-------- This sets the maximum distance between the caster and the target. --------
Set MC_MaxDistance[MC_Integer[1]] = 1000.00
Else - Actions
-------- if not LEVEL 1, verify (and eventually sets to) LEVEL 2 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MC_Level[MC_Integer[1]] Equal to 2
Then - Actions
Set MC_Time[MC_Integer[1]] = 20.00
Set MC_MaxDistance[MC_Integer[1]] = 1100.00
Else - Actions
-------- if not LEVEL 2, verify (and eventually sets to) LEVEL 3 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MC_Level[MC_Integer[1]] Equal to 3
Then - Actions
Set MC_Time[MC_Integer[1]] = 30.00
Set MC_MaxDistance[MC_Integer[1]] = 1200.00
Else - Actions
-------- This sets the owner of the target. --------
Set MC_TargetPlayer[MC_Integer[1]] = (Owner of MC_Target[MC_Integer[1]])
-------- This sets the 2 points needed for the following actions. --------
Set MC_TempPoint1 = (Position of MC_Caster[MC_Integer[1]])
Set MC_TempPoint2 = (Position of MC_Target[MC_Integer[1]])
Set MC_TempPoint3 = (MC_TempPoint2 offset by 40.00 towards (Angle from MC_TempPoint1 to MC_TempPoint2) degrees)
-------- This creates the timer text. --------
Set MC_TimerInteger[MC_Integer[1]] = (Integer((MC_Time[MC_Integer[1]] - MC_TimeElapsed[MC_Integer[1]])))
Floating Text - Create floating text that reads (String(MC_TimerInteger[MC_Integer[1]])) at MC_TempPoint3 with Z offset 0.00, using font size 11.00, color (50.00%, 50.00%, 100.00%), and 0.00% transparency
Set MC_TextTimer[MC_Integer[1]] = (Last created floating text)
-------- This creates and set the lightning effect between the caster and the target. --------
Lightning - Create a Drain Mana lightning effect from source MC_TempPoint1 to target MC_TempPoint2
Set MC_LightningChain[MC_Integer[1]] = (Last created lightning effect)
-------- This creates and set the effect over the head of the target. --------
Special Effect - Create a special effect attached to the overhead of MC_Target[MC_Integer[1]] using Abilities\Spells\NightElf\shadowstrike\shadowstrike.mdl
Set MC_AttachedEffect[MC_Integer[1]] = (Last created special effect)
-------- This instantly change the owner of the target. --------
Unit - Change ownership of MC_Target[MC_Integer[1]] to (Owner of MC_Caster[MC_Integer[1]]) and Retain color
-------- This add the Caster to the group to verify that he is always channeling the spell. --------
Unit Group - Add MC_Caster[MC_Integer[1]] to MC_Group
-------- Set the custom value to the index Integer. --------
Unit - Set the custom value of MC_Caster[MC_Integer[1]] to MC_Integer[1]
-------- Removing the location created. --------
Custom script: call RemoveLocation(udg_MC_TempPoint1)
Custom script: call RemoveLocation(udg_MC_TempPoint2)
Custom script: call RemoveLocation(udg_MC_TempPoint3)
-------- This add one more Integer[2] to make the Integer[1] null and stop the loop integer when he is null. --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MC_Integer[2] Equal to 0
Then - Actions
Trigger - Turn on Mind control loop <gen>
Else - Actions
Set MC_Integer[2] = (MC_Integer[2] + 1)
[/trigger]