PDA

View Full Version : How do I mod the game?


Fairgamer
02-24-2013, 04:57 AM
I'm trying to increase the number of stat points granted per level. I extracted all the contents of asset001 and went and changed the line in database/systems that I needed to then zipped it up again and replaced the old one with my new one. It didn't seem to work in game.

joku
02-24-2013, 09:55 AM
The reason it didn't work is because Assets03 is loaded after Assets01, and hence overrides it. The zip files in the Assets folder are loaded in alphabetic order. So Assets03 (which contains the latest patches) will be loaded after Assets01 and Assets02. Any mod you make or download should have a name that comes after Assets03 alphabetically so that it loads after that. And the last thing to get loaded is an unzipped Database folder.

But rather than editing the systems.gdb file and rezipping it as you attempted, it would probably be better to use overrides. Overrides are much smaller bits of code that tell the game to only change the lines of code you want to change. Overrides are better to use than the method you attempted for two reasons. If you change the file and zip it back up into Assets03, then it will be overwritten on the next patch and you'll have to do it again. If you decide to zip up the file into a different zip file so it gets loaded after Assets03, then all the extra code that you didn't change will override any updated code that comes in the new patches. So you'll want to use overrides.

Fortunately, overrides are easy to use. I'll show you an example:
ModCrewPointsPerLevel overrides GameSystem
{
AttributePointsPerLevel 8 //Default 5
}

This small amount of code saved as a .gdb file and zipped up properly (or left in a loose Database folder) will change the number of crew points you gain per level from 5 to 8.

The line of code you wanted to change was "AttributePointsPerLevel", so I think that part is pretty self-explanatory. That particular line of code is in the systems.gdb file under the header "GameSystem". So what you want to do is override that line of code under that header. That's what the first line of code is telling the game to do. "ModStatPerLevel" is the custom header I made up for this mod; you can name it anything you want (probably; see the next paragraph). "overrides" tells the game that my custom code is going to be overriding the code under the header "GameSystem".

You'll notice that code does not mention the file (sytems.gdb) that is supposed to be overridden. That's because each header is only used once throughout all of the files. So telling the game to override "GameSystem" is telling it to override the only "GameSystem" in all of the code which happens to be in systems.gdb. It's important to note this when you're devising your own custom headers as using one that already exists might potentially cause some conflicts. Or maybe not. But I always play it safe by starting all of my custom headers with the word "mod".

And the last part of the code that I haven't mentioned yet is the bit behind the double slash. You may have already deduced this, but anything in the code after a double slash is a comment. When making a mod, it's usually a good idea to leave a comment noting what the default value of the code you changed was. This way you have an easy point of reference if you or anyone using your mod would like to change it.

If you look through the other mods posted in this forum, you'll have plenty of examples to learn from. You can even look through the mods from the other games as they're done the exact same way.

Good luck and have fun.

Fairgamer
02-24-2013, 02:53 PM
Eventually I figured out how to do the overrides from the sdk. It still wasn't working, but I figured out the override name can't have a number in it. So that's important for anyone just making up names for the override. At least I think that's what did it, as after I removed the number, the mod worked.

Thanks for the detailed instructions, this is useful information that was hard to find when I looked around for an answer.