Major Lag, Leaks?

THE_X

New Member
Reaction score
49
So when i enable these 5 triggers, the game starts to lag bad, i don't know if its a leak i don't see any but i know its these 4 triggers.

Code:
Create Ball
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Demon Ball 
    Actions
        Set Point[1] = (Position of (Triggering unit))
        Set Point[2] = (Target point of ability being cast)
        Set Point[3] = (Point[1] offset by 60.00 towards (Angle from Point[1] to Point[2]) degrees)
        Set MUI = (MUI + 1)
        Unit - Create 1 Demon Ball Dummy for (Owner of (Triggering unit)) at Point[3] facing Point[2]
        Unit - Set the custom value of (Last created unit) to MUI
        Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
        Set Ball_Timer[(Custom value of (Last created unit))] = 10.00
        Set Ball_Caster[(Custom value of (Last created unit))] = (Triggering unit)
        Custom script:   call RemoveLocation (udg_Point[1])
        Custom script:   call RemoveLocation (udg_Point[2])
        Custom script:   call RemoveLocation (udg_Point[3])

Code:
Slide Ball
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Set Group[1] = (Units of type Demon Ball Dummy)
        Unit Group - Pick every unit in Group[1] and do (Actions)
            Loop - Actions
                Set Unit[1] = (Picked unit)
                Set Point[1] = (Position of (Picked unit))
                Custom script:   set udg_Ball_Height[1] = GetLocationZ(udg_Point[1])
                Set Point[2] = (Point[1] offset by 18.00 towards (Facing of (Picked unit)) degrees)
                Custom script:   set udg_Ball_Height[2] = GetLocationZ(udg_Point[2])
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Ball_Height[2] Greater than or equal to (Ball_Height[1] + 3.50)
                    Then - Actions
                        Unit - Create 1 Demon Ball Dummy for (Owner of (Picked unit)) at Point[1] facing ((Facing of (Picked unit)) x 2.00) degrees
                        Unit - Add a Ball_Timer[(Custom value of (Picked unit))] second Generic expiration timer to (Last created unit)
                        Unit - Set the custom value of (Last created unit) to (Custom value of (Picked unit))
                        Unit - Remove (Picked unit) from the game
                        Special Effect - Create a special effect at Point[1] using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
                        Special Effect - Destroy (Last created special effect)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Ball_Timer[(Custom value of (Last created unit))] Less than or equal to 0.00
                            Then - Actions
                                Unit - Remove (Last created unit) from the game
                            Else - Actions
                    Else - Actions
                        Unit - Move (Picked unit) instantly to Point[2]
                        Destructible - Pick every destructible within 80.00 of Point[2] and do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Picked destructible) is alive) Equal to True
                                        Or - Any (Conditions) are true
                                            Conditions
                                                (Destructible-type of (Picked destructible)) Equal to Summer Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Ashenvale Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Ashenvale Canopy Tree
                                                (Destructible-type of (Picked destructible)) Equal to Barrens Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Barrens Canopy Tree
                                                (Destructible-type of (Picked destructible)) Equal to Black Citadel Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Cityscape Fall Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Cityscape Snowy Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Cityscape Summer Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Cityscape Winter Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Cityscape Ruined Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Dalaran Ruins Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Dungeon Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Felwood Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Felwood Canopy Tree
                                                (Destructible-type of (Picked destructible)) Equal to Icecrown Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Icecrown Canopy Tree
                                                (Destructible-type of (Picked destructible)) Equal to Northrend Canopy Tree
                                                (Destructible-type of (Picked destructible)) Equal to Fall Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Northrend Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Snowy Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Outland Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Ruins Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Ruins Canopy Tree
                                                (Destructible-type of (Picked destructible)) Equal to Underground Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Village Tree Wall
                                                (Destructible-type of (Picked destructible)) Equal to Village Tree Wall
                                    Then - Actions
                                        Set Point[3] = (Position of (Picked destructible))
                                        Unit - Create 1 Demon Ball Dummy for (Owner of (Picked unit)) at Point[1] facing ((Facing of (Picked unit)) x 2.00) degrees
                                        Unit - Add a Ball_Timer[(Custom value of (Picked unit))] second Generic expiration timer to (Last created unit)
                                        Unit - Set the custom value of (Last created unit) to (Custom value of Unit[1])
                                        Unit - Remove Unit[1] from the game
                                        Special Effect - Create a special effect at Point[1] using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
                                        Special Effect - Destroy (Last created special effect)
                                        Custom script:   call RemoveLocation (udg_Point[3])
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                Ball_Timer[(Custom value of (Last created unit))] Less than or equal to 0.00
                                            Then - Actions
                                                Unit - Remove (Last created unit) from the game
                                            Else - Actions
                                        Destructible - Kill (Picked destructible)
                                    Else - Actions
                        Set Group[2] = (Units within 50.00 of Point[2] matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) is A ground unit) Equal to True)))
                        Unit Group - Pick every unit in Group[2] and do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Unit-type of (Picked unit)) Not equal to Demon Ball Dummy
                                    Then - Actions
                                        Set Point[3] = (Position of (Picked unit))
                                        Unit - Create 1 Demon Ball Dummy for (Owner of Unit[1]) at Point[1] facing ((Facing of (Picked unit)) x 2.00) degrees
                                        Unit - Add a Ball_Timer[(Custom value of Unit[1])] second Generic expiration timer to (Last created unit)
                                        Unit - Set the custom value of (Last created unit) to (Custom value of Unit[1])
                                        Unit - Remove Unit[1] from the game
                                        Special Effect - Create a special effect at Point[1] using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
                                        Special Effect - Destroy (Last created special effect)
                                        Custom script:   call RemoveLocation (udg_Point[3])
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                Ball_Timer[(Custom value of (Last created unit))] Less than or equal to 0.00
                                            Then - Actions
                                                Unit - Remove (Last created unit) from the game
                                            Else - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                ((Picked unit) belongs to an enemy of (Owner of Unit[1])) Equal to True
                                            Then - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        (Custom value of (Picked unit)) Less than 1
                                                    Then - Actions
                                                        Set MUI = (MUI + 1)
                                                        Unit - Set the custom value of (Picked unit) to MUI
                                                    Else - Actions
                                                Set Slide_Angle[(Custom value of (Picked unit))] = (Angle from Point[3] to Point[2])
                                                Unit - Create 1 Dummy for (Owner of Unit[1]) at Point[2] facing Default building facing degrees
                                                Unit - Add Bouncy Ball Pushback  to (Last created unit)
                                                Unit - Set level of Bouncy Ball Pushback  for (Last created unit) to (Level of Demon Ball  for Ball_Caster[(Custom value of Unit[1])])
                                                Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
                                                Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                                                Unit - Create 1 Attacking Dummy for (Owner of Unit[1]) at Point[2] facing Default building facing degrees
                                                Unit - Add Demon Ball Posion  to (Last created unit)
                                                Unit - Order (Last created unit) to Attack (Picked unit)
                                                Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                                            Else - Actions
                                    Else - Actions
                        Custom script:   call RemoveLocation (udg_Point[2])
                        Custom script:   call RemoveLocation (udg_Point[1])
                        Custom script:   call DestroyGroup (udg_Group[2])
                        Set Unit[1] = No unit
        Custom script:   call DestroyGroup (udg_Group[1])

Code:
Slide Ball Target
    Events
        Time - Every 0.04 seconds of game time
    Conditions
    Actions
        Set Group[1] = (Units in (Entire map) matching (((Matching unit) has buff Demon Ball [Slide] ) Equal to True))
        Unit Group - Pick every unit in Group[1] and do (Actions)
            Loop - Actions
                Set Point[1] = (Position of (Picked unit))
                Set Point[2] = (Point[1] offset by 10.00 towards Slide_Angle[(Custom value of (Picked unit))] degrees)
                Unit - Move (Picked unit) instantly to Point[2]
                Special Effect - Create a special effect at Point[2] using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
                Special Effect - Destroy (Last created special effect)
        Custom script:   call DestroyGroup (udg_Group[1])
        Custom script:   call RemoveLocation (udg_Point[1])
        Custom script:   call RemoveLocation (udg_Point[2])
Code:
Ball Timer
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Set Group[1] = (Units of type Demon Ball Dummy)
        Unit Group - Pick every unit in Group[1] and do (Actions)
            Loop - Actions
                Set Ball_Timer[(Custom value of (Picked unit))] = (Ball_Timer[(Custom value of (Picked unit))] - 0.01)
        Custom script:   call DestroyGroup (udg_Group[1])

Code:
Remove Balll
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Demon Ball Dummy
    Actions
        Unit - Remove (Triggering unit) from the game
 

Draphoelix

It's not the wintercold that's killing me
Reaction score
132
Haven't looked in entire trigger.

But you keep picking in Group[1] which may cause lag if it's many units in it and it runs every 0.01 second on one trigger..
 

THE_X

New Member
Reaction score
49
that trigger does nothing but set a number so i should not lag, and also i know that does not leaks at all
 

THE_X

New Member
Reaction score
49
well you would think that but its not :( iv put it in a diffrent map and its just fine, all it is, is a sliding trigger, and creates a new unit if it comes into contact with a wall,tree or unit
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
using Group[1] for multiple triggers is a bad idea - especially in such a short use of action.
try changing ur index so the triggers won't collide each other and it should work (i think)
 

THE_X

New Member
Reaction score
49
well that cant be it because in the triggers the groups have no units in them whatsoever, there are no units with the buff when get game starts and there are no units of the type when the game starts, it just laggs right off the bat
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
could u try a sec make different groups and see for urself?
im pretty sure that's ur problem
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
k that's gonna be pretty hard to find the right one so could u try disabling them all and enabling them one by one when u get a lag from a certain trigger disable it and keep onthe rest of triggers then in the end tell me which triggers caused u lags while enabled
 

Kazuga

Let the game begin...
Reaction score
110
When does it start lag? Immediately? After a while? If it's within 10 min and you don't let any 0.03 event triggers create 1 leak each time it shouldn't be leaks.

I have encountered this before, a trigger lags when it shouldn't since it really does nothing that should create lag. Best thing you could try is to convert it/rewrite it in Jass/vJass.
 

THE_X

New Member
Reaction score
49
yea i did that, and the more i disabled the better the lag got, but still theres a lag, :( its every single one doing it, but there not leaking grr, it works just fine in my other maps, i dont know why it wont work in this one
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
can u try increasing those timers to 1,3 and 4 seconds instead of the current?
 

THE_X

New Member
Reaction score
49
yea lol i set them to every 4 seconds, and that helped like very, very little
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
few Notes:
*what's the point of making expiration timer if u remove them after 0.03 second?

*also Ball_Timer is kind of a constant variable and seem useless i suggest to get rid of it and just put a 10.00

*again i say there is no point removing the unit with Ball_Timer when u already got expiration timer and also timer cannot go below 0

*your points are probably leaking since u lose their values during other triggers interference try using a different variables for each trigger saving numbers there won't help u much

*setting Unit[1] to picked unit is not helping and useless (units don't leak)

*also just now i noticed that u actually made a manual Timer with real type variable and no offence but it's kinda stupid (why make a timer manually when u there is already one made for that purpose?) and also the fact that expiration timer has a timer of it's own running.

*why removing ball after it dies? u don't want it to decay mabye? anyway i think it should stack with expiration timer.
noted done pretty much - try fixing what u need and see how it goes
 

vypur85

Hibernate
Reaction score
803
Not sure what are you trying to do with the trigger here but creating a lot of units concentrated in one point will cause very terrible lag. Also, as mentioned in the past, a loop in another loop will cause lag depending on how big the loop is. Imagine if the Z value is low, then a lot of units will be created depending on the destructible number or unit number around the dummy. Try giving the dummy units food cost of 1 and see how many units are create per cast. If the number is high, then the lag is caused by units number.

Also, try as best to play around with conditions efficiently. Don't create something and then decide later whether the unit is needed or not. You should decide whether the unit is needed or not, then only create the units.


> why removing ball after it dies?

Yeah. To remove corpse. It reduces lag greatly. Units die via timer will still leave corpse (this depends, though), which could lag the game.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top