Modding - How to update an XML file that can't be updated normally?

Chamale

Chieftain
Joined
Sep 12, 2013
Messages
6
I'm trying to make a mod that changes the in-game calendar. I've made mods before that change aspects of gameplay, and I know how to update xml files with lines like:

<Set Range="1"/>
<Where Type="UNIT_CHINESE_CHUKONU"/>

This works when a type of variable only has one value assigned to it. But I'm trying to mod Civ5GameSpeeds.xml and I have a problem - there are many numbers marked MonthIncrement and TurnsPerIncrement, which are read in chronological order, all as part of "GAMESPEED_STANDARD". For instance:

<Row>
<GameSpeedType>GAMESPEED_STANDARD</GameSpeedType>
<MonthIncrement>480</MonthIncrement>
<TurnsPerIncrement>75</TurnsPerIncrement>
</Row>
<Row>
<GameSpeedType>GAMESPEED_STANDARD</GameSpeedType>
<MonthIncrement>300</MonthIncrement>
<TurnsPerIncrement>60</TurnsPerIncrement>
</Row>

I'm not able to update this in xml, because multiple values correlate to GAMESPEED_STANDARD! I've modified the actual gamefile to verify that I can modify the calendar, but I don't know how to make it work as a mod. I've tried simply copying the values I want and setting an action to update Civ5GameSpeeds.xml - this did not work. I've also unsuccessfully tried setting it to update Civ5GameSpeeds.xml with the following:

<GameData>
<GameSpeeds>
<Update>
<Set MonthIncrement="1440"/>
<Set TurnsPerIncrement="25"/>
<Set MonthIncrement="420"/>
<Set TurnsPerIncrement="35"/>
<Set MonthIncrement="300"/>
<Set TurnsPerIncrement="45"/>
<Set MonthIncrement="120"/>
<Set TurnsPerIncrement="45"/>
<Set MonthIncrement="48"/>
<Set TurnsPerIncrement="25"/>
<Set MonthIncrement="12"/>
<Set TurnsPerIncrement="65"/>
<Set MonthIncrement="6"/>
<Set TurnsPerIncrement="100"/>
<Set MonthIncrement="3"/>
<Set TurnsPerIncrement="100"/>
<Set MonthIncrement="2"/>
<Set TurnsPerIncrement="60"/>
<Where GameSpeedType="GAMESPEED_STANDARD"/>
</Update>
</GameSpeeds>
</GameData>

This also doesn't work. I don't know how to make these changes, which is frustrating because I just need the game to read my modified XML file with the modded data values. How can I do this, or make a mod to update the values some other way?
 
  1. You are trying to edit table <GameSpeeds> when the table you need to edit is <GameSpeed_Turns>
  2. You can only ever have one "Set" and one "Where" within each <Update>--</Update> pair, and you can only attempt to change the same Column-Name and its value once within each <Update>--</Update>.
  3. To alter the # of Years Per Turn for "GAMESPEED_STANDARD", you would want:
    Code:
    <GameData>
    	<GameSpeed_Turns>
    		<Delete GameSpeedType="GAMESPEED_STANDARD"/>
    		<!--	Now We Rebuild the Data	-->
    		<Row>
    			<GameSpeedType>GAMESPEED_STANDARD</GameSpeedType>
    			<MonthIncrement>480</MonthIncrement>
    			<TurnsPerIncrement>75</TurnsPerIncrement>
    		</Row>
    		<Row>
    			<GameSpeedType>GAMESPEED_STANDARD</GameSpeedType>
    			<MonthIncrement>300</MonthIncrement>
    			<TurnsPerIncrement>60</TurnsPerIncrement>
    		</Row>
    		<Row>
    			<GameSpeedType>GAMESPEED_STANDARD</GameSpeedType>
    			<MonthIncrement>240</MonthIncrement>
    			<TurnsPerIncrement>25</TurnsPerIncrement>
    		</Row>
    		<Row>
    			<GameSpeedType>GAMESPEED_STANDARD</GameSpeedType>
    			<MonthIncrement>120</MonthIncrement>
    			<TurnsPerIncrement>50</TurnsPerIncrement>
    		</Row>
    		<Row>
    			<GameSpeedType>GAMESPEED_STANDARD</GameSpeedType>
    			<MonthIncrement>60</MonthIncrement>
    			<TurnsPerIncrement>60</TurnsPerIncrement>
    		</Row>
    		<Row>
    			<GameSpeedType>GAMESPEED_STANDARD</GameSpeedType>
    			<MonthIncrement>24</MonthIncrement>
    			<TurnsPerIncrement>50</TurnsPerIncrement>
    		</Row>
    		<Row>
    			<GameSpeedType>GAMESPEED_STANDARD</GameSpeedType>
    			<MonthIncrement>12</MonthIncrement>
    			<TurnsPerIncrement>120</TurnsPerIncrement>
    		</Row>
    		<Row>
    			<GameSpeedType>GAMESPEED_STANDARD</GameSpeedType>
    			<MonthIncrement>6</MonthIncrement>
    			<TurnsPerIncrement>60</TurnsPerIncrement>
    		</Row>
    	</GameSpeed_Turns>
    </GameData>
    • This method first deletes everything from table <GameSpeed_Turns> related to "GAMESPEED_STANDARD"
    • Then it rebuilds the data as needed
    • Note that for sake of simplicity in the "rebuilding it" chunk I just copied the exising data and used that. You would of course want to edit the various settings of <MonthIncrement> & <TurnsPerIncrement>
 
Back
Top Bottom