Game options

Game development with Board Game Arena Studio
Post Reply
emanueles
Posts: 13
Joined: 06 November 2011, 17:09

Game options

Post by emanueles »

Hello everybody,
I want to add an option to my game.

I modified the gameoptions.inc.php file in adding these lines:

Code: Select all

$game_options = array(

	100 => array(
		'name' => totranslate('Number of decks'),
		'values' => array(
			1 => array( 'name' => totranslate('2') ),
			2 => array( 'name' => totranslate('3') ),
			3 => array( 'name' => totranslate('4') ),
			4 => array( 'name' => totranslate('5') )
		)
	)

);
Then I modified the game.php file adding these lines to the function MyGameName():

Code: Select all

self::initGameStateLabels( array( 
		"decks_no" => 100
        ) );
and this line to the function setupNewGame():

Code: Select all

$decks_no = self::getGameStateValue( 'decks_no' ) + 1;
But it doesn't work. I don't see the option when creating a new game and there's an error in database creation.

Can anyone help me?
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: Game options

Post by sourisdudesert »

Hello,

Did you use the "Reload game options configuration" button from "Control Panel"/"Manage Games" ?

If not, this could be the reason.

Cheers,
emanueles
Posts: 13
Joined: 06 November 2011, 17:09

Re: Game options

Post by emanueles »

Yes, it was the reason.
Thank you very much!
emanueles
Posts: 13
Joined: 06 November 2011, 17:09

Re: Game options

Post by emanueles »

Another question about game options: how can I set the default value for a game option?
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: Game options

Post by sourisdudesert »

Hello,

The default option is always the first one.

Note that the default option is the first one in the array, not the option with the lowest number.

Cheers,
Post Reply

Return to “Developers”