How do I use the Update Method on GlobalDefines.xml?

Sayounara

King
Joined
Nov 24, 2002
Messages
701
Location
Eastern Canada
<Row Name="MIN_CITY_RANGE">
<Value>2</Value>
</Row>


^ How do I update this? There's no 'where type' like in kael's example of modifying a buildings or resources
 
<Defines>
<Update>
<Set Value="Blah" />
<Where Name="Min_City_Range" />
</Update>
</Defines>

Easy way to figure it out is look at the Row Name, others will have Row Type or Row UnitClass, or Row UnitType ETC
 
<GameData>
<!-- TODO: Insert table creation example here. -->

<!-- TODO: Insert table data example here.-->

<!-- Enter your Game Data here. -->
<Defines>
<Update>
<Set Value="1"/>
<Where Name="MIN_CITY_RANGE"/>
</Update>
</Defines>

</GameData>

Wait... it didn't work. The mod stopped showing up after I clicked build.
 
Yea i have that problem, sometimes i have to hit build a couple times and recheck...
 
If you're only updating existing data, it's much quicker and easier to use sql. Make an sql game rules file, and write:

Update Defines set Value="1" where Name="MIN_CITY_RANGE";

That's all it needs, instead of writing all those set/where xml lines.

If you want to know how to use sql, type 'update sql' into google and look at the w3c schools pages. There's tons of info and it's a piece of cake to learn the basics (you don't need the advanced sql stuff to mod civ 5).

The real advantage of sql is you can do many updates to various rows in a single line. For example:

Update Leaders set VictoryCompetitiveness="10", Boldness="10", WarmongerHate="10", WorkAgainstWillingness="8";

That would set every leader in the game into a hyper competitive nutter. (it affects all leaders because I omitted the where clause)

It's also much easier to write complicated clauses, like so:

Update Units set Cost=Cost*0.65 where Combat>0 and Cost>0;

This would make all military units cost 65% of normal to build/buy. Note how I'm using the Cost field as a variable in a calculation? You can't do stuff like that in the xml system.

Happy SQLing :)
 
Back
Top Bottom