Modding planetary improvements

When you use the mod folder, any techs that you create will automatically replace any other techs with the same name in the standard game.

So far so good.

But when you create replacement planetary improvements, they are ADDED to the list of planetary improvements, even if they have the same internal name as one of the old buildings. This means that if, for instance, you wanted to make a mod that increased the cost of all the buildings, you end up with two of each building in the colony list!

Is there any way around this, other than altering the original xml file which rather defeats the purpose of the mod folder?
6,894 views 9 replies
Reply #1 Top
Sorry, no. That's just the way the game handles that data.
Reply #2 Top
I don't suppose there are any plans to change this in a future update?
Reply #3 Top
Are you sure?

I've been modding alot and I don't see this happening.

Are you putting you modified file in the "PlanetImprovements" folder of your mod, or just leaving it in the "Data" folder or your mod?

The way I figured it, if you put it in the "PlanetImprovements" folder, it will do as you describe, but if you leave it in the "Data" folder, it will override the original unmodded file. For this reason, the file needs to be a complete replacement, with everything in it, not just the building you want to change. As far as I'm aware this is the same with everyfile, so you don't have to bother with having the same names for techs or anythign like that.

I've noticed something else to. The last patch changelog said something about the TerrainColourSchemes file now being used from the mod folder, instead of only the default folder, but mine has been working fine from my mod folder ever since the first mod patch (1.1?). Maybe for the same reason as above.

I just leave all my mod files in the Data file of the mod folder and everything works fine.

It seems to me that alot of modding aspects aren't nailed down. The mod guide says theres a hardcoded limit of 5 planets per system, but I added Pluto to the Terrans and it adds it in no problem, voila, 6 planets.

Or am I just talking through my hat?
Reply #4 Top
Thank you, thank you! You are a life saver!

This could have been described better in the modding guide...

Oddly enough, I have the techs in the tech folder and that works just fine. Same with ship components. Oh well.
Reply #5 Top
I've noticed something else to. The last patch changelog said something about the TerrainColourSchemes file now being used from the mod folder, instead of only the default folder, but mine has been working fine from my mod folder ever since the first mod patch (1.1?). Maybe for the same reason as above.


That referred to the fact that before, that file would only work from mods/XXXXXX/data, instead of mods/XXXXXX/data/terraincolorschemes as it was supposed to.

As to files replacing rather than adding when left in the root mod data folder, I haven't tried that myself. If it does work that way, it's not documented as such.
Reply #6 Top
As to files replacing rather than adding when left in the root mod data folder, I haven't tried that myself. If it does work that way, it's not documented as such.


That's the way it seems to work. In my mod only the PI's from my custom XML exist in-game, none of the originals. PlanetaryImprovements.xml is stored in the Data folder... I've never even tried putting them in the subfolders as I though CariElf had discouraged that.

Do we know how putting XML's in the subfolders versus the main Data folder impacts other aspects of modded games? That might be a good little research project as I'm betting its probably a little murky even for the powers that be.
Reply #7 Top
Generally, it goes like this:

If you put it in the sub folder it will "add" it to the game. Therefore if any entries (techs etc) have the same name it will override the entry in the original file, but anything else will be left as is. You don't need complete files, just the new entries you're going to add in each file.

If you leave it in the root /Data folder, the file will completely replace the unmodded file with the new one, therefore you need a complete file with your modifications tacked on.

I am absolutley 100% sure of this generalisation, as I have done my mod in this manner. I know its not documented, but when you tell a scientist that something can't be done, that scientist will always try anyway...


BOCTAOE


Placing in subfolders seems different for every file though.

TechTree seems the easiest, as any replacements will overwrite.

PlanetImprovements, as said here, is a little weird in that instead of overwriting entries, it starts duplicating them instead.


The solution I used, and that isn't documented at all, is to always use the root /Data file, effectively creating an entire new copy of all of the files I am going to mod.

Even then, there are catches as with the TerrainColourSchemes and PlanetDescription files, it seems to ONLY work from the subfolders and will ignore anything placed in the root. Some files don't even seems to make any difference at all, I guess they haven't been "mod activated" yet (GC2_Hints is one).


If you want to try something, my suggestion is to just ignore the mod guide and try anyway (thats what I did!), as many different ways as possible.

Whats in the guide isn't wrong, its just not always right... if you get what I mean.
Reply #8 Top
It seems to me that alot of modding aspects aren't nailed down. The mod guide says theres a hardcoded limit of 5 planets per system, but I added Pluto to the Terrans and it adds it in no problem, voila, 6 planets.


Good to know.
Reply #9 Top
I'm going to have to try that 6th planet add in, I think.

I use the mod folder structure that way too.
I wanted to add my mods to the KHSM mod Kryo did.
I also wanted to add a couple things, like the additional techs from the Star Trek mod.

It took just little thought and experimenting to learn that files in the Data folder replaced, while files in subfolders added.

It really is nice, to be able to do it that way. It adds an additional layer to the complexity, so there can be both major and minor mods and the ability to mix and match certain elements.