- Joined
- Feb 12, 2023
- Messages
- 11
Well so I have this trigger, some may know it. But once I want to test it, it puts me into game lobby
-
DrainLoop
-

Events
-


Time - Every 0.03 seconds of game time
-
-

Conditions
-

Actions
-


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


Custom script: if udg_zLoc == null then
-


Set zLoc = (Point(0.00, 0.00))
-


Custom script: endif
-


Set i2 = 0
-


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



Loop - Actions
-




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





If - Conditions
-






Drain_Caster[i] not Equal to No Unit
-






(Drain_Caster[i] is dead) Equal to False
-






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





Then - Actions
-






Set Drain_Interval[(i x 2)] = (Drain_Interval[(i x 2)] + 1)
-






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







If - Conditions
-








Drain_Interval[(i x 2)] Equal to Drain_Interval[((i x 2) + 1)]
-
-







Then - Actions
-








Set Drain_Interval[(i x 2)] = 0
-
-







Else - Actions
-
-






-------- Special effects --------
-






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







If - Conditions
-








(Random integer number between 1 and 2) Equal to 1
-
-







Then - Actions
-








Special Effect - Create a special effect attached to the overhead of Drain_Caster[i] using Abilities\Spells\Other\Parasite\ParasiteTarget.mdl
-








Special Effect - Destroy (Last created special effect)
-
-







Else - Actions
-
-






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






-------- Cause GetUnitX returns the x-position of the caster --------
-






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






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






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







Loop - Actions
-








-------- Set x and y location of the target --------
-








Custom script: set udg_x2 = GetUnitX( GetEnumUnit() )
-








Custom script: set udg_y2 = GetUnitY( GetEnumUnit() )
-








-------- Conditions: --------
-








-------- And within range (Pythagoras) --------
-








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









If - Conditions
-










(Picked unit) not Equal to No Unit
-










((Picked unit) is dead) Equal to False
-










((Picked unit) is Resistant to Magic) Equal to False
-










((Picked unit) is visible to (Owner of Drain_Caster[i])) Equal to True
-










Drain_Range[i] Greater than or Equal (((x - x2) x (x - x2)) + ((y - y2) x (y - y2)))
-
-









Then - Actions
-










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











If - Conditions
-












Drain_Interval[(i x 2)] Equal to 0
-
-











Then - Actions
-












-------- Damage --------
-












Unit - Cause Drain_Caster[i] to damage (Picked unit), dealing Drain_Value[i] damage of attack type Spell and damage type Normal
-












-------- Drain Life --------
-












Unit - Set life of Drain_Caster[i] to ((Life of Drain_Caster[i]) + Drain_Value[i])
-
-











Else - Actions
-
-










-------- Check if there is a lightning to use in the stack --------
-










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











If - Conditions
-












Drain_Life_Max Equal to i2
-
-











Then - Actions
-












-------- If this is not the case: Create one --------
-












Set loc = (Point(0.00, 0.00))
-












Lightning - Create a Life Drain lightning effect from source loc to target loc
-












Set Drain_Life_Lightning[i2] = (Last created lightning effect)
-












Set Drain_Life_Max = (Drain_Life_Max + 1)
-












Custom script: call RemoveLocation( udg_loc )
-
-











Else - Actions
-












-------- Since there is no "GetUnitZ" we have to move a location to the units position and use "GetLocationZ" instead --------
-












-------- Actually the same as "set zLoc = Point( x, y )" but without leak --------
-












Custom script: call MoveLocation( udg_zLoc, udg_x, udg_y)
-












-------- Of cause we need the flying height, too --------
-












-------- + 50 to move the lightning to the center of the unit instead of its feet --------
-












Custom script: set udg_z = GetUnitFlyHeight( udg_Drain_Caster[udg_i] ) + GetLocationZ( udg_zLoc ) + 50
-












Custom script: call MoveLocation( udg_zLoc, udg_x2, udg_y2)
-












-------- Move the lightning to the two x/y/z locations we got --------
-












-------- "true": check visiblity (do not show the lightning in fog for players who are unable to see the lightning) --------
-












Custom script: call MoveLightningEx( udg_Drain_Life_Lightning[udg_i2], true, udg_x, udg_y, udg_z, udg_x2, udg_y2, GetUnitFlyHeight( GetEnumUnit() ) + GetLocationZ( udg_zLoc ) + 35 )
-
-
-










Set i2 = (i2 + 1)
-
-









Else - Actions
-










-------- Remove unvalid unit from group --------
-










Unit Group - Remove (Picked unit) from Drain_Targets[i]
-
-
-
-
-






-------- Stop instance from running if there are no units left to drain off --------
-






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







If - Conditions
-








(Drain_Targets[i] is empty) Equal to True
-
-







Then - Actions
-








Unit - Order Drain_Caster[i] to Stop
-








Set Drain_Caster[i] = No Unit
-
-







Else - Actions
-
-
-





Else - Actions
-






-------- Shift data to optimize performance --------
-






Unit Group - Remove all units from Drain_Targets[i]
-






Unit Group - Add all units of Drain_Targets[Drain_Max] to Drain_Targets[i]
-






Unit Group - Remove all units from Drain_Targets[Drain_Max]
-






Set Drain_Caster[i] = Drain_Caster[Drain_Max]
-






Set Drain_Range[i] = Drain_Range[Drain_Max]
-






Set Drain_Value[i] = Drain_Value[Drain_Max]
-






Set Drain_Interval[(i x 2)] = Drain_Interval[(Drain_Max x 2)]
-






Set Drain_Interval[((i x 2) + 1)] = Drain_Interval[((Drain_Max x 2) + 1)]
-






Set Drain_Max = (Drain_Max - 1)
-






Set i = (i - 1)
-






-------- Turns of the trigger if there is nothing to do anymore --------
-






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







If - Conditions
-








Drain_Max Lesser 1
-
-







Then - Actions
-








Trigger - Turn off (This trigger)
-
-







Else - Actions
-
-
-
-
-
-


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



If - Conditions
-




i2 Lesser Drain_Life_Max
-
-



Then - Actions
-




-------- If there are too many lightnings the stack will be cleared --------
-




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





If - Conditions
-






Drain_Max Lesser 1
-






Drain_Life_Max Greater than 10
-
-





Then - Actions
-






-------- Destroys all lightnings to prevent lag --------
-






For each (Integer i) from 0 to (Drain_Life_Max - 1), do (Actions)
-







Loop - Actions
-








Lightning - Destroy Drain_Life_Lightning[i]
-
-
-






Set Drain_Life_Max = 0
-
-





Else -Actions
-






-------- Hides all unused lightnings --------
-






-------- (A lightning with a length of 0 will not be shown) --------
-






Set loc = (Point(0.00, 0.00))
-






For each (Integer i) from i2 to (Drain_Life_Max - 1), do (Actions)
-







Loop - Actions
-








Lightning - Move Drain_Life_Lightning[i] to source loc and target loc
-
-
-






Custom script: call RemoveLocation( udg_loc )
-
-
-
-



Else - Actions
-
-
-
-
-------- Since there is no "GetUnitZ" we have to move a location to the units position and use "GetLocationZ" instead --------
-

-------- Actually the same as "set zLoc = Point( x, y )" but without leak --------
-

Custom script: call MoveLocation( udg_zLoc, udg_x, udg_y)
-

-------- Of cause we need the flying height, too --------
-

-------- + 50 to move the lightning to the center of the unit instead of its feet --------
-

Custom script: set udg_z = GetUnitFlyHeight( udg_Drain_Caster[udg_i] ) + GetLocationZ( udg_zLoc ) + 50
-

Custom script: call MoveLocation( udg_zLoc, udg_x2, udg_y2)
-

-------- Move the lightning to the two x/y/z locations we got --------
-

-------- "true": check visiblity (do not show the lightning in fog for players who are unable to see the lightning) --------
-

Custom script: call MoveLightningEx( udg_Drain_Life_Lightning[udg_i2], true, udg_x, udg_y, udg_z, udg_x2, udg_y2, GetUnitFlyHeight( GetEnumUnit() ) + GetLocationZ( udg_zLoc ) + 35 )
-

