Object types that can be replaced in separate files

  • We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Yes I have done it too. It will give you an error message for duplicates, but so far as I know that is the only side effect.
 
@dskod1, any chance you'll pin this thread as well? its very useful for us modders.

Starting to get too crowded in the sticky area. If someone wants to create a guide and tool list or get @LastLeviathan to update his list, then I will sticky that.
 
Often, creating an identically named object (technology, trait, etc.) in a separate file will duplicate that object instead of replacing it. Because of this, a modder who wants to change an object from the vanilla game normally has to overwrite an entire core file: This is the main source of conflicts between mods. But (!), there are a handful of object types that will be replaced instead of duplicated:
  • Game rules: Place a modified game rule from common/game_rules/00_rules.txt in a new file that comes after asciibetically.

  • Policies: Place a modified policy from common/policies/00_policies.txt in a new file that comes after asciibetically.

  • Scripted triggers: Place a modified trigger from common/scripted_triggers/00_scripted_triggers.txt in a new file that comes after asciibetically.

  • Species rights: Place a modified species right from common/species_rights/species_rights.txt in a new file that comes after asciibetically.

  • Localisation strings: Create a new folder, common/localisation/replace, and put any modified core localized string in <new_file>_l_<language>.yml.
  • Defines: Definitions in common/defines/00_defines.txt can be overwritten individually in a separate file by including only those entries you wish to change, along with the named block they reside in. E.g., NGameplay = { PRESCRIPTED_PLANETS_NUM = 0 }
  • Buildings are overwritten and not duplicated ... kind of. If a building is redefined in a file that loads after the core file, the second definition will--in most contexts--be the only definition of that building. You will, however, see multiple instances of the same building show up in upgrade options. It is therefore best to avoid doing this except for buildings that are not part of an upgrade chain.
  • Events: Strictly speaking, an event can't be overwritten. What can be done instead is putting a modified vanilla event (same id) in a new file that will be read before the core file. This will cause the game to accept the mod's event and reject the core one, with a warning sent to the error log.
  • Static modifiers: Place a changed static modifier from any of the core files in common/static_modifiers in a new file that comes before asciibetically. This works similarly to events but with the added perk of no warnings getting sent to the error log.
Object types that definitely get duplicated include:
  • Component templates
  • Edicts
  • Ethics
  • Ship sizes
  • Technologies
  • Traits
  • War Demands: On first impression this one appears to be overwritable. Only one instance of a demand will appear when declaring war and while a war is in progress. However, once a war is concluded, a demand's effect is run once for every instance of the demand.

If you come across other replaceable object types or see an error above, post here and I'll update the list.
This is really helpful! I’ve been wanting to get into modding myself. Thank you!
 
Vwell, some other stuff that should be added to the wiki @The Founder :

1. You can replace anything under /interface AFAIK, but its last loaded. No duplication messages.

2. Game rules. Again last loaded.

3. Localisation_synced - can be replaced in different file.

Also, traditions cant be replaced except through overwrite AFAIK.

You get a duplication message for deposits.

Planets can be replaced in a separate file. I'll check their load order.
 
1. You can replace anything under /interface AFAIK, but its last loaded. No duplication messages.
Given what you've said, do you think it would be possible to do a complete rewrite of how planets build buildings? Replace the tile system and adjacency with "the first 2-4 slots of each type grant bonus resources based on type/climate", and just have buildings consume slots.
 
Sorry, just to be clear, if i'm overwriting an event (leader.20) in "events\leader_events_1", i need to include my leader.20 event in a file named....?

I ask because its currently in a file named "leaderretrainer_events" and i'm getting the error log telling me its loaded the vanilla and disregarded mine.
 
Sorry, just to be clear, if i'm overwriting an event (leader.20) in "events\leader_events_1", i need to include my leader.20 event in a file named....?

I ask because its currently in a file named "leaderretrainer_events" and i'm getting the error log telling me its loaded the vanilla and disregarded mine.
Try something that comes before vanilla file name, like _leaderrtrainer.txt (Underscore, I think, is pretty early)
 
The localization override doesn't seem to work for me.

Path is common/localisation/replace, file name is "vacuum_1_english.yml", and the contents are just l_english: pc_barren_cold:0 "Vacuum World" .

the path should be /localisation/replace (not in /common) also make sure the files are encoded in UTF-8-BOM. Had the same problem and once i switched from UTF-8 it worked.