[MyOwnStupidity] Local Data Does Not Level Cities

I have switched to /localdataonly and there are some bugs here that are not in the server data files. I am pretty sure the code has no way to upgrade a level 1 cityhub to a level 2 cityhub specialization. The file currently upgrades to a generic cityhub2 and the population upgrade specifies a cityhub3, which, as you know, no longer exists. You need the level 1 to upgrade to level 2 from the special city improvement. Have CityHub2_Town as an "upgradestoimprovement" tag. Then add "requiresimprovement," 1 as well as "requiredimprovement," TradeGuild (the internal name for Town). That should make the level 1 city upgrade to a level 2 city town naturally. I have no way of knowing what the internal code uses, but this is how it should look in the xml on our side. 

This is low priority, but I am sure we all want the local data to work like the server data. When you get a chance, this is the ideal way to do it. No need to have a generic level 2, which seems to still be in the code as well. It doesn't need to be there in my version of the upgrade system.

4,080 views 8 replies
Reply #1 Top

No no no, I don't think this is right. You are right that cityhub1 links to cityhub2 which links to cityhub 3. But when you get to first level-up the game switches the core cityhub to _fortress _conclave _town which is then upgraded instead. This is from a fresh 0.980 coreimprovements.xml file. The xml does look shitty but I see no bug in-game - city levelups work.

Reply #2 Top

What code causes the change?

Reply #3 Top

The Hardcode I guess. Edit: Well this obviously causes the city level-up screen:

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

 

 

I have a mod that puts this in all _fortress _conclave _town and "cityhub1" only:

   <GameModifier>
      <ModType>City</ModType>
      <Attribute>AdjustDefendingUnit</Attribute>
      <StrVal>ExpandedTraits_FLAG_DefendingCity</StrVal>
      <Value>1</Value>
    </GameModifier>

It is always present, which to me indicates that "cityhub2" never actually exists (or rather it disappears as soon as you make your choice).

Reply #4 Top

Nope, it's in CoreAbilities.xml, not hardcoded.

        <AbilityBonusOption InternalName="UnlockFortress">
            <DisplayName>Fortress</DisplayName>
            <Description>Enables Fortress improvements and increases the level of units trained here by 1.  Select this to dedicate your city to defense and military pursuits.</Description>
            <Icon>K_Fortress_Thumb_02.png</Icon>
            <GameModifier>
                <ModType>City</ModType>
                <Attribute>UnlockImprovement</Attribute>
                <BoolVal1>1</BoolVal1>
                <StrVal>Fortress</StrVal>
            </GameModifier>
            <GameModifier>
                <ModType>City</ModType>
                <Attribute>SwapCityHubType</Attribute>
                <StrVal>CityHub2_Fortress</StrVal>
            </GameModifier>
            <HideWhenUpgraded>0</HideWhenUpgraded>
            <Likelihood>400</Likelihood>
            <RarityDisplay>Common</RarityDisplay>
            <RequiredLevel>2</RequiredLevel>
            <AIData AIPersonality="AI_General">
                <AIPriority>5</AIPriority>
            </AIData>
        </AbilityBonusOption>

 

 

 

Anyway, the 0.980 localdataonly xml is sound. If there's an issue I'm afraid it is not with their xml.

Reply #5 Top

My point is that the code making the change is hardcoded, when it doesn't need to be. The xml already exists to do it. It is the same code we use for Command Post upgrading to War College or Warrior Temple. At some point the hard code should be deleted and this method should be used. Low Priority, but much cleaner.

[Edit] You posted while I posted.

Reply #6 Top

Good to know. The swap hub type is superfluous, but that is the difference. They could have done it my way and saved some time. Now that we have swap as xml, some modders could make a mod that allows type swapping. I guess overall it works out great for us.

Reply #7 Top

I looked at your balance [.004] mod and your level 2 city choices do not have the xml to change the cityhub. Are you sure that is not interfering? It would probably cause exactly the kind of error you are describing.

Reply #8 Top

It does, I guess this thread will just be me and you now.   ;)    I must have accidently mixed up my abilities file with theirs. Damn this befuddled mind!

 

I have each hub require a fortress, town, or conclave to upgrade. I should work the same, but I don't have time to test it for awhile. If I can't get the city to automatically upgrade, I have a few ideas on how to do it. "AutoUnlock" may work for upgrades. If not, I will just do it their way. I'll post again once I have it solved.