• 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.

Set of triggers suddenly stopped working

Status
Not open for further replies.
Level 7
Joined
May 11, 2010
Messages
278
This worked until just a few minutes ago.
  • Spawn warning
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set TempPoint = (Random point in Region 000 <gen>)
      • Hashtable - Save Handle OfTempPoint as (Key batspawnpoint) of 0 in BatSpawnTable
      • Countdown Timer - Start batspawntimer as a One-shot timer that will expire in 9.90 seconds
      • Custom script: call RemoveLocation(udg_TempPoint)
  • Spawn warning loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: local effect udg_TempSfx
      • Set TempPoint = (Load (Key batspawnpoint) of 0 in BatSpawnTable)
      • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Orc\AncestralSpirit\AncestralSpiritCaster.mdl
      • Set specialeffect = (Last created special effect)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 0.90 game-time seconds
      • Special Effect - Destroy specialeffect
      • Custom script: set udg_TempSfx = null
  • Spawn
    • Events
      • Time - batspawntimer expires
    • Conditions
    • Actions
      • Set TempPoint = (Load (Key batspawnpoint) of 0 in BatSpawnTable)
      • Unit - Create 1 Batrider for Neutral Passive at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to Bats
      • Custom script: call RemoveLocation(udg_TempPoint)
None of the functions (the special effect, the spawn) happens, but if i add a game message it's displayed correctly. It seems the triggers run, but the functions don't...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
You remove a location when it is no longer of any use to you. This usually means it will no longer be involved in script from after that point.

A leak occurs when the resources allocated for an object are left allocated although the object is of no further use. In the case of a location that can be letting all references to it being lost so the location and its handle remain allocated forever despite the location itself never being used after the point all references to it are lost.
 
Level 7
Joined
May 11, 2010
Messages
278
So basically, anything that leaks is only regarded as a leak if it is used and the left untouched for the rest of the game? because if that's so i have a hell of a lot of unneccesary location removals.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
It need not ever be used, it just has to exist past its practical purposes. Creating a blank location for no reason is still considered a leak unless you remove it.

Be aware that local variables defined with the "local" key word produce a handle ID leak where even if the object they point to is deallocated, the handle ID it was given cannot be recycled. The fix is to null them before the end of the function as that forces their reference counter to decriment (and thus allow recycling). Locals defined as function parameters do not suffer from this problem (they correctly decriment the reference counter automaticly at the end of the function).
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
Local variables are variables that is declared and used in only a function as opposed to globals which can be referred to by any function and/or trigger. Due to its nature, spells made in JASS that uses local variables are MUI automatically. However you will need to null the local after using them as pointed out by Doc.

Example JASS code with local (me no know GUI)

JASS:
 // Declaring local vars
    local location loc
    local unit u

// Code blah blah blah

// Destroy the location to prevent memory leak
   call DestroyLocation (loc)

// Nulling the locals
    set loc = null
    set u = null
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
  • Custom script: call RemoveLocation(udg_TempPoint)
this is the problem, you are destroying the saved location.

this is not true. at all. check your variables box, make sure all variables have only 1 array size
 
Level 7
Joined
May 11, 2010
Messages
278
I'm not sure i understand. Attached a pic. All of my triggers look like that, none have the Array box checked.

Also, it stopped working again when i changed it to use another point variable.

  • Spawn warning
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set TempPoint3 = (Random point in Region 000 <gen>)
      • Hashtable - Save Handle OfTempPoint as (Key batspawnpoint) of 0 in BatSpawnTable
      • Countdown Timer - Start batspawntimer as a One-shot timer that will expire in 9.90 seconds
  • Spawn warning loop
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: local effect udg_specialeffect
      • Set TempPoint3 = (Load (Key batspawnpoint) of 0 in BatSpawnTable)
      • Special Effect - Create a special effect at TempPoint3 using Abilities\Spells\Orc\AncestralSpirit\AncestralSpiritCaster.mdl
      • Set specialeffect = (Last created special effect)
      • Wait 1.50 game-time seconds
      • Special Effect - Destroy specialeffect
      • Custom script: set udg_specialeffect = null
  • Spawn
    • Events
      • Time - batspawntimer expires
    • Conditions
    • Actions
      • Set TempPoint3 = (Load (Key batspawnpoint) of 0 in BatSpawnTable)
      • Unit - Create 1 Batrider for Neutral Passive at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to Bats
 

Attachments

  • temp.jpg
    temp.jpg
    17.5 KB · Views: 82
Level 7
Joined
May 11, 2010
Messages
278
wtf how does that even compile

  • Custom script: local effect udg_specialeffect

I have no idea. Apocalypse made that for me in my thread about a Special Effect Leak.

Anyhow, do you want me to post the map so you can look at it?

I just rewrote the entire set of triggers, realizing i don't need it to be multi-instanceable.
It now works (seemingly) flawlessly.
 
Last edited by a moderator:
Status
Not open for further replies.
Top