Confused with creating a trait.

SinniX613

Warlord
Joined
Jun 27, 2011
Messages
105
Location
Ontario, Canada
I'm looking at the Civ5Traits.xml trying to find which one to use, but I cannot figure it out.

I want to create a trait that gives +1 food to improved tiles with animals (deer, cattle, sheep, horses, etc)

Possible?

Sorry if this is a dumb question, new to this. :)
 
It's very simple: you can't just do it outright.

Okay, it's not that simple. There are a few things you need to know:
1> You can't add new XML functions. If there aren't stubs for it in the existing file, you can't do it. Since there are no tables in the Traits file that mention Improvements, you can't key off of those, and none of the Resource-related tables will do what you want.
This is the point at which most people stop and try coming up with something else. In general, you need to structure your ideas around what the game is capable of, NOT the other way around; 90% of the ideas people throw out on these boards cannot be done in the current environment.

2> Okay, you CAN add new XML stubs, if you create the Lua code to use it, yourself. This has some obvious problems when Yields are involved; it basically won't work the way you think. Generally you should avoid this, but it's possible.

3> Try thinking of it a bit differently. You CAN do what you're asking (add a yield if a resource is improved nearly) to a Building; look at the Mint, Forge, Stoneworks, etc. as an example. So just do one of the following:
A> Add a custom building to every city you found, with this effect. This can either be done through Lua or through creating a new Building Class unique to your civ with FreeStartEra="ERA_ANCIENT" so that every city you make will have one.
B> Add this bonus to the UB for your civ. If the UB is early enough in the tech tree, it's basically the same as giving it as a trait. So maybe your civ uses an alternate version of the Monument that, besides adding Culture, also adds +1 food per (cow, deer, etc.).
Note that this is a pretty huge effect you're proposing, though. That sort of growth bonus makes a huge difference in the early game; the limiting factor on things like the Russian strategic +production bonus is that by the time most strategics reveal themselves, you're getting tons of production from other sources; adding food to something that's there on turn 1 isn't the same. So you want to be careful with putting it on an early building.
 
Yea, after some reading through XML files it became pretty apparent that Custom Buildings would be the way to go. Unfortunately I can't even get my new Civ to show up in-game, so now its' traits are the least of my concerns :(

Might have to put the UB in Classical Era or something, to avoid overpowering the Civ.
 
Unfortunately I can't even get my new Civ to show up in-game, so now its' traits are the least of my concerns

Attach the files you have so far to your post, and I'll take a look at it. Chances are it's something trivial, like a typo in the XML or a VFS error on whatever icons you're trying to add.
(If it's an XML error, you can usually see those simply by looking in the xml.log file in your user directory, assuming you've turned on logging. But not every XML error does this.)
 
Thanks for your help; I just included XML files, I have art files too.

You should also include the .modinfo file. That's the only way to make sure the VFS and load commands are being set correctly. But in the meantime I'll look at your XML.
 
From the database.log file

Code:
[9076.468] table Civilization_Start_Region_Priority has no column named Region_Type
Which if you fix that, your Civ will be available.

You'll then get one more error

Code:
[9300.578] Invalid Reference on Civilization_CityNames.CityName - "TXT_KEY_CITY_NAME_AURORA" does not exist in Language_en_US

There is also a missing text key that is needed for the Civ "splash" screen
 
Found a mistake in the Civilization XML - still not working though. I had TXT_KEY_CIV_WYANDOT_HEADING_1 instead of TXT_KEY_CIV5_WYANDOT_HEADING_1

Edit: Wow, as if I missed that. Thanks whoward69! Sorry for wasting your time Spatz, haha. :(
 
<Civilization_Start_Region_Priority>
<Row>
<CivilizationType>CIVILIZATION_WYANDOT</CivilizationType>
<Region_Type>REGION_FOREST</Region_Type>
</Row>
</Civilization_Start_Region_Priority>

That's what I have, am I missing something here?

Edit: Never mind I see the _ where it shouldn't be.
 
Okay, at first glance here's what I've found beyond the Region thing he mentioned:

1> In your Civilization file, you give your civ Animal Husbandry, but not Agriculture. I doubht that'll cause it to fail outright, but it's probably not a good idea.

2> Also in the Civilization file, you have your list of city names. While none of them obviously jump out as duplicate, you should try to do something unique to make sure there are never conflicts with other mods. For instance, if some other mod also added TXT_KEY_CITY_NAME_MANTLE, and it was loaded before yours was, then your entire file would fail to load. (That's what happens when text keys conflict: the entire file containing the second attempt is thrown out.)
The easy way to avoid this is to name the key something like TXT_KEY_SPATZ_NAME_MANTLE, something unique to your mod. If, by sheer chance, some other mod also uses that city name then you'll see both on the map, which is unfortunate, but that's far less of a problem than a mod failing to load.

3> In your text keys, specifically TXT_KEY_CIV_WYANDOT_TEXT_1, you have an exponent ("40,000 m^2"). I have no idea if Civ5's engine can handle superscripts like that. You should try rephrasing it to "40,000 square meters".

Other than those I didn't see anything obviously wrong, and none of those three should cause it to fail outright, which makes me think that it's more likely a VFS-type issue.

EDIT:
Yep, there's a VFS issue. You have to set "Import into VFS" TRUE for all .dds files, or they won't ever load.
 
Thanks Spatz, apparently I had many more mistakes than I thought. First mod, expected I guess. :)

I'll correct these and try again.
 
The VFS is the killer. The problem is that if you've been using something like Kael's guide, it won't mention anything about that system since the guide was written last September and the VFS change was made in the December patch.

It's trivial to fix; in ModBuddy, just right-click on the DDS file and select Properties. It'll open up a small window, the bottom line of which should say Import into VFS. This needs to be set True for:
> Any new art assets (including your .dds files)
> Any non-Gamedata XML that replaces an existing file (mostly art definition files for custom unit graphics)
> Any Lua that replaces an existing file (like AssignStartingPlots.lua).

It should stay false for everything else. So in your case, just set it to true for all of your .dds files and they'll load correctly.
 
Done, but to no avail. WTH did I do now. :( Haha

I'll post updated MOD ... how do you get your logs to keep information?
 
how do you get your logs to keep information?

Go into your user directory. In Windows 7, for instance, that'll be My Documents/My Games/Sid Meier's Civilization 5/ ; this'll be the directory where your mods and custom maps are installed.

One of the files in that directory will be config.ini. Open that up in a text editor.

First, set EnableTuner=1. This turns on FireTuner. If you've been modding for any length of time then you probably already have that one turned on, but it's essential.

Lower in the file, in the [Debug] section, are a series of logging flags. MessageLog, SynchLog, AILog, and so on. Make sure you set LoggingEnabled = 1, and then set any others you want to use to 1 as well. I think MessageLog is the one that really matters, but the others have their own uses depending on what you're trying to mod.
 
------------------------------
[58972.371] **** Validating Game Database *****
[58974.274] Performing Localization Checks
[58974.274] Checking Tag Format...
[58974.274] Note: Tags must only use [A-Z_] characters, start with 'TXT_KEY_', and be under 128 characters long.
[58974.305] Validating UnitGameplay
[58974.305] Number of selection sounds doesn't match number of units.
[58974.305] Validating Notifications
[58974.305] **** VALIDATION FAILED *****
[58974.305] Validation Took 1.928607 seconds
[58975.101] **** Validating Prefetch Process *****
[58975.101] **** Validation Success *****
[58975.101] SetGlobalActionInfo
[58975.101]
-- SQLite Memory Statistics --
Memory Usage:
[Cur] [Max]
Malloc: 353360 2383768
PageCache: 3265 4982
LookAside: 903 2722
Scratch: 0 1

Static Buffer Overflows:
[TooLarge] [NoSpace]
PageCache: 0 109040
Scratch: 0 0

Largest Allocations:
Malloc: 65280
PageCache: 1160
Scratch: 5128

Prepared Statements:
Current: 19
------------------------------

Not quite understanding what it's saying here in Database.log.
 
That lot is "normal" and can be ignored.

Code:
[58974.274] Note: Tags must only use [A-Z_] characters, start with 'TXT_KEY_', and be under 128 characters long.
This is a "reminder" and is quite useful when you make a text key of "TXT_KEY_NEXT-TURN" and it complains about it (it doesn't like the -)

Code:
[58974.305] Number of selection sounds doesn't match number of units.
[58974.305] Validating Notifications
[58974.305] **** VALIDATION FAILED *****
Not even the dev's remove all their errors ;)
 
I'm lost then, I can't find any other mentions of errors and my Civ still doesn't show up. :(
 
Back
Top Bottom