- Joined
- Sep 9, 2010
- Messages
- 72
I have a problem with a triggered spell, when I use the spell for about 5-6 times it creates lag. I think the problem is the leaks but I'm not good at clearing Leaks even though I read all the tutorials I found.
Triggers:
Can someone take a look and give me some advice please? (or the leak-less versions)
I attached a map with this spell only and it does not lag, I suppose that it lags only on bigger maps.
Triggers:
-
Start Ray
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Ray
-
Actions
- Wait 0.10 seconds
- Unit - Order (Casting unit) to Hold Position
- Animation - Play (Casting unit)'s attack animation
- Player - Disable Ray for (Owner of (Casting unit))
- Unit - Add Cancel to (Casting unit)
- Player Group - Add (Owner of (Casting unit)) to Ray_Casters
- Set Ray_Damage[(Player number of (Owner of (Casting unit)))] = 0.00
- Set Ray_Distance[(Player number of (Owner of (Casting unit)))] = 0.00
- Set Ray_Caster[(Player number of (Owner of (Casting unit)))] = (Casting unit)
- Set Ray_Angle[(Player number of (Owner of (Casting unit)))] = (Facing of (Casting unit))
- Set Ray_Point[(Player number of (Owner of (Casting unit)))] = ((Position of (Casting unit)) offset by 50.00 towards Ray_Angle[(Player number of (Owner of (Casting unit)))] degrees)
- Set Ray_Timer[(Player number of (Owner of (Casting unit)))] = 0.00
- Trigger - Turn on Channel Ray <gen>
-
Events
-
Channel Ray
-
Events
- Time - Every 0.05 seconds of game time
- Conditions
-
Actions
-
Player Group - Pick every player in Ray_Casters and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Ray_Timer[(Player number of (Picked player))] Greater than or equal to 1.95
-
Then - Actions
- Set Ray_Timer[(Player number of (Owner of (Casting unit)))] = 0.00
- Player - Enable Ray for (Picked player)
- Unit - Remove Cancel from Ray_Caster[(Player number of (Picked player))]
- Trigger - Turn on Effect Ray <gen>
- Trigger - Turn off (This trigger)
-
Else - Actions
- Set Ray_Timer[(Player number of (Picked player))] = (Ray_Timer[(Player number of (Picked player))] + 0.05)
- Set Ray_Damage[(Player number of (Picked player))] = (Ray_Damage[(Player number of (Picked player))] + (500.00 x 0.05))
- Set Ray_Distance[(Player number of (Picked player))] = (Ray_Distance[(Player number of (Picked player))] + (750.00 x 0.05))
- Unit - Create 1 Ray for (Picked player) at Ray_Point[(Player number of (Picked player))] facing Default building facing degrees
- Unit - Add a (((Ray_Distance[(Player number of (Picked player))] / 100.00) x 0.08) + 0.10) second Generic expiration timer to (Last created unit)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Player Group - Pick every player in Ray_Casters and do (Actions)
-
Events
-
Effect Ray
-
Events
- Time - Every 0.04 seconds of game time
- Conditions
-
Actions
-
Player Group - Pick every player in Ray_Casters and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Distance between (Position of Ray_Caster[(Player number of (Picked player))]) and Ray_Point[(Player number of (Picked player))]) Greater than or equal to Ray_Distance[(Player number of (Picked player))]
-
Then - Actions
- Player Group - Remove (Picked player) from Ray_Casters
- Unit Group - Remove all units from Ray_Victims[(Player number of (Picked player))]
- Custom script: call RemoveLocation (udg_Ray_Point[GetConvertedPlayerId(GetEnumPlayer())])
- Trigger - Turn off (This trigger)
-
Else - Actions
- Set Ray_Point[(Player number of (Picked player))] = (Ray_Point[(Player number of (Picked player))] offset by 50.00 towards Ray_Angle[(Player number of (Picked player))] degrees)
- Unit - Create 1 Ray for (Picked player) at Ray_Point[(Player number of (Picked player))] facing Default building facing degrees
- Unit - Add a (((Ray_Distance[(Player number of (Picked player))] / 100.00) x 0.08) + 0.10) second Generic expiration timer to (Last created unit)
-
Unit Group - Pick every unit in (Units within 150.00 of Ray_Point[(Player number of (Picked player))]) and do (Actions)
-
Loop - Actions
-
Player Group - Pick every player in (All allies of (Owner of Ray_Caster[(Player number of (Picked player))])) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Owner of (Picked unit)) Not equal to (Picked player)
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
-
Player Group - Pick every player in Ray_Casters and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Owner of (Picked unit)) Not equal to (Owner of Ray_Caster[(Player number of (Picked player))])
- ((Picked unit) is in Ray_Victims[(Player number of (Picked player))]) Equal to False
-
Then - Actions
- Unit - Cause Ray_Caster[(Player number of (Picked player))] to damage (Picked unit), dealing Ray_Damage[(Player number of (Picked player))] damage of attack type Spells and damage type Normal
- Unit Group - Add (Picked unit) to Ray_Victims[(Player number of (Picked player))]
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Player Group - Pick every player in Ray_Casters and do (Actions)
-
Else - Actions
- Do nothing
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Player Group - Pick every player in (All allies of (Owner of Ray_Caster[(Player number of (Picked player))])) and do (Actions)
-
Loop - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Player Group - Pick every player in Ray_Casters and do (Actions)
-
Events
I attached a map with this spell only and it does not lag, I suppose that it lags only on bigger maps.
Attachments
Last edited by a moderator: