• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] create lag

Status
Not open for further replies.
Level 10
Joined
Dec 13, 2008
Messages
222
This is your leakless trigger!

  • Untitled Trigger 001
    • Events
      • Unit - A unit enters (Your Region)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Set TempPoint = (Center of (Your Region))
      • Unit - Move (Triggering unit) instantly to TempPoint
      • Custom script: call RemoveLocation (udg_TempPoint)
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
It leaks in event, you can't fix it.
And use triggering unit instead of entering unit.

I don't think you really understand leaks...

When a trigger is destroyed, the events are still in memory and thus are a leak.
However, it's not because your trigger has an event, that the event is leaking already. Until you destroy the trigger, you NEED the event to be there. If you'd remove the event, the trigger would simply no longer work. It's only when you no longer use an object and have lost reference to it that it leaks. But in this case, you're still using the event object because you want the trigger to run, right?

Oh, and a "lag" is not a "leak". A lag is an uncomfortable delay on everything you do. Possible causes could be network latency (i.e. you don't have a fast connection to the other end of the world...) or too little memory, forcing you to use your slower virtual memory or simply a messed up memory stack caused by leaks. But then you need to have a lot of leaks before that happens, and it doesn't happen from just one event.
 
Level 9
Joined
Apr 3, 2008
Messages
700
Latency can be reduced by VCK. (Tools section).

@Eleandor
Do events leak remove so when I use CallDestroyTrigger(gg_trg_Trigger) or i need to remove events from it before deleting trigger?
And should I call trigger functions in other triggers because of event leak so?
 
Level 17
Joined
Aug 19, 2007
Messages
1,380
Why doesn't this trigger work?;

  • Events:
  • Unit - a unit enters region A
  • Conditions:
  • Unit-type of entering unit equal to fag
  • Actions:
  • Set TemPoint = (Center of region B)
  • Unit - order (triggering unit) to attack-move to TempPoint
  • Custom Scipt call RemoveLocation (udg_TempPoint)
I also tried "entering unit", that also didn't worked.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Issue a point order to triggering unit to move to the udg_TempPoint.
But won't this trigger still leak in event?

Events can't leak, in any case if they would, you wont be able to clean them out anyway. (As far as GUI goes.)

-----

Oh yeh, [K40$]-Spectre....
Maybe this is your problem:
  • Set TemPoint = (Center of region B)
It's not TempPoint?

Alos in your condition just use triggering unit, it's more effective.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Events do leak if you remove the trigger, but you can't remove the events anyway. And in general, you never need to destroy a trigger (and in GUI you literally will never destroy it).

The only other case that events would leak is in a damage detection system. In such a system you add a "specific unit takes damage" event to the same trigger for each unit on the map. When that unit dies, the event is no longer used but still registered to the trigger, and thus it leaks.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
[K40$]-Spectre;975506 said:
I wrote that wrong here, not in WE.

In that case your trigger is not the problem.

(Btw just right click and copy as text your trigger next time.
You can just paste it in you post between the trigger tags for better viewing.)

I guess there could be 2 problems, either it does not work because the unit is entering a different region thus not activating the event.
Or the unit entering is not equal to a fag (yeh that's what you called it.) so the condition prevents the actions from running.
 
Level 17
Joined
Aug 19, 2007
Messages
1,380
does not work because the unit is entering a different region thus not activating the event.
, denitely the right region.

Or the unit entering is not equal to a fag (yeh that's what you called it.) so the condition prevents the actions from running.
, actually, he's a fag.

But could it be that the unit must walk into the region? Because I've placed the unit already in the region in the map.
 
Level 17
Joined
Aug 19, 2007
Messages
1,380
Do you also know if there's a lag in this trigger?;


  • [TRIGGER]Soldiers2
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living |cffff0000Militia|r (Knife+Shield) units owned by Player 6 (Orange)) Less than or equal to 12
        • Then - Actions
          • Unit - Create 3 |cffff0000Militia|r (Knife+Shield) for Player 6 (Orange) at (Position of |cffff0000Kathai Spawn Point|r 1 0281 <gen>) facing Default building facing degrees
        • Else - Actions
          • Unit Group - Pick every unit in (Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield)) and do (Unit - Order (Picked unit) to Attack-Move To (Player 5 (Yellow) start location))
and in this one?;

  • Guardsmen
    • Events
      • Unit - A unit owned by Player 6 (Orange) Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • |cffff0000Guardsmen|r (Sword+Torch) 0271 <gen> Equal to (Dying unit)
        • Then - Actions
          • Wait 15.00 seconds
          • Unit - Create 1 |cffff0000Guardsmen|r (Sword+Torch) for Player 6 (Orange) at (Position of |cffff0000Kathai Spawn Point|r 1 0281 <gen>) facing Default building facing degrees
          • Hero - Set (Last created unit) Hero-level to (4 + (Random integer number between 4 and 12)), Hide level-up graphics
          • Unit - Order (Last created unit) to Attack-Move To (Center of Kathai1 <gen>)
        • Else - Actions
 
I have posted the leaks below.
If - Conditions
(Number of living |cffff0000Militia|r (Knife+Shield) units owned by Player 6 (Orange)) Less than or equal to 12
Unitgroup leak

Then - Actions
Unit - Create 3 |cffff0000Militia|r (Knife+Shield) for Player 6 (Orange) at (Position of |cffff0000Kathai Spawn Point|r 1 0281 <gen>)
Point leak

facing Default building facing degrees
Else - Actions
Unit Group - Pick every unit in (Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield)) and do (Unit - Order (Picked unit) to Attack-Move To (Player 5 (Yellow) start location))
Unitgroup and point leaks
Guardsmen
Events
Unit - A unit owned by Player 6 (Orange) Dies
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
|cffff0000Guardsmen|r (Sword+Torch) 0271 <gen> Equal to (Dying unit)
Then - Actions
Wait 15.00 seconds
Unit - Create 1 |cffff0000Guardsmen|r (Sword+Torch) for Player 6 (Orange) at (Position of |cffff0000Kathai Spawn Point|r 1 0281 <gen>)
Point Leak
facing Default building facing degrees
Hero - Set (Last created unit) Hero-level to (4 + (Random integer number between 4 and 12)), Hide level-up graphics
Unit - Order (Last created unit) to Attack-Move To (Center of Kathai1 <gen>)
Point leak
Else - Actions
 
[K40$]-Spectre;976053 said:
All the point leaks have been solved, exept for the else -actions (how do I solve this one?).

And how do I solve the unitgroup leaks?

Thanks guys, this really improves my project.

Have you checked mine also?

To remove a unitgroup-leak:

If - Conditions
(Number of living |cffff0000Militia|r (Knife+Shield) units owned by Player 6 (Orange)) Less than or equal to 12
the first unitgroup (In a condition hidden):

1st: Do a Tmp_Group, just add a new variable type = unitgroup.
2nd: Do a Tmp_Integer variable, just add an integer with the name.
It is used for counting the units.

Then do the following:
CustomScript: set udg_Tmp_Group = CreateGroup()
set Tmp_Group = Units of type |cffff0000Militia|r (Knife+Shield) by Player(6)
set Tmp_Integer = Number Of units in Tmp_Group()

Now the IF THEN ELSE with condition = Tmp_Integer >= .. whatever..
and after ..

CustomScript: call DestroyGroup(udg_Tmp_Group)
CustomScript: set udg_Tmp_Group = null


Second as he said before.
 
Level 17
Joined
Aug 19, 2007
Messages
1,380
never mind I get, so this trigger is leakless?;

  • Soldiers2
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set udg_Tmp_Group = CreateGroup()
      • Set TempGroup = (Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield))
      • Set TempInteger = (Number of units in TempGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInteger Less than or equal to 12
        • Then - Actions
          • Unit - Create 3 |cffff0000Militia|r (Knife+Shield) for Player 6 (Orange) at (Position of |cffff0000Kathai Spawn Point|r 1 0281 <gen>) facing Default building facing degrees
        • Else - Actions
          • Set TempPoint2 = (Player 5 (Yellow) start location)
          • Unit Group - Pick every unit in TempGroup and do (Unit - Order (Picked unit) to Attack-Move To TempPoint2)
          • Custom script: call RemoveLocation (udg_TempPoint2)
          • Custom script: call DestroyGroup(udg_Tmp_Group)
          • Custom script: set udg_Tmp_Group = null
 
[K40$]-Spectre;976093 said:
, I don't understand this one, what do I need to do here?

Instead using the
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Number of living |cffff0000Militia|r (Knife+Shield) units owned by Player 6 (Orange)) Less than or equal to 12
  • Then - Actions
  • Else - Actions
You use
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • Tmp_Integer Less than or equal to 12
  • Then - Actions
  • Else - Actions
 
Level 17
Joined
Aug 19, 2007
Messages
1,380
WE gave a script error, this script;
  • Custom script: set udg_Tmp_Group = null
in this trigger;

  • Soldiers2
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set udg_Tmp_Group = CreateGroup()
      • Set TempGroup = (Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield))
      • Set TempInteger = (Number of units in TempGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInteger Less than or equal to 12
        • Then - Actions
          • Set TempPoint2 = (Position of |cffff0000Kathai Spawn Point|r 1 0281 <gen>)
          • Unit - Create 3 |cffff0000Militia|r (Knife+Shield) for Player 6 (Orange) at TempPoint2 facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_TempPoint2)
        • Else - Actions
          • Set TempPoint2 = (Player 5 (Yellow) start location)
          • Unit Group - Pick every unit in TempGroup and do (Unit - Order (Picked unit) to Attack-Move To TempPoint2)
          • Custom script: call RemoveLocation (udg_TempPoint2)
      • Custom script: set udg_Tmp_Group = null
      • Custom script: call DestroyGroup(udg_Tmp_Group)
 
[K40$]-Spectre;976127 said:
WE gave a script error, this script;
  • Custom script: set udg_Tmp_Group = null
in this trigger;

  • Soldiers2
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set udg_Tmp_Group = CreateGroup()
      • Set TempGroup = (Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield))
      • Set TempInteger = (Number of units in TempGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInteger Less than or equal to 12
        • Then - Actions
          • Set TempPoint2 = (Position of |cffff0000Kathai Spawn Point|r 1 0281 <gen>)
          • Unit - Create 3 |cffff0000Militia|r (Knife+Shield) for Player 6 (Orange) at TempPoint2 facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_TempPoint2)
        • Else - Actions
          • Set TempPoint2 = (Player 5 (Yellow) start location)
          • Unit Group - Pick every unit in TempGroup and do (Unit - Order (Picked unit) to Attack-Move To TempPoint2)
          • Custom script: call RemoveLocation (udg_TempPoint2)
      • Custom script: set udg_Tmp_Group = null
      • Custom script: call DestroyGroup(udg_Tmp_Group)
I don't wonder, name the variable Tmp_Group please AND NOT TempGroup.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
You don't need this action:
Custom script: set udg_Tmp_Group = CreateGroup()

In fact, that script introduces a new leak.

You see, the "Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield)" action automatically creates a new group with the correct units in it. And that's the whole problem with leaks in GUI: these actions create groups but those groups are never destroyed. They can be destroyed by calling DestroyGroup() on the group, but then you need to store this group in a variable first (hence why you write: set TempGroup = units owned by ...)

However, if you do:
  • Custom script: set udg_Tmp_Group = CreateGroup()
    • Set TempGroup = (Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield))
you will create a new empty group stored in Tmp_Group
you will then create a new group containing militia units owned by player 6 and store it in Tmp_Group. But you've never destroyed the first group, and you'll never be able to because you've just overwritten Tmp_Group.

The correct trigger is:
  • Soldiers2
  • Events
    • Time - Every 60.00 seconds of game time
  • Conditions
  • Actions
    • Set TempGroup = (Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in TempGroup) Less than or equal to 12
      • Then - Actions
        • Set TempPoint = (Position of |cffff0000Kathai Spawn Point|r 1 0281 <gen>)
        • Unit - Create 3 |cffff0000Militia|r (Knife+Shield) for Player 6 (Orange) at TempPoint facing Default building facing degrees
      • Else - Actions
        • Set TempPoint = (Player 5 (Yellow) start location)
        • Unit Group - Pick every unit in TempGroup and do (Unit - Order (Picked unit) to Attack-Move To TempPoint)
    • Custom script: call RemoveLocation (udg_TempPoint2)
    • Custom script: call DestroyGroup(udg_Tmp_Group)
 
You don't need this action:
Custom script: set udg_Tmp_Group = CreateGroup()

In fact, that script introduces a new leak.

You see, the "Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield)" action automatically creates a new group with the correct units in it. And that's the whole problem with leaks in GUI: these actions create groups but those groups are never destroyed. They can be destroyed by calling DestroyGroup() on the group, but then you need to store this group in a variable first (hence why you write: set TempGroup = units owned by ...)

However, if you do:
  • Custom script: set udg_Tmp_Group = CreateGroup()
    • Set TempGroup = (Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield))
you will create a new empty group stored in Tmp_Group
you will then create a new group containing militia units owned by player 6 and store it in Tmp_Group. But you've never destroyed the first group, and you'll never be able to because you've just overwritten Tmp_Group.

The correct trigger is:
  • Soldiers2
  • Events
    • Time - Every 60.00 seconds of game time
  • Conditions
  • Actions
    • Set TempGroup = (Units owned by Player 6 (Orange) of type |cffff0000Militia|r (Knife+Shield))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in TempGroup) Less than or equal to 12
      • Then - Actions
        • Set TempPoint = (Position of |cffff0000Kathai Spawn Point|r 1 0281 <gen>)
        • Unit - Create 3 |cffff0000Militia|r (Knife+Shield) for Player 6 (Orange) at TempPoint facing Default building facing degrees
      • Else - Actions
        • Set TempPoint = (Player 5 (Yellow) start location)
        • Unit Group - Pick every unit in TempGroup and do (Unit - Order (Picked unit) to Attack-Move To TempPoint)
    • Custom script: call RemoveLocation (udg_TempPoint2)
    • Custom script: call DestroyGroup(udg_Tmp_Group)
Thanks, so now I've learned it correctly and can now remove the leak in my Map CHASER WARS <3 THX
 
Status
Not open for further replies.
Top