Hello. I have created a spell, in which the caster charges energy for up to 10 seconds and then releases a beam damaging units in a line. The spell itself works fine, but the map is very laggy all the time (also when not casting the spell). I believe I have removed all leaks, but I'd greatly appreciate it if someone could check my triggers in case of leaks. Here's the code, Solar Beam Effect is set initally off:
-
Solar Beam
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Solar Beam
-
Actions
- Set Damage = (800.00 + (Real((Level of Unknown (A03Q) for (Triggering unit)))))
- Set TempUnit = (Casting unit)
- Set TempPoint = (Target point of ability being cast)
- Set Counter = 0
- Set TempGroup2 = (Units in (Playable map area))
- Set TempGroup = (Random 0 units from TempGroup2)
- Set TempGroup3 = (Random 0 units from TempGroup2)
- Custom script: call DestroyGroup (udg_TempGroup2)
- Hashtable - Save Damage as 0 of (Key (Casting unit)) in SolarBeamTable
- Hashtable - Save Handle OfTempUnit as 1 of (Key (Casting unit)) in SolarBeamTable
- Hashtable - Save Counter as 2 of (Key (Casting unit)) in SolarBeamTable
- Hashtable - Save False as 3 of (Key (Casting unit)) in SolarBeamTable
- Hashtable - Save Handle OfTempPoint as 4 of (Key (Casting unit)) in SolarBeamTable
- Hashtable - Save Handle OfTempGroup as 5 of (Key (Casting unit)) in SolarBeamTable
- Hashtable - Save Handle OfTempGroup3 as 7 of (Key (Casting unit)) in SolarBeamTable
- Unit Group - Add TempUnit to SolarBeamGroup
- Trigger - Turn on Solar Beam Effect <gen>
-
Events
-
Solar Beam Stop
-
Events
- Unit - A unit Finishes casting an ability
- Unit - A unit Stops casting an ability
-
Conditions
- (Ability being cast) Equal to Solar Beam
-
Actions
- Hashtable - Save True as 3 of (Key (Casting unit)) in SolarBeamTable
-
Events
-
Solar Beam Effect
-
Events
- Time - Every 0.05 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in SolarBeamGroup and do (Actions)
-
Loop - Actions
- Set Damage = (Load 0 of (Key (Picked unit)) from SolarBeamTable)
- Set TempUnit = (Load 1 of (Key (Picked unit)) in SolarBeamTable)
- Set Counter = (Load 2 of (Key (Picked unit)) from SolarBeamTable)
- Set TempBool = (Load 3 of (Key (Picked unit)) from SolarBeamTable)
- Set TempPoint = (Load 4 of (Key (Picked unit)) in SolarBeamTable)
- Set TempPoint2 = (Position of TempUnit)
- Set TempGroup = (Load 5 of (Key (Picked unit)) in SolarBeamTable)
- Set TempGroup3 = (Load 7 of (Key (Picked unit)) in SolarBeamTable)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- TempBool Equal to False
- ((Real(Counter)) mod 0.15) Equal to 0.00
-
Then - Actions
- Set Damage = (Damage + ((Real((Intelligence of (Picked unit) (Include bonuses)))) x 0.10))
- Hashtable - Save Damage as 0 of (Key (Picked unit)) in SolarBeamTable
- Set TempPoint3 = (TempPoint2 offset by 500.00 towards (Random angle) degrees)
- Unit - Create 1 SolarBeamChargeDummy for (Owner of TempUnit) at TempPoint3 facing Default building facing degrees
- Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
- Unit Group - Add (Last created unit) to TempGroup
- Hashtable - Save Handle OfTempGroup as 5 of (Key (Picked unit)) in SolarBeamTable
- Custom script: call RemoveLocation (udg_TempPoint3)
- Else - Actions
-
If - Conditions
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Set TempPoint3 = (Position of (Picked unit))
- Set TempPoint4 = (TempPoint3 offset by 25.00 towards (Angle from TempPoint3 to TempPoint2) degrees)
- Unit - Move (Picked unit) instantly to TempPoint4
- Custom script: call RemoveLocation (udg_TempPoint3)
- Custom script: call RemoveLocation (udg_TempPoint4)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- TempBool Equal to True
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Counter Equal to 0
-
Then - Actions
- Set TempPoint3 = TempPoint2
-
Else - Actions
- Set TempPoint3 = (Load 6 of (Key (Picked unit)) in SolarBeamTable)
-
If - Conditions
- Set TempPoint4 = (TempPoint3 offset by 25.00 towards (Angle from TempPoint2 to TempPoint) degrees)
- Hashtable - Save Handle OfTempPoint4 as 6 of (Key (Picked unit)) in SolarBeamTable
- Unit - Create 1 SolarBeamDummy for (Owner of TempUnit) at TempPoint4 facing Default building facing degrees
- Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
- Set TempGroup2 = (Units within 100.00 of TempPoint3 matching (((Owner of (Matching unit)) is an ally of (Owner of TempUnit)) Equal to False))
- Unit Group - Pick every unit in TempGroup3 and do (Unit Group - Remove (Picked unit) from TempGroup2)
-
Unit Group - Pick every unit in TempGroup2 and do (Actions)
-
Loop - Actions
- Unit - Cause TempUnit to damage (Picked unit), dealing Damage damage of attack type Spells and damage type Magic
- Unit Group - Add (Picked unit) to TempGroup3
- Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
- Special Effect - Destroy (Last created special effect)
-
Loop - Actions
- Hashtable - Save Handle OfTempGroup3 as 7 of (Key (Picked unit)) in SolarBeamTable
- Custom script: call DestroyGroup (udg_TempGroup2)
- Custom script: call RemoveLocation (udg_TempPoint3)
- Set Counter = (Counter + 1)
- Hashtable - Save Counter as 2 of (Key (Picked unit)) in SolarBeamTable
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
- Custom script: call RemoveLocation (udg_TempPoint2)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Counter Equal to 50
-
Then - Actions
- Custom script: call RemoveLocation (udg_TempPoint4)
- Custom script: call DestroyGroup (udg_TempGroup)
- Custom script: call DestroyGroup (udg_TempGroup3)
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in SolarBeamTable
- Unit Group - Remove (Picked unit) from SolarBeamGroup
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in SolarBeamGroup) Equal to 0
-
Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
- Else - Actions
-
If - Conditions
-
Loop - Actions
-
Unit Group - Pick every unit in SolarBeamGroup and do (Actions)
-
Events