Page 1 of 1
Game option depending of number of players
Posted: 22 March 2017, 18:01
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.
Re: Game option depending of number of players
Posted: 25 March 2017, 21:53
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.
Re: Game option depending of number of players
Posted: 25 March 2017, 22:35
by docthib
Awesome ! thanks

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

Re: Game option depending of number of players
Posted: 25 March 2017, 22:55
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).