• We'll be making a number of structural changes to the forums on Wednesday, 06.12.2023. No downtime is expected. Read more here.

In Progress General GAME CRASH if banner color IDs are not continuous from 194

Users who are viewing this thread

Version number



When a mod uses custom color IDs not starting from 194, the game will crash when loading a saved game or creating a kingdom.

How to Reproduce:
  • Create a mod
  • In the file ModuleData/banner_icons.xml, add some colors with IDs not starting from 194, for example:
    <?xml version="1.0" encoding="utf-8"?><base xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <Color id="520" hex="0xff000000" player_can_choose_for_sigil="true" player_can_choose_for_background="true" />
          <Color id="521" hex="0xffFFFFFF" player_can_choose_for_sigil="true" player_can_choose_for_background="true" />
          <Color id="522" hex="0xffFEDB97" player_can_choose_for_sigil="true" player_can_choose_for_background="true" />
          <Color id="523" hex="0xff4D85C0" player_can_choose_for_sigil="true" player_can_choose_for_background="true" />
  • Start a new sandbox game and design the banner using a new color
  • Save and load the game - it'll crash.
Specific Tool: No

I mentioned this bug before in this thread, but it seems to be ignored. So I'm reporting this again.

The method BannerManager.GetColorId seems not to be correctly implemented. It traverses the BannerManager.ColorPalette dictionary with indices from 0 to Count - 1. But since it's essentially a dictionary, the keys may not be continuous numbers.

This problem makes having multiple mods for expanding the color palette nearly impossible.

For now, I have to patch BannerManager.GetColorId using Harmony:

static bool Prefix(ref int __result, uint color)
    foreach (KeyValuePair<int, BannerColor> colorEntry in BannerManager.ColorPalette)
        if (colorEntry.Value.Color == color)
            __result = colorEntry.Key;
    __result = -1;
    return false;
Forwarded to the QA team for further investigation. We will reach out again if we need more information. Thanks for reporting and sorry for any inconvenience!
Top Bottom