• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

TriggerRegisterVariableEvent issues between each other

Status
Not open for further replies.
Level 6
Joined
Apr 5, 2020
Messages
36
I have 3 triggers that use 3 TriggerRegisterVariableEvent.
  • In the first one, I set the Event_One variable, which should activate the TriggerRegisterVariableEvent in the second and third trigger.
  • In the second trigger, when the TriggerRegisterVariableEvent from Event_One is activated, Event_Two is set to 1, which fires the TriggerRegisterVariableEvent for the test3 function.

1
JASS:
globals
    real Event_One = 0.00
    real Event_Two = 0.00
endglobals

function Trig_Event_test1_Actions takes nothing returns nothing
    call BJDebugMsg("====================")
    call BJDebugMsg("test1 acivated")
    set Event_One = 1.00
    set Event_One = 0.00
endfunction

//===========================================================================
function InitTrig_Event_test1 takes nothing returns nothing
    set gg_trg_Event_test1 = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Event_test1, Player(0), "1", true )
    call TriggerAddAction( gg_trg_Event_test1, function Trig_Event_test1_Actions )
endfunction


2
JASS:
function Trig_Event_test2_Actions takes nothing returns nothing
    call BJDebugMsg("test2 acivated")
    set Event_Two = 1.00
    set Event_Two = 0.00
endfunction

function test3 takes nothing returns nothing
    call BJDebugMsg("test3 acivated")
endfunction

//===========================================================================
function InitTrig_Event_test2 takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterVariableEvent( trig, "Event_One", EQUAL, 1.00 )
    call TriggerAddAction( trig, function Trig_Event_test2_Actions )
 
    set trig = CreateTrigger()
    call TriggerRegisterVariableEvent( trig, "Event_Two", EQUAL, 1.00 )
    call TriggerAddAction( trig, function test3 )
 
    set trig = null
endfunction

3
JASS:
function Trig_Event_test4_Actions takes nothing returns nothing
    call BJDebugMsg("test4 acivated")
endfunction

//===========================================================================
function InitTrig_Event_test4 takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterVariableEvent( trig, "Event_One", EQUAL, 1.00 )
    call TriggerAddAction( trig, function Trig_Event_test4_Actions )
 
    set trig = null
endfunction

Problem: When I start writing "1" in the chat, this should appear in the chat:
====================
test1 acivated
test2 acivated
test3 acivated
test4 acivated

But it doesn't happen. As I understand it, TriggerRegisterVariableEvent of Event_Two stops the next triggers from Event_One from activating. How can this be fixed?

1.png
 
Last edited:
Level 6
Joined
Apr 5, 2020
Messages
36
why I dont see a real variable named "event_three" into your InitTrig_Event_test4, why using "Event_One"?
Because this is an example of a "custom event". For example, there is no "When a unit recovers health" event in the game, but it can be done artificially using TriggerRegisterVariableEvent. But the problem is that when a TriggerRegisterVariableEvent calls another TriggerRegisterVariableEvent, the still untested events from the first TriggerRegisterVariableEvent do not fire (for example, as it is done in event_test4). This question was asked to see if it's possible to fix this issue.
 
Status
Not open for further replies.
Top