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.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top