Help - checkAction not working properly

Game development with Board Game Arena Studio
User avatar
stefano
Posts: 89
Joined: 28 June 2011, 22:18

Re: Help - checkAction not working properly

Post 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 ?
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: Help - checkAction not working properly

Post 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.
User avatar
stefano
Posts: 89
Joined: 28 June 2011, 22:18

Re: Help - checkAction not working properly

Post 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?
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: Help - checkAction not working properly

Post 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
User avatar
stefano
Posts: 89
Joined: 28 June 2011, 22:18

Re: Help - checkAction not working properly

Post 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?
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: Help - checkAction not working properly

Post by RicardoRix »

Why don't you have a 'Roll Dice to Start game' action button?
User avatar
stefano
Posts: 89
Joined: 28 June 2011, 22:18

Re: Help - checkAction not working properly

Post by stefano »

What will change? Why I cannot jump directly into step 3, having rolled dice at step 2?
User avatar
stefano
Posts: 89
Joined: 28 June 2011, 22:18

Re: Help - checkAction not working properly

Post 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.
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: Help - checkAction not working properly

Post 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?
Post Reply

Return to “Developers”