• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Memory Leak/lag

Status
Not open for further replies.
Level 8
Joined
Aug 19, 2007
Messages
294
Hello my current protjekt is a Footmen.
My problem is that every time i play it end up with lag.
I will ask about 2 of my main triggers lag or leak:
  • Training
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Set MyUnitGroup = (Units in (Playable map area))
      • -------- Human --------
      • Unit Group - Order MyUnitGroup to train a Rifleman
      • Unit Group - Order MyUnitGroup to train a Mortar Team
      • Unit Group - Order MyUnitGroup to train a Medivh
      • Unit Group - Order MyUnitGroup to train a Sorceress
      • Unit Group - Order MyUnitGroup to train a Swordman
      • Unit Group - Order MyUnitGroup to train a Spell Breaker
      • Unit Group - Order MyUnitGroup to train a Dragonhawk Rider
      • (50 more of them)
      • Custom script: call DestroyGroup(udg_MyUnitGroup)
  • A Spell
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Attribute Bonus
    • Actions
      • Set PlayerGroup = (Player group((Owner of (Triggering unit))))
      • Set Point = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Attribute Bonus for (Triggering unit)) Less than 10
        • Then - Actions
          • Unit - Increase level of Attribute Bonus for (Triggering unit)
        • Else - Actions
          • Cinematic - Clear the screen of text messages for PlayerGroup
          • Game - Display to PlayerGroup the text: (|cFFFF0000 + ((Name of (Item being manipulated)) + is in max level, you can get your skill point back.|r))
          • Player - Add 1 to (Owner of (Triggering unit)) Current lumber
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Attribute Bonus for (Triggering unit)) Equal to 0
        • Then - Actions
          • Special Effect - Create a special effect at Point using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Add Attribute Bonus to (Triggering unit)
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call DestroyForce(udg_PlayerGroup)
There are over 100 triggers like these.

Okay, does these 2 triggers lag/leak?

EDIT: Sry for put it in the worng forum, i forgot it...
 
Last edited:
Level 13
Joined
Mar 4, 2009
Messages
1,156
i think your first trigger does a lot of lags

how can you order one unit from your unit group to train 50 of them ?
if you tough 50 more triggers...sry

use wait 0 second for every train unit it should help

train unit
wait 0 sec
train unit
wait 0 sec
train unit


in second actions in your second trigger you should
set Point = (somewhere)
...
call RemoveLocation(udg_Point)

same for the MyPlayerGroup


you need to use locations/player group in Else - Actions and also destroy/remove it there too
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Can you play make the trigger, this is very confusing.


  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Level of Attribute Bonus for (Triggering unit)) Less than 10
  • Then - Actions
  • Unit - Increase level of Attribute Bonus for (Triggering unit)
  • Else - Actions
  • Set PlayerGroup = (Player group((Owner of (Triggering unit))))
  • Cinematic - Clear the screen of text messages for PlayerGroup
  • Game - Display to PlayerGroup the text: (|cFFFF0000 + ((Name of (Item being manipulated)) + is in max level, you can get your skill point back.|r))
  • Custom script: call DestroyForce(udg_PlayerGroup)
  • Player - Add 1 to (Owner of (Triggering unit)) Current lumber
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Level of Attribute Bonus for (Triggering unit)) Equal to 0
  • Then - Actions
  • Set Point = (Position of (Triggering unit))
  • Special Effect - Create a special effect at Point using Abilities\Spells\Items\AIem\AIemTarget.mdl
  • Custom script: call RemoveLocation(udg_Point)
  • Special Effect - Destroy (Last created special effect)
  • Unit - Add Attribute Bonus to (Triggering unit)
  • Else - Actions
it should be like this....
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Maybe a little freeze, why?
i was just wondering because i have it when i create a hero for first time in game

did you try to put wait action for every new train order?,it should work

and,are you sure that EVERY unit in payable map area can train your units???
i think you should pick ever unit of type (your unit type that can train your unit) or units in playable map area matching (your condition)
 
Level 11
Joined
Dec 31, 2007
Messages
780
this GUI action leaks
  • Set PlayerGroup = (Player group((Owner of (Triggering unit))))
as stated here
http://www.hiveworkshop.com/forums/triggers-and-scripts-269/things-that-leak-35124/index44.html (Read every post until the end of the page)

--Solution--

Instead of setting a player group and then destroy it, do this:
  • Player Group - Add triggering player to X player group
  • ...
  • ...
  • ...
  • Player Group - Remove triggering player from X player group
if you are using waits inside the code, then, triggering player wont work in the "remove" action... you have to store the player into a variable
 
Level 8
Joined
Aug 19, 2007
Messages
294
I just looked at this:
Note: (All Players) does not leak, and destroying it can result in problems
Player Groups leak also, but those are really rare. The fix:
  • Player Group
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Some Spell
  • Actions
    • Set PlayerGroup = (All enemies of Player 1 (Red))
    • Player Group - Pick every player in PlayerGroup and do (Do nothing)
    • Custom script: call DestroyForce(udg_PlayerGroup
Link Here

If i looked at this my triggeris right, what is TRUE?
 
Level 11
Joined
Dec 31, 2007
Messages
780
if you read my posts in the things that leak you will notice that the discovery i made amazed more than one jasser... but vexorian knew about it... are you gonna argue vexorian?

to check if im right or not... download the map i attached to the post in "things that leak" , study it and then test the results
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
if you read my posts in the things that leak you will notice that the discovery i made amazed more than one jasser... but vexorian knew about it... are you gonna argue vexorian?

to check if im right or not... download the map i attached to the post in "things that leak" , study it and then test the results
ok but what should that prove,that leaks should be removed?
some small lags starten after 25 seconds witch means that i will have to be so crazy and set some player groups 2.500.000 times in 25 seconds xD
(and if i create 5000 groups in map it will be good)
nothing can happen if you don´t remove it at all
in real map you could have 5000 player groups MAX

i saw that in many maps they don´t remove player groups at all,played map more than 2 hours,nothing happens...

i think only unit groups and locations could make some lags in game

not destroying effects can´t do that,it can only make a big sky of effects if you create in 500+ times in same place,you
so it is most needed if you create effect every time unit attacks a unit or something like that often
 
Last edited:
Status
Not open for further replies.
Top