How to add a column to a table

I haven't tried but you can include a file of sql commands right? So yes you should be able to alter tables and add columns.

To create a new table you use the create table command (this one has examples in the civ5 sql files that are included).
 
You can technically modify/create tables in the XMLs. The problem is the game won't know what to do with the extra information without non-XML modding, which is beyond my grasp and may very well require deeper modding tools (DLL and all).
 
The columns are at the beginning of the .xml files. Like if you open Units.xml you can see Type, Description, Combat, and a huge host of other column titles.

It's really easy to add a new one. But as Lord Shadow says, without advanced coding, you're going to be unable to get the game engine to look at your new column and do anything with it.
 
Using them is the easy part :) The Lua code is ready and waiting.. I'm just looking for the best way to add them, don't know much about database queries. I don't think it's just changing the Schema, and if so, how would I go about that? Update or Row tags? Replace the entire file? Don't seem like would work.

So how does the SQL syntax go exactly (ModBuddy seems to use a custom systax, I guess)?
 
The xml is interpreted at runtime to create sql commands, resulting in the creation of a new database file every time you play. Editing the xml will actually add new columns and rows to the database. You can use the sql if you want to -- its supposed to be capable of much more interesting manipulations than the xml (though people have complained that a lot of basic sql functionality seems to be missing).

You can learn a lot about sql by googling and following some simple tutorials. Sending queries to a database, creating/updating/deleting tables, is all very easy, basic stuff. It's the little syntax "gotchas" that'll have you tearing your hear out, like any scripting/programming language (what do you mean I missed a comma???)

I'm starting on lua tutorials. I can read the files easily enough, but I can't write them without copying-and-pasting. I don't actually know the syntax. I'm gonna need that in my head...
 
So if I just make up a new XML Attribute it will add that new column? And if I open a unique new tag under GameData it will create a new table for me? Sounds great, gonna try it right away!
 
The trick is getting it to look at and actually do anything with the new data. For that you need to edit the lua files.
 
Top Bottom