Memory Leaks in these triggers?

chukky-jr

Member
Reaction score
15
okay just a quick question, does these trigger leaks? (might ask a few more)

Trigger:
  • RedAICampfire
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Player 1 (Red) controller) Equal to Computer
      • (Player 1 (Red) Current lumber) Greater than or equal to 5
      • (Number of living Tent units owned by Player 1 (Red)) Equal to 1
      • (Number of living Campfire units owned by Player 1 (Red)) Equal to 0
      • (Number of living BonFire units owned by Player 1 (Red)) Equal to 0
      • (Current order of Survivor 0003 <gen>) Equal to (Order(harvest))
    • Actions
      • Floating Text - Create floating text that reads |cffF00202Survivor|... above Survivor 0003 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set Text = (Last created floating text)
      • Floating Text - Change Text: Disable permanence
      • Floating Text - Set the velocity of Text to 30.00 towards 90.00 degrees
      • Floating Text - Change the fading age of Text to 1.50 seconds
      • Floating Text - Change the lifespan of Text to 3.00 seconds
      • Custom script: set udg_Text=null
      • Set RedBaseBuilding = (RedBase offset by (Random real number between 200.00 and 300.00) towards (Random angle) degrees)
      • Unit - Order Survivor 0018 <gen> to build a Campfire at RedBaseBuilding
      • Custom script: call RemoveLocation(udg_RedBaseBuilding)


Trigger:
  • RedAITurretUpgrade
    • Events
      • Player - Player 1 (Red)'s Current lumber becomes Greater than or equal to 15.00
      • Player - Player 1 (Red)'s Current gold becomes Greater than or equal to 15.00
    • Conditions
      • (Player 1 (Red) controller) Equal to Computer
      • (Number of living Turret Base units owned by Player 1 (Red)) Greater than or equal to 1
    • Actions
      • Set AIUnitGroup = (Units owned by Player 1 (Red) of type Turret Base)
      • Unit Group - Pick every unit in AIUnitGroup and do (Unit - Order (Picked unit) to train/upgrade to a Gun Tower)
      • Custom script: call DestroyGroup(udg_AIUnitGroup)
      • Custom script: set udg_AIUnitGroup=null


Trigger:
  • Machine Gun B Unit
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Sentry Gun
          • (Unit-type of (Attacking unit)) Equal to Sentry Gun II
    • Actions
      • Special Effect - Create a special effect attached to the origin of (Attacked unit) using Abilities\Weapons\GyroCopter\GyroCopterImpact.mdl
      • Wait 2.00 seconds
      • Special Effect - Destroy (Last created special effect)
      • Sound - Attach GyrocopterYesAttack2 <gen> to (Attacking unit)
      • Sound - Set position of GyrocopterYesAttack2 <gen> to (Position of (Attacked unit)) with Z offset 0.00
      • Sound - Play GyrocopterYesAttack2 <gen>
 

Dirac

22710180
Reaction score
147
I don't think that "Custom script: set udg_AIUnitGroup=null" is necessary after all you already destroyed the group.

"Wait 2.00 seconds" waits always cause problems, i don't know if this case does

I heard that some Floating Text leak if not removed properly, i dont know if the method you used is the correct one since you're not using locals. You might want to dig into that
 

chukky-jr

Member
Reaction score
15
1) it's an excessive line from previous trigger, okay i might delete it

2) then is there any wait command that is almost have no problem?

3) well i did some research that even if floating text does leaks, the max number allowed in game is 100, which means it almost auto-clean itself even if it leaks (i'm pretty sure this one does not leak though)

so overall the only problem is the wait line isn't it?
 

chukky-jr

Member
Reaction score
15
using timers or integers.

i get the timer part (though not sure if i really get it), but how do you use integers as timer?

btw i don't want to be an ass, but does these triggers have leaks?

Trigger:
  • Machine Gun A Unit
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Gun Tower
    • Actions
      • Sound - Attach GyrocopterImpactHit1 <gen> to (Attacking unit)
      • Sound - Attach GyrocopterImpactHit2 <gen> to (Attacking unit)
      • Set RandomPoint = (Position of (Attacked unit))
      • Sound - Set position of GyrocopterImpactHit1 <gen> to RandomPoint with Z offset 0.00
      • Sound - Set position of GyrocopterImpactHit2 <gen> to RandomPoint with Z offset 0.00
      • Custom script: call RemoveLocation(udg_RandomPoint)
      • Set MachineGunSound[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 2)
      • Wait 0.01 game-time seconds
      • If (MachineGunSound[(Player number of (Owner of (Attacking unit)))] Equal to 1) then do (Sound - Play GyrocopterImpactHit1 <gen>) else do (Sound - Play GyrocopterImpactHit2 <gen>)


Trigger:
  • Machine Gun B Unit
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Sentry Gun
          • (Unit-type of (Attacking unit)) Equal to Sentry Gun II
    • Actions
      • Special Effect - Create a special effect attached to the origin of (Attacked unit) using Abilities\Weapons\GyroCopter\GyroCopterImpact.mdl
      • Wait 2.00 seconds
      • Special Effect - Destroy (Last created special effect)
      • Sound - Attach GyrocopterYesAttack2 <gen> to (Attacking unit)
      • Set RandomPoint = (Position of (Attacked unit))
      • Sound - Set position of GyrocopterYesAttack2 <gen> to RandomPoint with Z offset 0.00
      • Custom script: call RemoveLocation(udg_RandomPoint)
      • Sound - Play GyrocopterYesAttack2 <gen>


i don't know whether the Z offset part have leaks or not... tried searching it w/o result...
 

rexpim

Member
Reaction score
8
but how do you use integers as timer?
Trigger:
  • Time - Every 1 second of game time
    • Actions
    • Set integer = integer +1
Trigger:
  • Events - ??
    • // if less don't do anything
    • If integer less or equal to "2" then
      • //nothing, or another action if you need
    • elf
    • // if greater do the action you want "remember to set integer to 0"
    • If integer greater or equal to "2" then
      • destroy whatever
      • set integer = 0
    • elf
 

chukky-jr

Member
Reaction score
15
thx but what about these? does it have leaks?

Trigger:
  • Machine Gun A Unit
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Gun Tower
    • Actions
      • Sound - Attach GyrocopterImpactHit1 <gen> to (Attacking unit)
      • Sound - Attach GyrocopterImpactHit2 <gen> to (Attacking unit)
      • Set RandomPoint = (Position of (Attacked unit))
      • Sound - Set position of GyrocopterImpactHit1 <gen> to RandomPoint with Z offset 0.00
      • Sound - Set position of GyrocopterImpactHit2 <gen> to RandomPoint with Z offset 0.00
      • Custom script: call RemoveLocation(udg_RandomPoint)
      • Set MachineGunSound[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 2)
      • Wait 0.01 game-time seconds
      • If (MachineGunSound[(Player number of (Owner of (Attacking unit)))] Equal to 1) then do (Sound - Play GyrocopterImpactHit1 <gen>) else do (Sound - Play GyrocopterImpactHit2 <gen>)


Trigger:
  • Machine Gun B Unit
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Sentry Gun
          • (Unit-type of (Attacking unit)) Equal to Sentry Gun II
    • Actions
      • Special Effect - Create a special effect attached to the origin of (Attacked unit) using Abilities\Weapons\GyroCopter\GyroCopterImpact.mdl
      • Wait 2.00 seconds
      • Special Effect - Destroy (Last created special effect)
      • Sound - Attach GyrocopterYesAttack2 <gen> to (Attacking unit)
      • Set RandomPoint = (Position of (Attacked unit))
      • Sound - Set position of GyrocopterYesAttack2 <gen> to RandomPoint with Z offset 0.00
      • Custom script: call RemoveLocation(udg_RandomPoint)
      • Sound - Play GyrocopterYesAttack2 <gen>


i don't know whether the Z offset part have leaks or not... tried searching it w/o result...
 

chukky-jr

Member
Reaction score
15
as far as i can see no, they don't leak. for future consult read this >tutorial<

i basically have read almost every memory leaks tutorial (including that one), but since i can't find the ones regarding sounds, i ask it here. but thx anyway :)
 

tommerbob

Minecraft. :D
Reaction score
110
Basically the only leaks you should worry about are Unit Groups and Points. Those are the big ones. Cleaning those up, you shouldn't worry much about any others.
 

Inflicted

Currently inactive
Reaction score
63
Trigger:
  • Machine Gun B Unit
    • Special Effect - Create a special effect attached to the origin of (Attacked unit) using Abilities\Weapons\GyroCopter\GyroCopterImpact.mdl
    • Wait 2.00 seconds
    • Special Effect - Destroy (Last created special effect)


just a question, doesnt "Last created special effect" leak, because it can be overid by another special effect made in another trigger or instance?
I could be wrong though, not entirely sure.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
It does if another special effect is created during the wait duration. That would change the Special Effect that it refers to, making the most recent one "Last Created". The same concept for other "Last Created" references.
 

chukky-jr

Member
Reaction score
15
i've fixed that one, i set the last created special effect as variable immediately after its creation

btw if my WC3 memory usage keeps going up when i play the map, does that mean memory leaks occur at the map? it increases at a random rate between 20-200 kb memory per second
 

chukky-jr

Member
Reaction score
15
i don't want to be an ass and kick this up, but i gotta to ask since a Leak Checker says my trigger leaks

Code:
Variables
TempGroup : (Line: 9) Location - Removed: No
RandomMovePoint : (Line: 10) Location - Removed: Yes

Code:
Dinosaur Attacks1
    Events
        Time - Every 20.00 seconds of game time
    Conditions
    Actions
        Set PlayerGroup = (All enemies of Player 1 (Red))
        Set PlayerGroup2 = (All allies of Player 1 (Red))
        Set TempReg = (Playable map area)
        Set TempGroup = (Random 1 units from (Units in TempReg owned by (Random player from PlayerGroup)))
        Set RandomMovePoint = (Position of (Random unit from (Units in TempReg owned by (Random player from PlayerGroup2))))
        Unit Group - Pick every unit in TempGroup and do (Unit - Order (Picked unit) to Attack-Move To RandomMovePoint)
        Custom script:   call RemoveRect(udg_TempReg)
        Custom script:   call DestroyGroup(udg_TempGroup)
        Custom script:   call RemoveLocation(udg_RandomMovePoint)
        Custom script:   call DestroyForce(udg_PlayerGroup)
        Custom script:   call DestroyForce(udg_PlayerGroup2)

Trigger:
  • Dinosaur Attacks1
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Set PlayerGroup = (All enemies of Player 1 (Red))
      • Set PlayerGroup2 = (All allies of Player 1 (Red))
      • Set TempReg = (Playable map area)
      • Set TempGroup = (Random 1 units from (Units in TempReg owned by (Random player from PlayerGroup)))
      • Set RandomMovePoint = (Position of (Random unit from (Units in TempReg owned by (Random player from PlayerGroup2))))
      • Unit Group - Pick every unit in TempGroup and do (Unit - Order (Picked unit) to Attack-Move To RandomMovePoint)
      • Custom script: call RemoveRect(udg_TempReg)
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(udg_RandomMovePoint)
      • Custom script: call DestroyForce(udg_PlayerGroup)
      • Custom script: call DestroyForce(udg_PlayerGroup2)


what i dont get this why it said Location not removed? is it becaused units in playable map area leaks? a simple yes it leaks / no it doesn't is very appreciated
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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