Increase unit production cost with trait?

Shockz

Chieftain
Joined
May 6, 2006
Messages
5
Hey, all; first post here. (EDIT: Or not? I guess I popped in here once or twice back in the Civ 4 days...) I'm new to Civ 5 modding, but I'm so far finding the experience to be a hell of a lot of fun. My first project is an added civilization; not going to go into details about it yet but let's just say it's inspired by some of ViceVirtuoso's recent releases. ;)

Anyway, now that I've gotten most of the XML and SQL fiddling done with this project, I'm about to dive into figuring out Lua. I've been looking through the API reference on the modding wiki before I start writing any code, and...I'm not seeing any way to implement part of the UA/trait idea I had. Essentially, I want to make all military units cost 10% extra production for this civ. I'm seeing functions that can access production speed modifiers for units, but no way to actually change those modifiers. Nor do I see any obvious way to directly modify the production cost for a unit, at least not for a single civ. There's always the solution of creating a whole bunch of unique units with the same stats as their base but an increased production cost, of course, but that seems like an excessively roundabout way of doing it.

Is there any simple way of doing this, either in XML/SQL or Lua? Thanks.
 
It could potentially be rather simple with XML, but it would require the Ancient Wonders DLC.

You could give every city in your civ a dummy building (using <FreeBuilding> in their trait entry) that has a replication of the ToA's code:

Code:
<Building_UnitCombatProductionModifiers>
	<Row>
		<BuildingType>BUILDING_TEMPLE_ARTEMIS</BuildingType>
		<UnitCombatType>UNITCOMBAT_ARCHER</UnitCombatType>
		<Modifier>15</Modifier>
	</Row>
</Building_UnitCombatProductionModifiers>

You'll need to change the name of the building obviously, change the 15 to -10, and make an entry for every unitcombat you want to be affected. (Which I assume is all of them)
 
The Building_UnitCombatProductionModifiers table is part of the base game (all versions) , you don't need the DLC
 
Top Bottom