Mod to change City Specialization

I'm trying to create a mod to allow the player to change a city's specialization - for example from a Conclave to a Fortress - but I can't figure out how to do it.

My initial thought is to do it through an improvement.

The relevant XML seems to be the following, found under the "CityHub1" improvement:

<GameModifier>
            <ModType>LevelBarrier</ModType>
            <Attribute>Population</Attribute>
            <Value>50</Value>
            <CityUpgrade>CityHub2</CityUpgrade>
</GameModifier>

First, its not clear to me how this XML even works, since it seems to point to "CityHub2" rather than "CityHub2_Town" for example. Where is the reference that turns a level 2 city into one of the specializations?

Second, how would I write XML for an improvement that changes the specialization? Something with <CityUpgrade>CityHub2_Town</CityUpgrade> in it? And it would also have to roll back the bonuses to research, gildar, etc. I assume.

 

Any help is greatly appreciated. Thanks

4,076 views 3 replies
Reply #1 Top

The code that turns cities into their specialization is in CoreAbilities.xml

I'm not sure how to do what you want for the second question. In addition to the special cityhubs for each type an extra building is also added, like "Fortress" if you select Fortress. I suppose you could make those (Fortress/Conclave/Town) buildable in any level 2 town and also make them mutually exclusive. However, this leaves you with the problem of having all the previous type-specific improvements still in the town - they wouldn't just vanish when you raze your Fortress building.

Reply #2 Top

Thanks for your help. It seems to make more sense now: when the city becomes level 2, it first becomes a "CityHub2", then the levelup screen gives a choice between abilities in "CoreAbilities", which then change the town to "CityHub2_Town" etc.

Is there any XML under <GameModifier> to remove improvements? More generally, is there a way to view all available tags, or do we only know by looking through what happens to be already present in the game XML files?

Reply #3 Top

Yeah, what's already being used.