Modifying Tech cost

David1107

Chieftain
Joined
Feb 12, 2011
Messages
9
I just started moding Civ5, but I can't seem to alter the tech costs.

I compiled my civ5mod file with just this in it
- <GameData>
<update>
<Technologies>
- <Row>
<Type>TECH_POTTERY</Type>
<Cost>350</Cost>
<Description>TXT_KEY_TECH_POTTERY_TITLE</Description>
<Civilopedia>TXT_KEY_TECH_POTTERY_DESC</Civilopedia>
<Help>TXT_KEY_TECH_POTTERY_HELP</Help>
<Era>ERA_ANCIENT</Era>
<Trade>true</Trade>
<GoodyTech>true</GoodyTech>
<GridX>1</GridX>
<GridY>1</GridY>
<Quote>TXT_KEY_TECH_POTTERY_QUOTE</Quote>
<PortraitIndex>4</PortraitIndex>
<IconAtlas>TECH_ATLAS_1</IconAtlas>
<AudioIntro>AS2D_TECH_POTTERY</AudioIntro>
<AudioIntroHeader>AS2D_HEADING_TECH_POTTERY</AudioIntroHeader>
</Row>
</Technologies>
</update>
- </GameData>



350 is just an example.

Any comments or help is appreciated!
 
You're doing it completely wrong.

First of all, when doing an <Update>, the update command comes AFTER the block (<Technologies>) and you don't then use a <Row> declaration.

Second, when you're updating an existing table value, you don't put any of those other variables (GridX, GridY, etc.) again. Just use SET/WHERE to change the specific values you need.

If you want to change the cost of, say, Pottery, then all you do is:

Code:
<GameData>
    <Technologies>
        <Update>
            <Set Cost="350"/>
            <Where Type="TECH_POTTERY"/>
        </Update>
    </Technologies>
</GameData>

You only do a <Row>, with all of those other fields, when adding a NEW entry to a table (i.e., adding a new technology).
 
If you want to provide a replacement row (usually more useful if doing a add-this-unless-it's-already-there) using, I think, a <Replace> or something... I forget exactly, although I've used it. There was info on it somewhere... probably the official wiki... I've used it where I want to include something in multiple mods without the one activating later failing due to duplicate unique field or whatever.
 
You're doing it completely wrong.

First of all, when doing an <Update>, the update command comes AFTER the block (<Technologies>) and you don't then use a <Row> declaration.

Second, when you're updating an existing table value, you don't put any of those other variables (GridX, GridY, etc.) again. Just use SET/WHERE to change the specific values you need.

If you want to change the cost of, say, Pottery, then all you do is:

Code:
<GameData>
    <Technologies>
        <Update>
            <Set Cost="350"/>
            <Where Type="TECH_POTTERY"/>
        </Update>
    </Technologies>
</GameData>

You only do a <Row>, with all of those other fields, when adding a NEW entry to a table (i.e., adding a new technology).



Do I need anything other than this xml before building it?
 
I am trying to double the costs of all the technology there are, is there a way to do that without doing it N times typing?

Thanks!
 
Do I need anything other than this xml before building it?
Yes. You need to go to your project's properties, go to the Actions tab, and make a row for your XML.

First column should generally be OnModActivated, second column UpdateDatabase, and the third column should be the filename of your XML (plus any folders you put it in), such as "XML/mystuff.xml" without the quotes.

I am trying to double the costs of all the technology there are, is there a way to do that without doing it N times typing?

Thanks!
Not that I'm aware of, unfortunately.
 
Yes. You need to go to your project's properties, go to the Actions tab, and make a row for your XML.

First column should generally be OnModActivated, second column UpdateDatabase, and the third column should be the filename of your XML (plus any folders you put it in), such as "XML/mystuff.xml" without the quotes.

I already did that actually but it still doesn't work. Do I click build solution or build CivMod_science?

Also I noticed that when i play it on quick, the tech cost of pottery is 23, not 35, so I think changing that number doesn't affect the game directly, and something else is required.
 
I am trying to double the costs of all the technology there are, is there a way to do that without doing it N times typing?

SQL. It's a one-line mod.

Alternatively, if you want to stick with XML, the easiest thing would be to go into, say, GameSpeeds. For each of the four game speeds there's a variable ResearchPercent which multiplies all tech costs. So you could just double those four values with four Update commands.

This is why, David1107, Pottery is 23 on quick. Quick game speed has ResearchPercent=67, so it multiplies all tech costs by 67%. Marathon is 300, so Pottery costs 105 on that game speed.

ResearchPercent is also modified by a few other factors (map size, difficulty setting), but game speed is the big one.
 
create a SQL file in Modbuddy... then add:

Code:
UPDATE Technologies SET Cost=Cost*2

much less tedious, eh?

all of the code is compiled into a single database structure, so you don't need to write anything else (thus why SQL is considered best for doing consistent changes with little code).

since you are applying a factor of 2 across all Cost (Table Fields) in the Technologies (Table), it is just that easy.

That is because the SQL Statement will apply to all qualifying conditions, and the 'WHERE' is not set, so it is considered 'ALL' and every Technology in the game can be found and modified from that one Table. The math isn't as simple, once you start assigning different technologies at different rates (different variables and all)... but there you go, for 'double' (x2) :goodjob:

*don't forget to set the OnModActivated and UpdateDatabase on that in Actions under Project Properties (same as XML)
 
Back
Top Bottom