My map lags quite a bit, is it a leak?

mystic_elf

New Member
Reaction score
2
I'm not sure what's causing it, since the last version of the map didn't lag. It's a spawn-based map, so that might be it. I myself did not create the trigger for the spawn, but I don't know if it's leaking or not. Can anyone see if it's what's causing the lag?

All of them follow this basic guideline:

Code:
Barad Dur Spawn 1
    Events
        Time - Every 120.00 seconds of game time
    Conditions
        (Player 12 (Brown) Food used) Less than 150
        (Barad-Dur 0058 <gen> is alive) Equal to True
        (Number of units in (Units owned by Player 12 (Brown) of type Keep)) Equal to 1
        (Player 12 (Brown) controller) Equal to User
    Actions
        Wait 1.00 seconds
        Unit - Create 2 Mordor Orc for Player 12 (Brown) at (Center of Barad Dur Spawn <gen>) facing Default building facing (270.0) degrees
        Unit - Create 1 Orc Archer for Player 12 (Brown) at (Center of Barad Dur Spawn <gen>) facing Default building facing (270.0) degrees
        Unit - Create 1 Mountain Troll for Player 12 (Brown) at (Center of Barad Dur Spawn <gen>) facing Default building facing (270.0) degrees
        Unit - Create 1 Mordor Banner Carrier for Player 12 (Brown) at (Center of Barad Dur Spawn <gen>) facing Default building facing (270.0) degrees
        Cinematic - Ping minimap for Player Group - Player 12 (Brown) at (Center of Barad Dur Spawn <gen>) for 1.00 seconds

Here's another one:
Code:
Cirith Ungol Spawn
    Events
        Time - Every 120.00 seconds of game time
    Conditions
        (Player 8 (Pink) controller) Equal to User
        (Tower of Cirith Ungol 0586 <gen> is alive) Equal to True
        (Player 8 (Pink) Food used) Less than 150
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Equal to 1
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 1 Mordor Orc for Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) facing Default building facing (270.0) degrees
                Unit - Create 1 Mordor Banner Carrier for Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) facing Default building facing (270.0) degrees
                Unit - Create 1 Mountain Troll for Player 12 (Brown) at (Center of Barad Dur Spawn <gen>) facing Default building facing (270.0) degrees
                Cinematic - Ping minimap for Player Group - Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) for 1.00 seconds
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Equal to 2
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 2 Mordor Orc for Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) facing Default building facing (270.0) degrees
                Unit - Create 1 Mordor Banner Carrier for Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) facing Default building facing (270.0) degrees
                Unit - Create 1 Orc Archer for Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) facing Default building facing (270.0) degrees
                Unit - Create 1 Mountain Troll for Player 12 (Brown) at (Center of Barad Dur Spawn <gen>) facing Default building facing (270.0) degrees
                Cinematic - Ping minimap for Player Group - Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) for 1.00 seconds
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Equal to 3
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 2 Mordor Orc for Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) facing Default building facing (270.0) degrees
                Unit - Create 2 Mordor Banner Carrier for Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) facing Default building facing (270.0) degrees
                Unit - Create 1 Mountain Troll for Player 12 (Brown) at (Center of Barad Dur Spawn <gen>) facing Default building facing (270.0) degrees
                Unit - Create 1 Orc Archer for Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) facing Default building facing (270.0) degrees
                Cinematic - Ping minimap for Player Group - Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) for 1.00 seconds
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Equal to 4
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 3 Mordor Orc for Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) facing Default building facing (270.0) degrees
                Unit - Create 2 Mordor Banner Carrier for Player 8 (Pink) at (Center of Cirith Ungol Spawn <gen>) facing Default building facing (270.0) degrees
                Unit - Create 2 Orc Archer for Player 8 (Pink) at (Center of Cirith Ungol Spa

(cuts out at the bottom, but their all repeats of each, but with different spawns each level)

The spawns are based on the amount of "forts" you have:

Code:
Pink Castles
    Events
        Time - Every 480.00 seconds of game time
    Conditions
        (Player 8 (Pink) controller) Equal to User
        (Tower of Cirith Ungol 0586 <gen> is alive) Equal to True
    Actions
        Unit - Create 1 Keep for Player 8 (Pink) at (Center of Pink castles <gen>) facing (Center of Brown Castles <gen>)

Now I don't personally see what's wrong with it, but I have no idea how leaks work. Tell me if I need to post any more info.
 

Hatebreeder

So many apples
Reaction score
381
(Centre of ...) are location leaks.
fix all those, just by making point variables and removing them in the end.
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
Locations (as mentioned above) leak. Also, sometimes maps may lag when you create multiple units at a time.

Also, when does exactly does it lag? Does it start lagging the first time the triggers run, about 10(random estimate) minutes after the game started? Does it lag badly(5 secs or more, etc.).
 

mystic_elf

New Member
Reaction score
2
Lags progressively worse as the map goes on.

And could you clarify what you mean? I'm kind of new to triggering, and as aforementioned, I didn't create these at all ><.
 

Sil3nt

SUP?
Reaction score
134
Make a point variable (for example lets just say tmp_point)
Everytime you do an action at a 'point'. Set the variable to that point. Then refer to the variable when you create the unit. To destroy the point variable (cleaning the leak) type this in the Custom Script (custom script is a action near the top).
call RemoveLocation (udg_YourVariableName)

Example
Actions
Set tmp_point = Center of (playable map area)
Create 1 footman at tmp_point
custom script: call RemoveLocation (udg_YourVariableName)

I'm confused about something however (sorry for going bit offtopic) since center of playable map area never changes, doesnt that mean it wont leak?
 

Sim

Forum Administrator
Staff member
Reaction score
534
> Lags progressively worse as the map goes on.

That is a clear symptom or leaks.

You probably have more leaks than just in these 3 triggers. Clear them all using Sil3nt's method.

> I'm confused about something however (sorry for going bit offtopic) since center of playable map area never changes, doesnt that mean it wont leak?

It creates a location there every time you refer to it. You must remove it, even if that location in itself never changes.
 

Weyrling

New Member
Reaction score
25
Globals don't need to have 'call RemoveLocation(udg_VARNAME)' used on them, I'm pretty sure.
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Globals don't need to have 'call RemoveLocation(udg_VARNAME)' used on them, I'm pretty sure.

What?

All global points cause leaks and has to be removed by using the custom script "call RemoveLocation (udg_YourVariable)"
 
T

Tubba

Guest
> Lags progressively worse as the map goes on.

That is a clear symptom or leaks.

You probably have more leaks than just in these 3 triggers. Clear them all using Sil3nt's method.

> I'm confused about something however (sorry for going bit offtopic) since center of playable map area never changes, doesnt that mean it wont leak?

It creates a location there every time you refer to it. You must remove it, even if that location in itself never changes.
What if you set it to a variable and then refer to that variable multiple times without destroying it?
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Refer to it as in using it multiple times works just fine since it's the same point.

Refer to it as in setting a new value into the same variable multiple times without destroying it = bad news.
 

mystic_elf

New Member
Reaction score
2
Thanks. Does anyone know which JASS client I should be using? There's so many :eek:

And I should be doing this for EVERY spawn? All 89 different triggers that I can't copy and paste into?

/wrist
 
T

Tubba

Guest
Sorry, you have to do this for all, but you only need one variable (Most people use a point variable called "tempPoint" or something similar for all their spells, etc)
 

Sim

Forum Administrator
Staff member
Reaction score
534
What if you set it to a variable and then refer to that variable multiple times without destroying it?

What some people do, including me, is if you know that you are going to use a point multiple times in your map, you can simply set a point variable to that location right at the beginning and use that variable all the way to the end without never setting it to a new value or destroying it. Technically, it leaks, but only at the very end and only once so... it doesn't matter. :)
 

mystic_elf

New Member
Reaction score
2
What some people do, including me, is if you know that you are going to use a point multiple times in your map, you can simply set a point variable to that location right at the beginning and use that variable all the way to the end without never setting it to a new value or destroying it. Technically, it leaks, but only at the very end and only once so... it doesn't matter. :)

Um. This sounds simpler. And since I don't know how to use JASS, can you explain this to me?
 

Sim

Forum Administrator
Staff member
Reaction score
534
Well, it seems simpler but, in truth, you have to set a different point to every repetitive location on the map you know you will use often.

So, you might get lost in your variables list. :rolleyes:

It works like this (At Map Initialization):

Code:
Set MapCenter = Center of (playable map area))
Set HeroSpawn = (Center of Hero Spawn <gen>)
Set Mobs_Respawn_Loc = (Center of Mobs Respawn <gen>)
...

And then every time you need to refer to one of those locations, you use the point variable instead.
 

mystic_elf

New Member
Reaction score
2
Um. Well... this game has 12 races, each has a couple different spawns. I did the

Set OrthancSpawn (the variable) equal to (center of IsengardSpawn) <--- rect

I made it a completely new trigger (at map initialization), and set each of the different spawns like this. Then I set the spawned units to the variable. Is that what you mean?

Edit: This is what I'm doing:

I'm setting variable:


JASS:
Pink Variables
    Events
        Map initialization
    Conditions
    Actions
        Set PinkForts = (Center of Pink castles &lt;gen&gt;)
        Set UdunSpawn = (Center of Udun Spawn &lt;gen&gt;)
        Set CirithSpawn = (Center of Cirith Ungol Spawn &lt;gen&gt;)


And then I'm using the variables as such:

JASS:
Udun Spawn
    Events
        Time - Every 120.00 seconds of game time
    Conditions
        (Player 8 (Pink) controller) Equal to User
        (Udun 0154 &lt;gen&gt; is alive) Equal to True
        (Player 8 (Pink) Food used) Less than 150
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Equal to 1
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 2 Mordor Orc for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 1 Orc Archer for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Cinematic - Ping minimap for Player Group - Player 8 (Pink) at UdunSpawn for 1.00 seconds
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Equal to 2
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 3 Mordor Orc for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 1 Orc Archer for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Cinematic - Ping minimap for Player Group - Player 8 (Pink) at UdunSpawn for 1.00 seconds
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Equal to 3
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 4 Mordor Orc for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 1 Orc Archer for Player 8 (Pink) at (Center of Udun Spawn &lt;gen&gt;) facing Default building facing (270.0) degrees
                Unit - Create 1 Cave Troll of Udun for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Cinematic - Ping minimap for Player Group - Player 8 (Pink) at UdunSpawn for 1.00 seconds
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Equal to 4
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 5 Mordor Orc for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 2 Orc Archer for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 1 Cave Troll of Udun for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Cinematic - Ping minimap for Player Group - Player 8 (Pink) at UdunSpawn for 1.00 seconds
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Equal to 5
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 6 Mordor Orc for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 2 Orc Archer for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 1 Mountain Troll for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 1 Cave Troll of Udun for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Cinematic - Ping minimap for Player Group - Player 8 (Pink) at UdunSpawn for 1.00 seconds
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Equal to 6
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 7 Mordor Orc for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 3 Orc Archer for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 2 Mountain Troll for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 1 Cave Troll of Udun for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Cinematic - Ping minimap for Player Group - Player 8 (Pink) at UdunSpawn for 1.00 seconds
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units owned by Player 8 (Pink) of type Keep)) Greater than or equal to 7
            Then - Actions
                Wait 2.00 seconds
                Unit - Create 8 Mordor Orc for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 3 Orc Archer for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 2 Mountain Troll for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 3 Mordor Banner Carrier for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Unit - Create 1 Armored Mountain Troll for Player 8 (Pink) at UdunSpawn facing Default building facing (270.0) degrees
                Cinematic - Ping minimap for Player Group - Player 8 (Pink) at UdunSpawn for 1.00 seconds
            Else - Actions
                Do nothing


Note that each race will have about 3-4 of these different variables. If I don't delete them, will it still leak? I'm not too clear on what Dax is trying to say. Can anyone clarify? I'm new to triggering D:

JASS:
Um.function Trig_Umbar_Spawn_2_Copy_Conditions takes nothing returns boolean
if ( not ( GetPlayerState(Player(9), PLAYER_STATE_RESOURCE_FOOD_USED) &lt; 150 ) ) then
return false
endif
if ( not ( IsUnitAliveBJ(gg_unit_h00N_0096) == true ) ) then
return false
endif
if ( not ( CountUnitsInGroup(GetUnitsOfPlayerAndTypeId(Player (9), &#039;h017&#039;)) == 2 ) ) then
return false
endif
if ( not ( GetPlayerController(Player(9)) == MAP_CONTROL_USER ) ) then
return false
endif
return true
endfunction

function Trig_Umbar_Spawn_2_Copy_Actions takes nothing returns nothing
call TriggerSleepAction( 6.00 )
call CreateNUnitsAtLoc( 2, &#039;o008&#039;, Player(9), GetRectCenter(gg_rct_Umbar_Spawn), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, &#039;n00V&#039;, Player(9), GetRectCenter(gg_rct_Umbar_Spawn), bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, &#039;o00T&#039;, Player(9), GetRectCenter(gg_rct_Umbar_Spawn), bj_UNIT_FACING )
call PingMinimapLocForForce( bj_FORCE_PLAYER[9], GetRectCenter(gg_rct_Umbar_Spawn), 1 )
endfunction

//================================================== =========================
function InitTrig_Umbar_Spawn_2_Copy takes nothing returns nothing
set gg_trg_Umbar_Spawn_2_Copy = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Umbar_Spawn_2_Copy, 120.00 )
call TriggerAddCondition( gg_trg_Umbar_Spawn_2_Copy, Condition( function Trig_Umbar_Spawn_2_Copy_Conditions ) )
call TriggerAddAction( gg_trg_Umbar_Spawn_2_Copy, function Trig_Umbar_Spawn_2_Copy_Actions )
endfunction

call RemoveLocation (udg_HaradSpawn)


Would this be how you would do it?
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
JASS:
Um.function Trig_Umbar_Spawn_2_Copy_Conditions takes nothing returns boolean
return GetPlayerState(Player(9), PLAYER_STATE_RESOURCE_FOOD_USED, &lt; 150)

return GetUnitState(gg_unit_h00N_0096, UNIT_STATE_LIFE &gt; 0.401)

return CountUnitsInGroup(GetUnitsOfPlayerAndTypeId(Player (9), &#039;h017&#039;)) == 2 ) )

return GetPlayerController(Player(9)) == MAP_CONTROL_USER

endfunction

function Trig_Umbar_Spawn_2_Copy_Actions takes nothing returns nothing
call TriggerSleepAction( 6.00 )
call CreateNUnitsAtLoc( 2, &#039;o008&#039;, Player(9), GetRectCenter(gg_rct_Umbar_Spawn), 0 )
call CreateNUnitsAtLoc( 1, &#039;n00V&#039;, Player(9), GetRectCenter(gg_rct_Umbar_Spawn), 0 )
call CreateNUnitsAtLoc( 1, &#039;o00T&#039;, Player(9), GetRectCenter(gg_rct_Umbar_Spawn), 0 )
call PingMinimapLocForForce( bj_FORCE_PLAYER[9], GetRectCenter(gg_rct_Umbar_Spawn), 1 )
endfunction

//================================================== =========================
function InitTrig_Umbar_Spawn_2_Copy takes nothing returns nothing
set gg_trg_Umbar_Spawn_2_Copy = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Umbar_Spawn_2_Copy, 120.00 )
call TriggerAddCondition( gg_trg_Umbar_Spawn_2_Copy, Condition( function Trig_Umbar_Spawn_2_Copy_Conditions ) )
call TriggerAddAction( gg_trg_Umbar_Spawn_2_Copy, function Trig_Umbar_Spawn_2_Copy_Actions )
endfunction

call RemoveLocation (udg_HaradSpawn)


Would this be how you would do it?

I think this would be a better way of doing it. I'm a jass-newb so i can't guarrantee that it works.
 

mystic_elf

New Member
Reaction score
2
Hm. Would Dax's mentioned way work? If I simply made the spawns variables, but didn't remove the variables?

Alright so I would create a trigger that sets a variable as a location right?

Event - game initilization
actions- set (orthancspawn) equal to (center of (isengard spawn))

Would I only do that once, or do I have to create it every spawn? Does the

call RemoveLocation (udg_HaradSpawn)

bit remove the variable from play?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top