How do I disable Wonders?

Raszagal

Chieftain
Joined
Jun 18, 2012
Messages
2
Location
Belgium
I got the definition of the wonders correct as it works completely, but what I want is to disable some of the following items if the GameOption that goes with it is selected in the advanced set-up screen.

definition of building class:
Code:
<GameData>
	<BuildingClasses>
		<!-- Broadway -->
		<Row>
			<Type>BUILDINGCLASS_BROADWAY</Type>
			<DefaultBuilding>BUILDING_BROADWAY</DefaultBuilding>
			<Description>TXT_KEY_BUILDING_BROADWAY</Description>
			<MaxGlobalInstances>1</MaxGlobalInstances>
		</Row>
		<!-- Florence Cathedral -->
		<Row>
			<Type>BUILDINGCLASS_DUOMO</Type>
			<DefaultBuilding>BUILDING_DUOMO</DefaultBuilding>
			<Description>TXT_KEY_BUILDING_DUOMO</Description>
			<MaxGlobalInstances>1</MaxGlobalInstances>
		</Row>
		<!-- Golden Pavilion -->
		<Row>
			<Type>BUILDINGCLASS_GOLDEN_PAVILION</Type>
			<DefaultBuilding>BUILDING_GOLDEN_PAVILION</DefaultBuilding>
			<Description>TXT_KEY_BUILDING_GOLDEN_PAVILION</Description>
			<MaxGlobalInstances>1</MaxGlobalInstances>
		</Row>
	</BuildingClasses>
</GameData>

definition of GameOptions:
Code:
<GameData>
	<GameOptions>
		<!-- Broadway -->
		<Row>
			<Type>GAMEOPTION_DISABLE_BROADWAY</Type>
			<Description>TXT_KEY_GAME_OPTION_DISABLE_BROADWAY</Description>
			<Help>TXT_KEY_GAME_OPTION_DISABLE_BROADWAY_HELP</Help>
		</Row>
		<!-- Florence Cathedral -->
		<Row>
			<Type>GAMEOPTION_DISABLE_DUOMO</Type>
			<Description>TXT_KEY_GAME_OPTION_DISABLE_DUOMO</Description>
			<Help>TXT_KEY_GAME_OPTION_DISABLE_DUOMO_HELP</Help>
		</Row>
		<!-- Golden Pavilion -->
		<Row>
			<Type>GAMEOPTION_DISABLE_GOLDEN_PAVILION</Type>
			<Description>TXT_KEY_GAME_OPTION_DISABLE_GOLDEN_PAVILION</Description>
			<Help>TXT_KEY_GAME_OPTION_DISABLE_GOLDEN_PAVILION_HELP</Help>
		</Row>
	</GameOptions>
</GameData>
 
There's no easy way to do that in XML. The only two ways to do it, that I can see, both involving Lua:

1> Create a Lua check in the CityCanConstruct GameEvent, using those GameOption flags to decide whether or not a city can construct those items.

2> Have those buildings each require a unique Project, and at the start of each game use a simple Lua function to give that Project to each player unless that GameOption flag has been turned on. (Because of how Projects work, you usually need to wait until the first city is founded for this to work right.)

#1 is the most direct and least abuseable, but it also has a much higher overhead cost since the game will continue to check that every time a player tries to decide what to build next. The #2 option is done once and then never needs to be worried about again, but requires a bit more work to manage.
 
There's no easy way to do that in XML. The only two ways to do it, that I can see, both involving Lua:

1> Create a Lua check in the CityCanConstruct GameEvent, using those GameOption flags to decide whether or not a city can construct those items.

2> Have those buildings each require a unique Project, and at the start of each game use a simple Lua function to give that Project to each player unless that GameOption flag has been turned on. (Because of how Projects work, you usually need to wait until the first city is founded for this to work right.)

#1 is the most direct and least abuseable, but it also has a much higher overhead cost since the game will continue to check that every time a player tries to decide what to build next. The #2 option is done once and then never needs to be worried about again, but requires a bit more work to manage.


Do you know a guide somewhere where lua is explained properly for option 2 as I got no experience with lua
 
Back
Top Bottom