I am think one of these two triggers are leaking, as the map starts to lag alot after I use the ability alot.
Code:
MultiShot
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Ranger 1 2 Multi Shot
Actions
Set PhysPoint1 = (Position of (Casting unit))
Set PhysPoint2 = (Target point of ability being cast)
Set ShotAngle = (Angle from PhysPoint1 to PhysPoint2)
Set MaxAngle = ((Distance between PhysPoint1 and PhysPoint2) / 15.00)
Set MaxAngle = (90.00 - MaxAngle)
Unit - Create 1 Multi Shot for (Owner of (Casting unit)) at PhysPoint1 facing PhysPoint2
Unit Group - Add (Last created unit) to MarksMissileGroup
Unit - Add a (0.75 + 0.00) second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_PhysPoint2)
For each (Integer A) from 1 to MaxShot, do (Actions)
Loop - Actions
Set PhysPoint2 = (PhysPoint1 offset by 600.00 towards (((MaxAngle x (1.00 x (Real((Integer A))))) / (Real(MaxShot))) + ShotAngle) degrees)
Unit - Create 1 Multi Shot for (Owner of (Casting unit)) at PhysPoint1 facing PhysPoint2
Unit Group - Add (Last created unit) to MarksMissileGroup
Unit - Add a (1.25 + 0.00) second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_PhysPoint2)
For each (Integer A) from 1 to MaxShot, do (Actions)
Loop - Actions
Set PhysPoint2 = (PhysPoint1 offset by 600.00 towards (((MaxAngle x (-1.00 x (Real((Integer A))))) / (Real(MaxShot))) + ShotAngle) degrees)
Unit - Create 1 Multi Shot for (Owner of (Casting unit)) at PhysPoint1 facing PhysPoint2
Unit Group - Add (Last created unit) to MarksMissileGroup
Unit - Add a (1.25 + 0.00) second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_PhysPoint2)
Trigger - Turn on MoveRangerMissile <gen>
Custom script: call RemoveLocation(udg_PhysPoint1)
Code:
MoveRangerMissile
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in MarksMissileGroup and do (Actions)
Loop - Actions
Set PhysPoint1 = (Position of (Picked unit))
Set PhysPoint2 = (PhysPoint1 offset by 25.00 towards (Facing of (Picked unit)) degrees)
Unit - Move (Picked unit) instantly to PhysPoint2, facing (Facing of (Picked unit)) degrees
Set PlasmaPlayer = (Owner of (Picked unit))
Set RangerMissile = (Picked unit)
Set RangerMissileTargetGroup = (Units within 75.00 of PhysPoint2 matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)) and ((((Owner of (Matching unit)) is an enemy of PlasmaPlayer) Equal to True) and (((Matching unit) is alive) Equal
Unit Group - Pick every unit in RangerMissileTargetGroup and do (Actions)
Loop - Actions
Unit - Cause Heroes[(Player number of PlasmaPlayer)] to damage (Picked unit), dealing ((Real((Agility of Heroes[(Player number of PlasmaPlayer)] (Include bonuses)))) / 4.00) damage of attack type Spells and damage type Normal
Custom script: call DestroyGroup (udg_RangerMissileTargetGroup)
Custom script: call RemoveLocation(udg_PhysPoint1)
Custom script: call RemoveLocation(udg_PhysPoint2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in MarksMissileGroup) Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions