Changing cost of settlers and workers

DoNotAuthorize

Chieftain
Joined
Jan 31, 2012
Messages
2
Location
DFW
Hi,

First mod for Civ V (for any game actually). I'm trying to adjust the cost of settlers workers (divide in half in all eras), along with many other units. My cost change for settlers/workers doesn't work; when the settlers/workers code is commented out, the changes for the other units do.

Searching found me this thread, but I haven't seen anything that seems to indicate the correct syntax. I feel the issue is that I'm not updating the GlobalDefines data correctly, but I have no idea what the syntax for doing that might be. When the GlobalDefines edits are commented out (as shown in my code), the other changes work fine, but for some reason uncommenting it also breaks the other changes.

Code:
<GameData>
<!--
-<GlobalDefines>
		<Update>
			<Set Value="42"/>
			<Where Name="ADVANCED_START_CITY_COST"/>
		</Update>
	</GlobalDefines>
-->
	-<Units>
<!--		
		<Update>
			<Set Cost="24"/>
			<Where Type="UNITCLASS_WORKER"/>
		</Update>
-->		
		<Update>
			<Set Cost="14"/>
			<Where Type="UNIT_WARRIOR"/>
		</Update>
		<Update>
			<Set Cost="14"/>
			<Where Type="UNIT_AZTEC_JAGUAR"/>

<!-- imagine updates for many more units here -->

	</Units> 
</GameData>
 
About Workers - the Type is not UNITCLASS_WORKER, so it should be either
Code:
Where Type="UNIT_WORKER"
or
Code:
Where Class="UNITCLASS_WORKER"

Also, why there is a - before <GlobalDefines> and <Units>?
 
A few additional things.

1> There's no such table as <GlobalDefines>. The entries in the global definition file are all in the <Defines> and <PostDefines> tables. The one you're modifying is in <Defines>. Remember, in XML the name of the file is completely irrelevant.

2> The equation the game uses for settler cost involves more than just ADVANCED_START_CITY_COST. It also depends on NEW_CITY_BUILDING_VALUE_MODIFIER and ADVANCED_START_POPULATION_COST.

Basically, the equation for determining the cost of a Settler is
(A + B + C) * D, where
A = ADVANCED_START_CITY_COST,
B = ADVANCED_START_POPULATION_COST * the extra population given to a new city
C = (1.0 + NEW_CITY_BUILDING_VALUE_MODIFIER/100) * the total Cost of every building given for free in the new city
D = The ConstructPercent value for the Era you started in, divided by 100. (This affects all units equally.)

So you've cut A in half, which'll halve the cost of making a Settler in an Ancient Era start, but do almost nothing for Settler costs for games starting in later eras since most of their cost is tied up in the fact that the new cities start at sizes higher than 1 and come with all sorts of free buildings.

3a> You claim you're cutting the price of workers in half, but the standard worker costs 70. 24 is not half of 70. (If you were playing on Chieftain with a standard map size, it'd probably list the cost as 48 in-game, but that's not the cost you're modifying here.)
3b> Similarly, the Warrior and Jaguar normally cost 40, and you're reducing that to 14.

Remember, the value it says in-game for the cost will be adjusted for difficulty, start era, map size, and so on. If you want to cut it in half then you need to use the value inside the database file as your baseline, because otherwise your 24 will become 17 in-game.
 
Ah. Thanks for the info! I'll work with that.

@PowelS: that was my error I think when modifying from a copy of the unit template--grabbed the wrong thing for the worker, the class instead of the type. The - before I don't know about--I feel like it was there when I copied it?

@Spatzimaus: The full idea of what I'm trying to do is make marathon-length games a bit more interesting. I like the idea of marathon-length games, but I feel like the implementation just causes you to sit around with little to do, pressing the next turn button a lot. To cure that, my goal is to make it possible to build and battle with armies from each time period--if I don't reduce the cost significantly, I feel that by the time I have a good-sized army I'm about to finish tech that makes it obsolete. I know the Warrior & Jaguar Warrior are normally 40; my goal is to make early-game units cheaper proportionally at 1/3 cost, mid-game units 1/2 cost, and mid-late units 3/4 cost (mechs, stealth jets and missiles I'm leaving at full cost).

The settler/worker I feel are trickier. I want the settler to be cheaper overall, but not at the same proportion of units of the tech period--so if it normally would take 56 turns to build (:eek2:) it would only instead take 35 or so, whereas a Warrior might take 10 instead of 30...ish. The worker should be similar.

Just so you know, I've never bothered starting at any tech period other than ancient, so I'm not super-concerned about the effect on starting in other eras. I just want the gameplay to feel right as I tech through all of them. I probably won't, I like ancient tech and medieval tech a lot--more than modern, certainly.

I'll play around with it using those settings.

Thanks again for the help guys!
 
@Spatzimaus: The full idea of what I'm trying to do is make marathon-length games a bit more interesting. I like the idea of marathon-length games, but I feel like the implementation just causes you to sit around with little to do, pressing the next turn button a lot.

The problem is that the method you're looking at just won't do this very well. Making a flat reduction to the production cost of each unit just means that the AI will make far more of them in relation to building infrastructure, because of how the Flavor system works. But since you're not also changing the unit maintenance equation, the AIs will quickly go bankrupt from all of the units they're trying to support, and even altering how warlike the AIs are really won't fix that.

There are a lot of things like this; the game's balance is very interwoven. You can't just drastically change one part and expect the rest to still balance out. If you drastically increase the number of units on the map, it'll affect things like:
> Barbarians. You're making it far easier for each empire to flood its land with units, so what hope do the Barbarians have of being a threat? And with units covering the map, there'll be nowhere left for Barbarian camps to spawn.
> Strategic resources. If you make units much cheaper, then the units that require resources will now be only a tiny part of your army; the advantage will really go to those civs whose UUs require no resources.
> Skirmish warfare. Units that specialize in hit-and-run tactics, like the Horseman and its descendants, get a lot less useful once your opponent just has a wall of foot units walking towards you, especially if those units are resourceless, like... spearmen and pikemen?
> Counter units. If every late-game unit is within spitting distance of an AA gun or SAM, then it becomes pretty much impossible to do anything with air units. The same goes for most counter combos like spears-vs-horses; with larger militaries covering the same amount of land, it's considerably more likely that any horseman left near the frontline will get killed by a spearman on the opponent's turn. The worst part of this is that the AI doesn't think this way, so it's a significant advantage to the player.
> Ranged attacks. Before I might have had 1-2 archers that could reach your nearby unit, but now it might be 4 or 5. Given that every fight deals a minimum of 1 damage to defender, it becomes very easy to set up a kill zone that just obliterates every good unit the AI sends at you. It's bad enough in the vanilla game where a smart human can put 7 or 8 bombers in a city and pound down nearby enemies one at a time; if that applies now to range-2 units, it's hopeless for the AI.
This doesn't even apply only to ranged units; the human's considerably better at making multiple melee attacks against a single foe to kill it, instead of spreading the damage across multiple foes. You'd just make that worse.
> Policies. What's the point of picking the Honor tree if you're just cranking out tons of untrained units to get the same effect (and with the previously mentioned Barbarian issues)? And why bother with a Freedom policy that gives you a measly 8 free units?
> Pillaging. Normally if you want to pillage an opponent's improvements, it costs you in that you're leaving a unit inside enemy territory, where your opponent has significant advantages, to deal damage instead of wounding units or fortifying. If you can send in a human wave, then it becomes trivial to burn everything.
> City capture. Cities only have 20 hit points and deal a set amount of damage based on their strength, and if you can throw three times as many units at them then they'll be captured much more quickly (again, minimum 1 damage per fight); attrition becomes a non-issue, since you can simply move wounded units out of the way to make room for fresh troops. In fact, if the opponent finishes off a wounded unit, it makes your job easier as you now have an extra hex to move into!

The list goes on; I really COULD do this all night. The balance in Civ5 is very, very fragile. A large, unilateral change to one aspect of the game will just destroy what semblance of balance remains.

Also, if you're going to do an across-the-board change, like reducing costs by a fixed fraction, it's FAR better to use SQL. Think about it; you might have changed the Warrior and Jaguar to cost 14 instead of 40, but what happens if there's a DLC adding a civ with its own UU alternative to the Warrior? It'll stay at 40. So either do the reduction by some more generic variable (unit class, tech prerequisite, era) or use SQL.

Just so you know, I've never bothered starting at any tech period other than ancient, so I'm not super-concerned about the effect on starting in other eras.

If you're ever considering publishing this mod so that someone other than yourself can use it, then you do need to be concerned about this. If it's purely for your own use, then go right ahead.
 
"Avanced cost" is the gold cost?

No, it's the cost in hammers, assuming no adjustments for era, game speed, or map size. The "advanced" part refers to the fact that to start in a later era (which is normally the only way to trigger those extra costs) you go through the Advanced Setup menu. Depending on your mod it IS possible to have those extra costs apply even in an Ancient start (if you tell it, in the Eras file, to start each city with extra population or if you give some unit a FreeStartEra of Ancient).

Obviously the gold cost is proportional to the hammer cost.
 
If you want to modify the settler cost in Civ 5 it is very easy. Simply go into CIV5Units data file where all the XML data files are stashed scroll down to the <Class>UNITCLASS_WORKER</Class> once there copy the line saying <Cost>70</Cost>, very very important make sure you copy the empty tab space leading up to the statement <Cost>70</Cost>. Then paste the blank tab space and the cost statement in a new blank area you will creat by pressing a return after the <Type>UNIT_SETTLER</Type> line in the settler section. Should look something like this:
<Cost>14000</Cost>
The reason I jack up the price is that it prevents city sprawl thyat slows down the game you can adjust the cost downwards or upwards. You can also modify the number of settlers each country starts out with to enable them to start up with a few cities immediately before settlers cost a very amount to produce
 
Back
Top Bottom