questions on adding a new civ, leader, and trait

Mellian

.......
Joined
May 16, 2002
Messages
74
Location
Montreal, Quebec, Canada
Hello, I have acquired Civ5 game of year last week, and since then been playing and modding, already cause some late nights. :p

Soon afterwards I downloaded the SDK and played around with Modbuddy. In comparison to Civ4 modding, I find it really frustrating, with some of the things not being added to the game when the mod is activated, with no errors in modbuddy or logs (they never do aside from that included in the game).

After testing adding a new civ, added some text which for some reason causing the civ not to be included. Now trying to get a new trait to work, with no indication that it does or not, which I am thinking no as even as a test, adding huge production, food, and gold bonuses or for culture is not included.

Also appears to be some sort of limit on free units or free tech, as only recognizes and includes 1 of each, so maybe the case for traits (of that included in the game).

I have been unable to find any clear information as to what the limits are with modding, what is accepted or not, as following the tutorials leads to the same problems with text, traits, units, and such, with no errors. The mod do get activated and do get included, with some of the changes coming through with others do not. I have plenty of experience with Civ4 XML modding, as well coding in general, so not a novice.

Is these issues known? Are there a solution?

Thank you!
 
Here's the basics for getting started. Even if you think of yourself as an experienced modder, you can't skip these steps.

1> Go read Kael's modding guide. It's stickied at the very top of the References subforum. It's slightly out of date, but it should give you a good start on getting a basic mod working; for instance, the UpdataDatabase command is absolutely necessary to get a new XML mod to work, but it's not immediately obvious in the SDK.

2> Learn about the two big changes made after Kael's guide was written: the Virtual File System (VFS), and the TXT_KEY overlap issue that began in last March's patch. There are plenty of threads on each in these forums. Creating a new civilization will often trigger an error of either of these types.

3> Turn on logging. To do this, go into your config.ini file in your user directory, and change "EnableLogging = 0" to a 1. This'll cause your xml.log, Database.log, and Lua.log to spot mistakes in your code the next time it tries to load.
This is important because of the first rule of XML modding: ANY error in an XML file invalidates the entire file. This is why it's important to start small, and not put every single element of your mod into a single file.

Once you've done all of the above, then you should come back here and ask what's wrong with your mod, attaching your mod files to your post. We should be able to spot what's wrong fairly quickly, but you need to take care of the obvious stuff first. Nearly every major XML issue triggers a message in one of the logfiles listed, so you don't need us to do it all for you.

-----------------------

As to your specific questions, there are very few explicit limits on these sorts of things, except for the one obvious one: if a table doesn't have a line for something, then you can't add one just because it seems obvious that it SHOULD be able to handle it. If all of your traits and such are using only the existing tables and functions and adding nothing unusual, then they should work just fine; if they're not, then it's likely you simply mistyped something. The logfiles should catch this sort of mistake, but if they don't, then post your files here and we can look at them.
 
I read everything I could before and during my attempt in adding a new civilization, yet unable to find any specific discussion or info on VFS aside from references of it, or TXT_KEY issue maybe related to this. Yet setting LoggingEnabled = 1 in config.ini got it work, but only spouted errors for the txt stuff nothing on the new trait.

Anyway, I recreated the whole mod, re-seperated the xml file to each their own, and then notice I could change the order of which xml gets activated/loaded first, so did so. Now civilization and leader text work, and civ show up in the selection.

Now to work on the trait part of the leader to work, as it does not appear to accept more than one leader trait at the time when adding multiple of them from other leaders, yet does for one. Also no errors in the logs for them.

Where is the TXT_KEY_TRAIT text located in the assets? Does not appear to be in any of NewText files.

Thank you!
 
I read everything I could before and during my attempt in adding a new civilization, yet unable to find any specific discussion or info on VFS aside from references of it, or TXT_KEY issue maybe related to this.

VFS basically boils down to this:
> If it's a GameData XML or SQL file, you load it with the OnModActivated/UpdateDatabase command.
> If it's an executable Lua file that you've created, you load it with InGameUIAddin or something similar.
> For ANYTHING ELSE, you need to set VFS to True. (Right-click on the file, select Properties, and the last item in that window will be "Import into VFS". Default is False.) This is used for art assets (DDS files, MP3 files, any unit graphic files), Lua functions that are included inside other files, or any modifications of the core game's non-gamedata XML or Lua files.

The TXT_KEY issue isn't related to the VFS, it just happened to come into being at around the same time. What happens is that if a text key is defined twice, whatever file has the second instance of it will fail entirely. This comes up most often with custom civs, where you might declare a city name that the core game (or a DLC) is already using for some other city or city-state. So when you're modding, it's safest to make all of your text keys be unique; instead of TXT_KEY_CITY_NAME_SEOUL, do TXT_KEY_CITY_NAME_SPATZ_SEOUL or something similar to make sure there's no conflict with anything in the core game, a DLC, or some other mod.

and then notice I could change the order of which xml gets activated/loaded first, so did so.

No, order of XML loading is NOT important; there's no dependency logic in the serializer, and it doesn't do anything with the data until it's all loaded. If it's dropping one XML file for errors, it should be telling you why in either the xml.log or Database.log files; splitting the XML into multiple files is what made the difference, since the game ignores any file containing an error in its entirety. The order is meaningless.

There's a couple things to realize when reading those logfiles:
1> The game checks the database TWICE. The first check is when you start the game up, and it checks the unmodded database; the second is when your mod loads. So if you opened up the logfile and saw only one block of errors, then you opened it too soon and need to come back after the mod loads, at which point the second block will say what went wrong in your mod.
2> Some errors won't register in the logfiles at all. For instance, if you delete a unit promotion, the game will crash when starting up because it sees non-sequential ID numbers, but won't tell you anything about why it crashed. There are very few of these sorts of errors, though, so check the logs again first.
 
Top Bottom