Making a new trait for a CIV5 mod

SoylentRobot

Chieftain
Joined
Oct 13, 2013
Messages
4
Hey folks, I'm using Kael's modder's guide to CIV5, but I'm on a snag with making a new trait for my leader.
It's a two part trait, the first bit is much like Montezuma's but the Civ gains Science instead of Culture for each enemy unit killed. How would I go about making this? I'm guessing it's not as simple as copying Monty's trait and changing all the "culture" to "science"
The second part is that the leader can start purchasing the Rationalism policies during the Classical era instead of the Renaissance. I'm having trouble figuring out how to do this, I guess some lua coding is involved? Can anyone give me any pointers on this please?
Thanks in advance!
 
Hey folks, I'm using Kael's modder's guide to CIV5, but I'm on a snag with making a new trait for my leader.
It's a two part trait, the first bit is much like Montezuma's but the Civ gains Science instead of Culture for each enemy unit killed. How would I go about making this? I'm guessing it's not as simple as copying Monty's trait and changing all the "culture" to "science"
The second part is that the leader can start purchasing the Rationalism policies during the Classical era instead of the Renaissance. I'm having trouble figuring out how to do this, I guess some lua coding is involved? Can anyone give me any pointers on this please?
Thanks in advance!
The First part could be applied to a single unit, try to look for the codes of the Pictish Warrior in DLC/Expansion1/Gameplay/XML/Units/Units_Expansion2.xml then there is a tree there that looks like this (sory im not at my own desktop at the moment, i based this on my memory) "UnitYieldPerKill" or something like that, then there would be a "YieldType" which you may change the yield to Science instead of Culture. You could make this possible on all of your units, but you must create a UU for every Combat units in the game you could build. Pm me if you have question on the First Part :)
the Second part? I dont have any Idea, you might need a good Lua Programmer or a DLL.
 
I'm guessing it's not as simple as copying Monty's trait and changing all the "culture" to "science"
Unfortunately, no. The xml for Monty's trait does not include a <Yield> line. The xml is as follows:
Code:
<Traits>
	<Row>
		<Type>TRAIT_CULTURE_FROM_KILLS</Type>
		<Description>TXT_KEY_TRAIT_CULTURE_FROM_KILLS</Description>
		<ShortDescription>TXT_KEY_TRAIT_CULTURE_FROM_KILLS_SHORT</Description>
		[COLOR="Blue"][B]<CultureFromKills>100</CultureFromKills>[/B][/COLOR]
	</Row>
</Traits>
And there's no such line as <ScienceFromKills>. If there was, I probably would've used it quite some time ago :p
 
dang. I guess making a <ScienceFromKills> line would need a lot of coding thats above my level.
However, the Honor policy has a few abilities where you get culture from barbarians and gold from all killed units, would it be possible to reverse engineer those somehow, or would they be <CultureFromKills> and <GoldFromKills> again?

I've checked the pictish warrior code and there isn't any line like UnitYieldPerKill there
 
dang. I guess making a <ScienceFromKills> line would need a lot of coding thats above my level.
However, the Honor policy has a few abilities where you get culture from barbarians and gold from all killed units, would it be possible to reverse engineer those somehow, or would they be <CultureFromKills> and <GoldFromKills> again?

I've checked the pictish warrior code and there isn't any line like UnitYieldPerKill there

Code:
	<Unit_YieldFromKills>
		<Row>
			<UnitType>UNIT_CELT_PICTISH_WARRIOR</UnitType>
			<YieldType>YIELD_FAITH</YieldType>
			<Yield>50</Yield>
		</Row>
	</Unit_YieldFromKills>

This is of no use to you, though. It's in the Units table. Also, the policies are hardcoded, no generic yield thing.

I checked around a bit, and you're screwed if you don't want to use Lua. You're also screwed if you do. There's no way to modify beakers from Lua afaik.

It's the perfect system, right?
 
Code:
	<Unit_YieldFromKills>
		<Row>
			<UnitType>UNIT_CELT_PICTISH_WARRIOR</UnitType>
			<YieldType>YIELD_FAITH</YieldType>
			<Yield>50</Yield>
		</Row>
	</Unit_YieldFromKills>

This is of no use to you, though. It's in the Units table. Also, the policies are hardcoded, no generic yield thing.

I checked around a bit, and you're screwed if you don't want to use Lua. You're also screwed if you do. There's no way to modify beakers from Lua afaik.

It's the perfect system, right?


thats pretty bad. is it not possible to make that into a promotion to give to my units? i understand thats how certain traits work, like the amphibious trait for songhai.
 
Code:
	<Unit_YieldFromKills>
		<Row>
			<UnitType>UNIT_CELT_PICTISH_WARRIOR</UnitType>
			<YieldType>YIELD_FAITH</YieldType>
			<Yield>50</Yield>
		</Row>
	</Unit_YieldFromKills>

this is what im tryin to say on my first post, nice!

thats pretty bad. is it not possible to make that into a promotion to give to my units? i understand thats how certain traits work, like the amphibious trait for songhai.

you could, but you must make a UU out of every unit class in the game.Any way the first two UU you declare will be the one shown on the loading screen. Its possible,its just require a little time to code.
 
Alien Civilization uses a Science from Kills trait:
http://steamcommunity.com/sharedfiles/filedetails/?id=131069324
It uses the "Unit_YieldFromKills" method and it did it by making UU of ALL units that can kill stuff as suggested above. And since it was made pre-BNW, it lacks all the new "killer" BNW units.

Sample:
Code:
		<Row>
			<UnitType>UNIT_ALIEN_SCOUT</UnitType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>100</Yield>
		</Row>

EDIT 1: Hmm, maybe there is a Science from kills, "UnresearchedTechBonusFromKills" is in the BNW traits XML. There is a "FaithFromKills" too. Off to test it now.

EDIT 2: "FaithFromKills" works, I am not seeing any results from "UnresearchedTechBonusFromKills".
 
thanks for looking into it :) im going to try the huge pile of UU method. i guess this prevents me from having a unique building too, but thats not such a big deal.
 
thanks for looking into it :) im going to try the huge pile of UU method. i guess this prevents me from having a unique building too, but thats not such a big deal.

There's no reason why you can't have a unique building as well. Technically, you can have as many uniques as you want. I've created a civ, for when I feel like cheating, that gives me every other civ's Unique Building, Unique Improvement, some of their Unique Units, and most of the Unique Abilities.

In your case, the science from kills is (part of) your Unique Ability. It's just that in order to make that work you're going to have to create a bunch of "Unique Units." You can still make your real Unique Unit, along with a Unique Building, because all of those other "Unique Units" are really your Unique Ability. The only thing is, your Unique Building might not show up on the Dawn of Man screen, because I think the game fills in those two spots with UUs first, then UBs, but your UB will still work in game. There might be a way to fix it so that the UB does show up, but I don't know what it is.
 
Back
Top Bottom