Need help adding a trait, PLEASE

billia

Chieftain
Joined
Feb 16, 2013
Messages
28
I've got everything else for my mod completed. But I'd like to add a custom trait. I was thinking about something along the lines of a science enhancer. Maybe: "Down To Earth": Each citizen prodcues +3 science.


Any help on how to do so?

Moderator Action: Moved to appropriate forum.
 
Now I'm just trying to get the trait to do something a little simpler. I want the trait to give a simple boost to tech precent. For example, the Porcelain Tower gives the entire civ 25% faster tech production. I was hoping to learn how to do this with a leader trait.
 
I've got everything else for my mod completed. But I'd like to add a custom trait. I was thinking about something along the lines of a science enhancer. Maybe: "Down To Earth": Each citizen prodcues +3 science.


Any help on how to do so?

Moderator Action: Moved to appropriate forum.

Totally doable. That would be handled in this section <Trait_SpecialistYieldChanges></Trait_SpecialistYieldChanges>

The trait for Korea uses this mechanic and does exactly what you want, but only gives 2 science and not 3.

Code:
<Trait_SpecialistYieldChanges>
		<Row>
			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
			<SpecialistType>SPECIALIST_ARTIST</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
		<Row>
			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
			<SpecialistType>SPECIALIST_SCIENTIST</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
		<Row>
			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
		<Row>
			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
			<SpecialistType>SPECIALIST_ENGINEER</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
</Trait_SpecialistYieldChanges>

Assuming you mean unemployed citizens and not specialists, the change would look like:

Code:
<Trait_SpecialistYieldChanges>
		<Row>
			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
			<SpecialistType>SPECIALIST_CITIZEN</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
</Trait_SpecialistYieldChanges>

Hope this helps!
 
Now I'm just trying to get the trait to do something a little simpler. I want the trait to give a simple boost to tech precent. For example, the Porcelain Tower gives the entire civ 25% faster tech production. I was hoping to learn how to do this with a leader trait.

I believe The Porcelain Tower gives +50% from Research Agreements, not overall faster tech production.
 
Totally doable. That would be handled in this section <Trait_SpecialistYieldChanges></Trait_SpecialistYieldChanges>

The trait for Korea uses this mechanic and does exactly what you want, but only gives 2 science and not 3.

Code:
<Trait_SpecialistYieldChanges>
		<Row>
			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
			<SpecialistType>SPECIALIST_ARTIST</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
		<Row>
			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
			<SpecialistType>SPECIALIST_SCIENTIST</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
		<Row>
			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
		<Row>
			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
			<SpecialistType>SPECIALIST_ENGINEER</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
</Trait_SpecialistYieldChanges>

Assuming you mean unemployed citizens and not specialists, the change would look like:

Code:
<Trait_SpecialistYieldChanges>
		<Row>
			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
			<SpecialistType>SPECIALIST_CITIZEN</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
</Trait_SpecialistYieldChanges>

Hope this helps!

I tried the second one in my traits.xml but it didn't appear to work... I had it coded like so:

Code:
<Trait_SpecialistYieldChanges>
		<Row>
			<TraitType>TRAIT_INNOVATION</TraitType>
			<SpecialistType>SPECIALIST_CITIZEN</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
</Trait_SpecialistYieldChanges>

I suppose I should have mentioned that I'm using vanilla. Also, could it be something in the Leader and game text xml's? I changed the leader to be using innovation and I also wrote in the tet for it in the game text. It appeared in game and it seemed fine until I actually started playing. I even waited until two or three citizens were born just to make sure it wasn't a glitch. Am I looking at the wrong thing in-game?
 
Figured it out. I was looking for the change to take place with EMPLOYED reather than UNEMPLOYED citizens.
 
Absolutely.

Alright, my question now is:

How? haha. I can write in the right tags. But it doesn't seem to take affect.

For example, I'd like the Battle fury trait from Kaels guide as well as one that I created myself.

On it's own, the one I created works fine. How might I add the other one?
 
You can just add in the relevant code alongside your existing code in the Trait section. I think Kael's version uses a free promotion, doesn't it? So you'd have a YieldChanges section, and a FreePromotions section in the same Trait.
 
You can just add in the relevant code alongside your existing code in the Trait section. I think Kael's version uses a free promotion, doesn't it? So you'd have a YieldChanges section, and a FreePromotions section in the same Trait.

The only problem with that is that it's not working, lol.

Code:
<GameData>
	<Trait_FreePromotionUnitCombats>
		<Row>
			<TraitType>TRAIT_INNOVATION</TraitType>
			<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
			<PromotionType>PROMOTION_SECOND_ATTACK</PromotionType>
		</Row>
		<Row>
			<TraitType>TRAIT_INNOVATION</TraitType>
			<UnitCombatType>UNITCOMBAT_ARCHER</UnitCombatType>
			<PromotionType>PROMOTION_SECOND_ATTACK</PromotionType>
		</Row>
		<Row>
			<TraitType>TRAIT_INNOVATION</TraitType>
			<UnitCombatType>UNITCOMBAT_GUN</UnitCombatType>
			<PromotionType>PROMOTION_SECOND_ATTACK</PromotionType>
		</Row>
	</Trait_FreePromotionUnitCombats>
	<Traits>
		<Row>
			<Type>TRAIT_INNOVATION</Type>
			<Description>TXT_KEY_TRAIT_INNOVATION</Description>
			<ShortDescription>TXT_KEY_TRAIT_INNOVATION_SHORT</ShortDescription>
		</Row>
	</Traits>
	<Trait_SpecialistYieldChanges>
		<Row>
			<TraitType>TRAIT_INNOVATION</TraitType>
			<SpecialistType>SPECIALIST_CITIZEN</SpecialistType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>5</Yield>
		</Row>
	</Trait_SpecialistYieldChanges>
</GameData>
 
Any errors in database.log?

If not, when you load the mod (you don't even have to start the game, just make sure the mod is selected in the mod dialog, then click next), check the databse (Civ5DebugDatabase.db) using SQLite Manager (firefox extension) or SQLite Spy (standalone program) and make sure your entries are there in the table.
 
The log came up with nothing...

I have sqlite, but I'm not quite sure how to read it's contents. I did waht you said but I didn't get mush out of it. After hitting the "next" button, I minimized and ran sqlite. I couldn't even find my civ in there. Yet, the civ, itself, works...
 
There is a table called Civilizations. Your Civ should be listed in there.

(also, make sure you're opening CIV5DebugDatabase.db, and not Civ5CoreDatabase.db).

Also, for example:

http://i.imgur.com/hRaXYQU.png

Notice how I'm looking at the Trait_FreePromotionUnitCombats table. Now look at your example code that you posted.

Each of those "Sections" corresponds to a table in the database. So, inside your FreePromotion section, you are adding rows for your new trait. Once you enable your mod, your new rows should be listed in that table.

If they aren't there should be an error in database.log. If there's not an error, then you may not have logging enabled.
 
There is a table called Civilizations. Your Civ should be listed in there.

(also, make sure you're opening CIV5DebugDatabase.db, and not Civ5CoreDatabase.db).

Also, for example:

http://i.imgur.com/hRaXYQU.png

Notice how I'm looking at the Trait_FreePromotionUnitCombats table. Now look at your example code that you posted.

Each of those "Sections" corresponds to a table in the database. So, inside your FreePromotion section, you are adding rows for your new trait. Once you enable your mod, your new rows should be listed in that table.

If they aren't there should be an error in database.log. If there's not an error, then you may not have logging enabled.

Thank your the info to getting to the right place. However, the entries ARE in the debug database.

In game, what is the promotion supposed to look like? I can take the archer for example and use it to attack an enemy, but after the first attack, it's out of moves... Shouldn't the promotion allow that action twice?

EDIT: Just realized I was testing in a saved game that was started before adding the newest trait... Could that cause the issue?
 
EDIT: Just realized I was testing in a saved game that was started before adding the newest trait... Could that cause the issue?

I'm not 100% sure, but probably.

Anyways, whenever you build a unit, there is a bar in the Unit panel (where moves, HP, etc are listed) that lists all the promotions on the unit. It should show up there.
 
Try it first adding PROMOTION_BARRAGE_1 - the Archer is definitely qualified for that, and it will definitely show up as a promotion on the Archer (some can be invisible) if it has it, and you can be sure there are no data errors or anything.

If that works, the issue is with your Promotion; if not, it's not even trying to add the promotion.
 
Okay, I think I've figured it out... Beggining to worry that I had some kind of error that couldn't be fixed, I removed the trait that wasn't weorking from the xmls. I built the mod and then tested to see if the one that WAS working, still worked. It did. Then, I added the new trait back in, built the mod and started the game. strengely, this solved the issue....

Thank you everyone for helping me fix this!
 
Top Bottom