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

[General] Execute a Trigger

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

I don't know why, but somehow I have little problems with execute triggers. I have a dialog trigger. When some buttons are pressed, then another trigger should be executes (Trigger: AD_Normal). For testing a add the event "call TriggerRegisterTimerEvent(gg_trg_AD_Normal,0.05,false)"

1) When I make AD_Normal initial off, the trigger still runs all actions (?).

2) When I execute the trigger (when it's not off or disabled), then nothing happen.

3) When I add an event from another trigger, to AD_Normal, the event for AD_Normal is always (null), so somehow I can't add events to it =O


Ok what the hell is going on here? I just want, if Player(0) press some dialog buttons "Deathmatch" > "Normal" > "20", then the AD_Normal trigger should be execute.

Hope someone can help me with this thing here =S

Greetings and Peace
Dr. Boom
 
Level 16
Joined
May 1, 2008
Messages
1,605
Well the trigger I want execute is this:

JASS:
function AD_NORMAL takes nothing returns nothing
    local integer i = 0
    
    loop
        exitwhen i == 11
        call DisplayTimedTextToPlayer(Player(i),0.,0.,8.,"The current mode: |c007EBFF1Arena Deathmatch -Normal-|r. The amount of maximal kills is: " + I2S(udg_D_Int[1]))
        call DisplayTimedTextToPlayer(Player(i),0.,0.,8.,"The areas around the fountains are save - areas. No Player can be attacked, while he's in the area")
        set i = i + 1
    endloop
    set i = 0
endfunction

//===========================================================================
function InitTrig_AD_Normal takes nothing returns nothing
    local trigger t = CreateTrigger()

    call TriggerRegisterTimerEvent(t,0.05,false) // I tried to remove the event, but then nothing happen anyway
    call TriggerAddAction(t,function AD_NORMAL)
    
    set t = null
endfunction

It's just a normal game massage for now, but I want add something there, which I didn't because even this isn't working.

Edit:
To run this trigger I use these two lines:
JASS:
                call EnableTrigger(gg_trg_AD_Normal) // Because trigger should be initial off
                call TriggerExecute(gg_trg_AD_Normal) // to run the trigger
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
There's no AD_Normal trigger (actually, there is, but you don't use it). You use local trigger t and function AD_Normal.
All you need to do is change the init function to:
JASS:
function InitTrig_AD_Normal takes nothing returns nothing
    set gg_trg_AD_NORMAL = CreateTrigger()
    call TriggerRegisterTimerEvent(gg_trg_AD_NORMAL,0.05,false) //Although you can remove this line
    call TriggerAddAction(gg_trg_AD_NORMAL,function AD_NORMAL)
endfunction
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Umm...try typing Normal instead of NORMAL, i made a typo in trigger name.
Like this
JASS:
function InitTrig_AD_Normal takes nothing returns nothing
    set gg_trg_AD_Normal = CreateTrigger()
    call TriggerRegisterTimerEvent(gg_trg_AD_Normal,0.05,false) //Although you can remove this line
    call TriggerAddAction(gg_trg_AD_Normal,function AD_NORMAL)
endfunction
 
Status
Not open for further replies.
Top