Mutually Exclusive Buildings?

HowAreYou

Chieftain
Joined
Aug 20, 2012
Messages
14
Is it possible to make it so a building can only be built if another building is not present in the same city? For example, say I was going to give the player the option to build either an Elementary School to increase money and science, or build a Child Employment Office to increase production and food, but you can't have both in the same city. Would that be possible?
 
yes, try the MutuallyExclusiveGroup tag in Buildings table.

else there is the coding possibility with the GameEvents.PlayerCanConstruct in Lua
 
yes, try the MutuallyExclusiveGroup tag in Buildings table.

Which the core game already uses for the Nuclear Plant and Solar Plant, so that you can't build one when the other exists in a city. Mutually exclusive groups work just fine; in my own mod I'd added four National Wonders that were limited to 1 per city, with each shifting the focus of that city towards one theme. (So you'd have a "research city", "money city", and so on.)

The only downside is that you have to pick a number for your Mutually Exclusive Group. The game won't automatically assume that your mod's group is unique, so if you pick group #5, and some other mod ALSO has mutually exclusive buildings using group #5, they'll conflict. So you have to pick a unique number that you think no one else will pick; avoid common numbers like 2, 3, 4, and things like 42 or 69.
 
Which the core game already uses for the Nuclear Plant and Solar Plant, so that you can't build one when the other exists in a city. Mutually exclusive groups work just fine; in my own mod I'd added four National Wonders that were limited to 1 per city, with each shifting the focus of that city towards one theme. (So you'd have a "research city", "money city", and so on.)

The only downside is that you have to pick a number for your Mutually Exclusive Group. The game won't automatically assume that your mod's group is unique, so if you pick group #5, and some other mod ALSO has mutually exclusive buildings using group #5, they'll conflict. So you have to pick a unique number that you think no one else will pick; avoid common numbers like 2, 3, 4, and things like 42 or 69.

Ah, great. Thanks. That was the elaboration I was looking for :P
 
Does the xml tag work for religious buildings? I know for units religious tends to trump exclusivity.
Yes. I've done this very thing as a test with the four 'standard' religious buildings. But to make the test at all useful I had to add a new belief that allowed the same player to buy any of the four religious buildings.

The real problem is the unlikelihood of getting the ability to purchase more than two of the religious buildings via the mechanics of the standard Firaxis-supplied beliefs, so it wouldn't be very often that any one player would ever be affected by the mutual exclusivity.
 
Back
Top Bottom