Mod crashes when loading save.

rian222

Chieftain
Joined
Jul 31, 2013
Messages
39
Location
Japan
Pretty sure there's a simple action I need to put in the .modinfo file to fix it, but I can't figure it out. I have FrontGameActions, InGameActions, and Files, but I assume there's one more for loading saves? Here my code:

Code:
</Properties>
  <FrontEndActions>
    <UpdateText id="UBP_TEXT">
      <File>UBP.xml</File>
    </UpdateText>
    <ImportFiles id="UBP_XML">
      <File>UBP.xml</File>
    </ImportFiles>
    <ImportFiles id="UBP_SQL">
      <File>UBP.sql</File>
     <File>BeliefChanges.sql</File>
     <File>LandUnitChanges.sql</File>
     <File>NavalChanges.sql</File>
     <File>AirUnitChanges.sql</File>
     <File>PolicyChanges.sql</File>
    </ImportFiles>
  </FrontEndActions>
  <InGameActions>
    <UpdateDatabase id="UpdateSql">
      <File>UBP.sql</File>
     <File>BeliefChanges.sql</File>
     <File>LandUnitChanges.sql</File>
     <File>NavalChanges.sql</File>
     <File>AirUnitChanges.sql</File>
     <File>PolicyChanges.sql</File>
    </UpdateDatabase>
    <UpdateText id="UpdateText">
      <File>UBP.xml</File>
    </UpdateText>
  </InGameActions>
  <Files>
    <File>UBP.sql</File>
    <File>BeliefChanges.sql</File>
    <File>LandUnitChanges.sql</File>
    <File>NavalChanges.sql</File>
    <File>AirUnitChanges.sql</File>
    <File>PolicyChanges.sql</File>
    <File>UBP.xml</File>
  </Files>
</Mod>
 
These are incorrect and unecessary
Code:
    <ImportFiles id="UBP_XML">
      <File>UBP.xml</File>
    </ImportFiles>
    <ImportFiles id="UBP_SQL">
      <File>UBP.sql</File>
     <File>BeliefChanges.sql</File>
     <File>LandUnitChanges.sql</File>
     <File>NavalChanges.sql</File>
     <File>AirUnitChanges.sql</File>
     <File>PolicyChanges.sql</File>
    </ImportFiles>
No file that is being loaded via an <UpdateDatabase> action would ever need to be loaded via <ImportFiles> action since this would never be used in the game's database if done via <ImportFiles> action. Nor should you need or try to load these files in the <FrontEndActions> if they contain code for the <InGameActions>. These two parts of the game use entirely different sets of game-tables in <UpdateDatabase> actions, and what is valid in one is almost never valid in the other.

The only time you would load an xml file via <ImportFiles> action would be if you were loading a replacement xml-file that is associated with an In-Game UI panel, and in such a case the code within such a file would fail if attempted to load via an <UpdateDatabase> action.

  • Most likely your mod is failing because the game does not load mods and mod-files in the same order when loading a saved game as it does when starting a new game.
  • This is a very common problem with mods that are using some element from one of the DLC.
  • When starting a new game stuff in DLC will be loaded for example before a mod loads its code, but when loading from a save the DLC content may load after the content from mods, causing mods that are using elements from one of the DLC to fail (and the game returns to the start menu) because the stuff from the DLC has not yet been added to the game's database, so you cannot make use of the needed element from the DLC
  • Most common fix is to do as
    Code:
        <UpdateDatabase id="UpdateSql">
          <Properties>
            <LoadOrder>10</LoadOrder>
          </Properties>
          <File>UBP.sql</File>
         <File>BeliefChanges.sql</File>
         <File>LandUnitChanges.sql</File>
         <File>NavalChanges.sql</File>
         <File>AirUnitChanges.sql</File>
         <File>PolicyChanges.sql</File>
        </UpdateDatabase>
  • You may also need to set a Priority order for each file within your <UpdateDatabase> action to ensure that the files within the <UpdateDatabase> action load in a specific order, example:
    Code:
    <File priority="1">XML/BuildingModifiers.xml</File>
    • There is conflicting info around on the effect of priority numbers in that some people contend a higher number loads later, whereas @PlotinusRedux contends in his reference guide that higher numbers load sooner.
    • Bear in mind when looking at Plotinus' reference that a few things have changed since he wrote it, mainly the release of the SDK and the change from <Settings> to <FrontEndActions> and <Components> to <InGameActions>
 
Back
Top Bottom