Look at the bottom of the Actions function of GameMode.
I am calling TriggerExecute(gg_trg_RoundPresets).
All the code of GameMode works fine, but gg_trg_RoundPresets is not executed.
GameMode:
RoundPresets:
I am calling TriggerExecute(gg_trg_RoundPresets).
All the code of GameMode works fine, but gg_trg_RoundPresets is not executed.
GameMode:
JASS:
scope gameMode initializer Init
globals
integer gameMode = 0
constant integer GM_RANDOM_EACH_ROUND = 0
constant integer GM_RANDOM_ONCE = 1
constant integer GM_CHOOSE_EACH_ROUND = 2
constant integer GM_CHOOSE_ONCE = 3
dialog chooseGameMode = DialogCreate()
button randomEachRound = DialogAddButton(chooseGameMode, "Random Each Round", 1)
button randomOnce = DialogAddButton(chooseGameMode, "Random Once", 2)
button chooseEachRound = DialogAddButton(chooseGameMode, "Choose Each Round", 3)
button chooseOnce = DialogAddButton(chooseGameMode, "Choose Once", 4)
endglobals
private function Actions takes nothing returns nothing
local button clickedButton = GetClickedButton()
if clickedButton == randomEachRound then
set gameMode = GM_RANDOM_EACH_ROUND
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, "A random mode will be set each round.")
endif
if clickedButton == randomOnce then
set gameMode = GM_RANDOM_ONCE
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, "A random mode will be set for the rest of the game.")
endif
if clickedButton == chooseEachRound then
set gameMode = GM_CHOOSE_EACH_ROUND
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, GetPlayerName(Player(0)) + " will choose a mode each round.")
endif
if clickedButton == chooseOnce then
set gameMode = GM_CHOOSE_ONCE
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, GetPlayerName(Player(0)) + " will choose a mode for the rest of the game.")
endif
call TriggerExecute(gg_trg_RoundPresets)
call DialogDestroy(chooseGameMode)
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterDialogEvent(Trig, chooseGameMode)
call TriggerAddAction( Trig, function Actions )
endfunction
endscope
RoundPresets:
JASS:
scope roundPresets initializer Init
private function Actions takes nothing returns nothing
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, "gg_trg_RoundPresets")
if gameMode == GM_RANDOM_EACH_ROUND then
set roundMode = GetRandomInt(1, 3)
call gameModes_DisplayRoundMode()
endif
if gameMode == GM_RANDOM_ONCE then
set roundMode = GetRandomInt(1, 3)
call gameModes_DisplayRoundMode()
endif
if gameMode == GM_CHOOSE_EACH_ROUND then
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, GetPlayerName(Player(0)) + " is choosing a new Round Mode.")
call DialogSetMessage(chooseRoundMode, "Which mode do you want to play?")
call DialogDisplay(Player(0), chooseRoundMode, TRUE)
endif
if gameMode == GM_CHOOSE_ONCE then
call DialogSetMessage(chooseRoundMode, "Which mode do you want to play?")
call DialogDisplay(Player(0), chooseRoundMode, TRUE)
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterPlayerChatEvent(Trig, Player(0), "-start", true)
call TriggerAddAction(Trig, function Actions)
endfunction
endscope