Resource icon

Mod, Component, & File Load Order as of Winter Patch

Note--most mods won't have to worry about any of the below because they have no reason to care about load order. This information is really only necessary if you want to modify DLC content or the contents of other mods or you're working on a compatibility issue with another mod that could be resolved by altering load orders.

Default Order

The default load order of mods for new games is by ModRowId in mods.sqlite, which basically means mods are loaded in the order they were added to the database, with them being re-added any time the modified date of their .modinfo file changes.

When a saved game is loaded, however, mods load in alpha-numerical sort order by Mod Id--the GUID used as the "id" attribute in the root <Mod> element of the .modinfo file. If the last added Mod's id starts with "00", say, it will load last during game creation (since it was added last), but first when a game is reloaded, even before any DLC.

Basically, if your mod has load order dependent elements, don't rely on the default load order of mods--it may appear to work during your testing, but that's probably just because it's the last mod whose .modinfo you changed.

The default order of components is to load with their mods in the order in which they appear in it's .modinfo file.

The default order of files is to load with their components in the order in which they appear in the .modinfo's <Files> element, not in their order within the component.

Changing Mod Load Order

A mod will always load after any mods in its <Dependencies> list in .modinfo. However, you don't really want to use this unless unless your mod really requires the other mods to run.

There is also a <References> element which *should* force a mod to load after any mods listed there without actually requiring those mods like <Dependencies>, but it currently appears to be broken.

There currently is no reliable way to control the load order of mods. However--

Changing Component Load Order Across Mods

The <Properties> element of a component may contain a <LoadOrder>X</LoadOrder> element where X is a positive or negative integer acting globally across mods to determine the load order of the component, with lower numbers loading earlier. Thus, an <UpdateDatabase> with a <LoadOrder> of -1 will always load before the DLC content and any component of any mod that didn't specify a lower <LoadOrder>, regardless of the order the mods themselves load in. A <LoadOrder> of 1 would of course cause it to load after the DLC and any component of any other mod that didn't specify a load order.

So if you want to modify the units added by the DLC, just specify a <LoadOrder> >= 1 to make sure your component runs after the DLC components.

I've personally tested this with <UpdateDatabase>, <GameplayScript>, and <ModArt>--it definitely works with the 1st 2, and definitely does not work with <ModArt>.

Changing File Order Within Components

Under the <Items> element of any component, the <File> element may specify a Priority X like <File Priority="1">SomeFile</File>, which will determine the load order of the file within the component, overriding the order in the <Files> element off the root. X may be positive or negative, defaulting to 0 when not specified, and opposite of <LoadOrder>, higher numbers load earlier. The Priority has no effect on the same file in other Components or on the load order between components--it is strictly local to the <Items> element of the current component.

Changing Dep/ArtDef Load Order

Unfortunately there's no good answer here yet. <LoadOrder> has no effect on the order of <ModArt> components.

I've currently found no better solution than the one @Gedemon is using with R.E.D, where he's made 3 separate mods: the base RED Mod, a RED for MoarUnits extension, and an RED for Polish DLC extension. For the extensions, to use the MoarUnits one as a an example, he is adding the base RED mod and the MoarUnits mod to <Dependencies> in .modinfo and adding MoarUnits.dep's GUID to the extensions <RequiredGameArtIDs> like so:

Code:
<RequiredGameArtIDs>
        <Element>
            <name text="MoarUnits"/>
            <id text="8342b98d-80c7-4002-87bb-419646bd9b54"/>
        </Element>
    </RequiredGameArtIDs>

It's messy and ugly and requires a separate extension mod for each additional compatibility. Although note, this is only necessary in order to apply the R.E.D. look to the additional units in MoarUnits and the DLC--if you're just adding a new unit and an artdef for it, you won't have to worry about any of this (though @Gedemon will if your mod becomes popular).
Author
PlotinusRedux
Views
705
First release
Last update
Rating
5.00 star(s) 2 ratings

More resources from PlotinusRedux

Latest reviews

answered the question for me
Thanks for the info, this helps quite a bit.
Top Bottom