Page 2 of 2
Re: Help - checkAction not working properly
Posted: 19 October 2020, 18:30
by stefano
This is happening only for the first turn!!! After the transition from state 1 to state 2... in the subsequent turn the notification is triggered.
Why ?
Re: Help - checkAction not working properly
Posted: 19 October 2020, 18:46
by RicardoRix
it's not:
notif.args.diceresult1
it's:
notif.args.result1
in JS, add the line debugger; and F12.
You'll be able to step through your code.
Re: Help - checkAction not working properly
Posted: 19 October 2020, 18:47
by stefano
Yes, I already fixed it... but still I'm not able to trigger the notification at the first turn...
On the subsequent turns it works. Any idea of why?
Re: Help - checkAction not working properly
Posted: 19 October 2020, 18:53
by RicardoRix
If this is at the very start of the game, then have a look at this:
https://boardgamearena.com/forum/viewto ... 12&t=17733
Re: Help - checkAction not working properly
Posted: 19 October 2020, 21:30
by stefano
This is my game state:
Code: Select all
1 => array(
"name" => "gameSetup",
"description" => clienttranslate("Game setup"),
"descriptionmyturn" => clienttranslate("Game setup"),
"type" => "manager",
"action" => "stGameSetup",
"transitions" => array( "StartGame" => 2 )
),
2 => array(
"name" => "PlaceFruit",
"description" => clienttranslate("Rolling the dice"),
"descriptionmyturn" => clienttranslate("Rolling the dice"),
"type" => "game", //"multipleactiveplayer",
"action" => "stPlaceFruit",
//"args" => "argPlaceFruit",
//"possibleactions" => array( "PlaceFruitDone"),
"updateGameProgression" => true,
"transitions" => array( "PlayersTurn" => 3 )
),
3 => array(
"name" => "Playacard",
"description" => clienttranslate("Wait other players to play their cards"),
"descriptionmyturn" => clienttranslate("Play one card"),
"type" => "multipleactiveplayer",
"action" => "stPlayacard",
"updateGameProgression" => true,
"possibleactions" => array( 'Playacard' ),
"transitions" => array( "Applyaction" => 4 )
),
In state number 2, the first time, the notification doesn't work, I set the active player in state 3 which is a multiplayer state. State 1 and 2 are game state.
During setup, I have:
self::activeNextPlayer();
What shall I do?
Re: Help - checkAction not working properly
Posted: 19 October 2020, 22:00
by RicardoRix
Why don't you have a 'Roll Dice to Start game' action button?
Re: Help - checkAction not working properly
Posted: 20 October 2020, 06:06
by stefano
What will change? Why I cannot jump directly into step 3, having rolled dice at step 2?
Re: Help - checkAction not working properly
Posted: 20 October 2020, 08:44
by stefano
I solved it by adding a pre-turn step, multiplayer, between setup and roll a dice... In this step I activate all players, make them performing an automatic action and during the automatic action I set the transition to the roll a dice state with "setPlayerNonMultiactive". In this case, the notification works also during the first turn.
Re: Help - checkAction not working properly
Posted: 20 October 2020, 23:47
by Victoria_La
where did you put dojo.subscribe? It seems right in random place, it has to be in setupNotifications method.
Did you go though any of the tutorials for the game development?