Game option depending of number of players

Game development with Board Game Arena Studio
Post Reply
User avatar
docthib
Posts: 73
Joined: 10 August 2015, 14:05

Game option depending of number of players

Post by docthib »

Hello community,

I started to develop a new game and was wondering how to 'disable' some options according to number of players ?
I saw it on Race For The Galaxy if I remember well : you cannot play 5+ if you dont enable extension.

Thanks for your answers.
User avatar
Quinarbre
Posts: 140
Joined: 15 December 2013, 23:26

Re: Game option depending of number of players

Post by Quinarbre »

Hi,

In gameoptions.inc.php, inside the option you want to restrict, add a 'startcondition' field :

Code: Select all

$game_options = array(
    100 => array(
                'name' => totranslate('Form of Tash-Kalar'),    
                'values' => array(
                            1 => array( 'name' => totranslate('High Form'),
                                'tmdisplay' => totranslate('High Form') ),

                            2 => array( 'name' => totranslate('Deathmatch'),
                                'tmdisplay' => totranslate('Deathmatch') )
                                  ),
                'startcondition' => array(
                        1 => array( array( 'type' => 'maxplayers', 'value' => 2, 'message' => totranslate( 'High Form is only available for 2 players, please use Deathmatch for 3 or 4.' ) ) ),
                        2 => array( )
                                          )
                 )
                 ...)
So here, for option 100, value 1 (High Form) is restricted to 2 players max, and value 2 (Deathmatch) is unrestricted. I guess 'minplayers' would work too, I don't know if some other types have been implemented.
User avatar
docthib
Posts: 73
Joined: 10 August 2015, 14:05

Re: Game option depending of number of players

Post by docthib »

Awesome ! thanks :D
Will give it a try on monday, I wonder where to get all these kind of "secrets" of Studio API that aren't in the doc :)
User avatar
Quinarbre
Posts: 140
Joined: 15 December 2013, 23:26

Re: Game option depending of number of players

Post by Quinarbre »

Well this forum is already a good start usually !
And if we developers were a bit more rational we would contribute to the wiki (I know I don't do it enough) instead of just answering in the threads.

Also, plainly asking the devs can work if you're lucky enough to catch them when they are not too busy (they may even implement the function for you if it's not there already).
Post Reply

Return to “Developers”