Trigger messes up the game after fixing memory leaks...

Disoraptor

New Member
Reaction score
0
Hi!

I'm a quarter through my map when i decided it would be nice to check up on memory leaks here and there. Map contains 4 difficulty levels and therefore 4 types of the same unit. It spawns them as a "run trigger" action during map initialization (everything works fin) and here is my basic trigger:

Trigger:
  • Units Spawns Level 1
    • Events
    • Conditions
    • Actions
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at (Center of Camp 001 Unit 01 <gen>) facing 180.00 degrees
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at (Center of Camp 001 Unit 02 <gen>) facing 180.00 degrees
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at (Center of Camp 001 Unit 03 <gen>) facing 180.00 degrees
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at (Center of Camp 002 Unit 01 <gen>) facing 90.00 degrees
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at (Center of Camp 002 Unit 02 <gen>) facing 90.00 degrees
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at (Center of Camp 002 Unit 03 <gen>) facing 90.00 degrees
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at (Center of Camp 003 Unit 01 <gen>) facing 180.00 degrees
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at (Center of Camp 003 Unit 02 <gen>) facing 180.00 degrees
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at (Center of Camp 003 Unit 03 <gen>) facing 180.00 degrees
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at (Center of Camp 003 Unit 04 <gen>) facing 180.00 degrees
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at (Center of Camp 003 Unit 05 <gen>) facing 180.00 degrees
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at (Center of Camp 004 Unit 01 <gen>) facing 180.00 degrees
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at (Center of Camp 004 Unit 02 <gen>) facing 180.00 degrees
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at (Center of Camp 004 Unit 03 <gen>) facing 180.00 degrees
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at (Center of Camp 005 Unit 01 <gen>) facing 315.00 degrees
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at (Center of Camp 005 Unit 02 <gen>) facing 315.00 degrees
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at (Center of Camp 005 Unit 03 <gen>) facing 315.00 degrees
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at (Center of Camp 002 Tent 01 <gen>) facing 90.00 degrees
      • Set Enemy_Spawn_Building[1] = (Last created unit)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at (Center of Camp 003 Tent 01 <gen>) facing Default building facing degrees
      • Set Enemy_Spawn_Building[2] = (Last created unit)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at (Center of Camp 003 Tent 02 <gen>) facing Default building facing degrees
      • Set Enemy_Spawn_Building[3] = (Last created unit)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at (Center of Camp 004 Tent 01 <gen>) facing 180.00 degrees
      • Set Enemy_Spawn_Building[4] = (Last created unit)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at (Center of Camp 005 Tent 01 <gen>) facing 240.00 degrees
      • Set Enemy_Spawn_Building[5] = (Last created unit)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at (Center of Camp 005 Tent 02 <gen>) facing 45.00 degrees
      • Set Enemy_Spawn_Building[6] = (Last created unit)


This trigger is shorter (there are 250+ units in the original one) and it is obviously full of point memory leaks. I tried to fix these leaks with adding Temp_Point and costum text to destroy it afterwards, so it looked like this:

Trigger:
  • Units Spawns Level 1
    • Events
    • Conditions
    • Actions
      • Set Temp_Point = (Center of Camp 001 Unit 01 <gen>)
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 001 Unit 02 <gen>)
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 001 Unit 03 <gen>)
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 002 Unit 01 <gen>)
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at Temp_Point facing 90.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 002 Unit 02 <gen>)
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at Temp_Point facing 90.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 002 Unit 03 <gen>)
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at Temp_Point facing 90.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 003 Unit 01 <gen>)
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 003 Unit 02 <gen>)
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 003 Unit 03 <gen>)
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 003 Unit 04 <gen>)
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 003 Unit 05 <gen>)
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 004 Unit 01 <gen>)
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 004 Unit 02 <gen>)
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 004 Unit 03 <gen>)
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 005 Unit 01 <gen>)
      • Unit - Create 1 Highwayman (Level 1) for Player 12 (Brown) at Temp_Point facing 315.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 005 Unit 02 <gen>)
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at Temp_Point facing 315.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 005 Unit 03 <gen>)
      • Unit - Create 1 Hill Militia (Level 1) for Player 12 (Brown) at Temp_Point facing 315.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = (Center of Camp 002 Tent 01 <gen>)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at Temp_Point facing 90.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Enemy_Spawn_Building[1] = (Last created unit)
      • Set Temp_Point = (Center of Camp 003 Tent 01 <gen>)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at Temp_Point facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Enemy_Spawn_Building[2] = (Last created unit)
      • Set Temp_Point = (Center of Camp 003 Tent 02 <gen>)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at Temp_Point facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Enemy_Spawn_Building[3] = (Last created unit)
      • Set Temp_Point = (Center of Camp 004 Tent 01 <gen>)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at Temp_Point facing 180.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Enemy_Spawn_Building[4] = (Last created unit)
      • Set Temp_Point = (Center of Camp 005 Tent 01 <gen>)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at Temp_Point facing 240.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Enemy_Spawn_Building[5] = (Last created unit)
      • Set Temp_Point = (Center of Camp 005 Tent 02 <gen>)
      • Unit - Create 1 Mountain Tent (Level 1) for Player 12 (Brown) at Temp_Point facing 45.00 degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Enemy_Spawn_Building[6] = (Last created unit)


I don't know what went wrong and how, but when i tested the map, here is what happened: Map is to start with hero selection (with a wisp) and then the hero is moved to a certain location where a cinematic is played. Up untill the cinematic, everything works fine. But when the cinematic should be played (using turn letterbox mode on after 0.1 seconds - I avoided using cinematic mode due to visibility reasons) it doesn't jump to letterbox mode. Funny thing is that the units in the cinematic move as they should, but the letterbox mode stays off. It also doesn't clear the game texts or any other texts when it "should" start. After the "cinematic" finishes, i normally get the control of the hero as it should. Does anyone know what might have gone wrong?

One more interesting thing is that i get a quest right after the cinematic ends. Before i implemented the memory leak repairs the "quest received" sound was as it should (those drums played a bit and all) but after the implementation, i only get a sound (for quests receive) as if you'd click a dialog button or f10 (game menu). Totally blew my mind. Any ideas?

P.S.: I have doublechecked every trigger up untill the cinematic with different versions of my maps, and they all worked fine, the problem did only arise after those memory leaks fixes. I wonder, are there simply too many of those or what?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Try disabling the trigger and see if the rest work as intended. If so, this is the one with the problem. You can use a For Each Integer loop to take the place of similar actions, since many of them appear to be repeats.
 

Disoraptor

New Member
Reaction score
0
I did try it with disabling the trigger and it worked fine. So i established that it's the buggy trigger. Unfortunately, even with using loop actions i end up with about 100 line of actions. If looping I would also need to make regions as variables, arrays (camp 1 would have regions camp1[1], camp1[2], camp1[3]). Then again, I'll try it out when i get home and post back how it worked out.
 

Disoraptor

New Member
Reaction score
0
Got my hands on an editor, but don't have an original map with me. Which one of these triggers is more memory leak free or are they the same (meaning the 2nd one is likely to be less laggy)? Cos i need to figure out if variables get overwritten or not.

Trigger:
  • Untitled Trigger 007
    • Events
      • Player - Player 1 (Red) types a chat message containing /trigger as An exact match
    • Conditions
    • Actions
      • For each (Integer Trial_Loop) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set Trial_Point = (Center of Trial_Region[Trial_Loop])
          • Unit - Create 1 Footman for Player 12 (Brown) at Trial_Point facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Trial_Point)


or this one:

Trigger:
  • Untitled Trigger 007
    • Events
      • Player - Player 1 (Red) types a chat message containing /trigger as An exact match
    • Conditions
    • Actions
      • For each (Integer Trial_Loop) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set Trial_Point = (Center of Trial_Region[Trial_Loop])
          • Unit - Create 1 Footman for Player 12 (Brown) at Trial_Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Trial_Point)
 

MP®

Member
Reaction score
11
you need to do it with the first one, because in the second one, the trigger creates the point 4 times, and only removes it once.
 

OMGOMGOMG

UMBWGMG (Unidentified Human Being.)
Reaction score
28
Got my hands on an editor, but don't have an original map with me. Which one of these triggers is more memory leak free or are they the same (meaning the 2nd one is likely to be less laggy)? Cos i need to figure out if variables get overwritten or not.

Trigger:
  • Untitled Trigger 007
    • Events
      • Player - Player 1 (Red) types a chat message containing /trigger as An exact match
    • Conditions
    • Actions
      • For each (Integer Trial_Loop) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set Trial_Point = (Center of Trial_Region[Trial_Loop])
          • Unit - Create 1 Footman for Player 12 (Brown) at Trial_Point facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Trial_Point)


or this one:

Trigger:
  • Untitled Trigger 007
    • Events
      • Player - Player 1 (Red) types a chat message containing /trigger as An exact match
    • Conditions
    • Actions
      • For each (Integer Trial_Loop) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set Trial_Point = (Center of Trial_Region[Trial_Loop])
          • Unit - Create 1 Footman for Player 12 (Brown) at Trial_Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Trial_Point)

I did try it with disabling the trigger and it worked fine. So i established that it's the buggy trigger. Unfortunately, even with using loop actions i end up with about 100 line of actions. If looping I would also need to make regions as variables, arrays (camp 1 would have regions camp1[1], camp1[2], camp1[3]). Then again, I'll try it out when i get home and post back how it worked out.

You are in violation of Rule 4. B.

USE THE 'edit' Button, that is why it is there!
 
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