• 🏆 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!

Running Destroyed Trigger

Status
Not open for further replies.
Level 20
Joined
Apr 14, 2012
Messages
2,901
No it won't. Proof:
  • Go
    • Events
      • Player - Player 1 (Red) types a chat message containing -go as An exact match
    • Conditions
    • Actions
      • Trigger - Run Untitled Trigger 001 <gen> (ignoring conditions)
Then second trigger:

JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_001" )
    call DestroyTrigger(gg_trg_Go)
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call DisableTrigger( gg_trg_Untitled_Trigger_001 )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

... It won't crash bro.
 
Level 4
Joined
Jan 27, 2010
Messages
133
I have to agree with WaterKnight. Running functions with destroyed/removed objects can potentially mess up things, and is never a recommended thing in any programming language I've encouontered.

I'd say try to work around it. Set a boolean or sth.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
When destroying the trigger you should null the global (to allow proper resource recycling). A custom function can be made to do this in a single call for neater code (but slower, stupid JASS). If TriggerExecute does not crash for null then there is nothing more that has to be done.

If TriggerExecute does crash with null then you need to do pre-condition testing yourself. A custom function can be used for ease of programming.
 
Status
Not open for further replies.
Top