Mount & Blade II: Bannerlord

File information

Last updated

Original upload

Created by

Purple

Uploaded by

purpulez

Virus scan

Some manually verified files

Tags for this mod

About this mod

This mod allows to set freely the colors, banners and shields of each kingdom, clan or units: specifically or randomized. You can have the units to wear their very own colors and banners (each of your companions or unit type for instance).

Requirements
Permissions and credits
Changelogs
Initially this started as a proof of concept on my own to try to distinguish the colors of units (because i did not like the way your
clan colors match automatically your kingdom ones). Hence the mod name.

this mod will allow to:

- change colors of any clan or units in game (without changing the clan banner nor the kingdom colors)

- override the banners of kingdoms and clans, or their primary or secondary colors

- each unit color can be set to be randomized (from all the colors of the game palette, or specify your own palette)

- you can customize the primary and secondary colors independantly, and
randomize them; You can configure your colors to be randomized among a
set of color pair (one primary and one secondary) to link them together.

- you can override any unit type or companion with its own banner: this will not change the banner of the clan.


NEW IN VERSION 1.1.0:

new feature allow to specify new criteria to apply colors within units sections.

Whenever you define a unit wildcard definition under any "units" section, you can specify the following subsections:

- cultures
- tiers
- types
- cultures.tiers
- cultures.types
- tiers.types
-
cultures.tiers.types

To further customize your troops colors based on unit's culture, tier or type.

cultures sections will allow to define a list of culture and their config; cultures section can contain standard colors config, and/or tiers section or types sections.

tiers sections will allow to define a config based on tier number. tiers sections can contain standard colors config and/or types sections.

types sections can contain a config specifically for a unit type. The defined types can be any of the following types:

- "Ranged": match all ranged units
- "Melee": match all melee units
- "Foot": match all foot units
- "Mounted": match all mounted units
- "HorseArcher": match all ranged & mounted units
- "Archer": match all ranged foot units
- "Cavalry": match all mounted melee units
- "Infantry": match all foot melee units


For exemple, let's say you want to specify a unique color for Vlandian's troopers in your clan:

"clans": {
"PlayerClan":{
        "units":{
"Trooper": {
"cultures": {
"Vlandia": {   "mode": 3, "color": ..... , "shields": [...........] }
}
}
}
}
}


Now let's say you want all your Aserai troopers of tiers 4, 5 , 6 to have a specific config:

"clans": {
"PlayerClan":{
        "units":{
"Trooper": {
"cultures": {
"Vlandia": {   "mode": 3, "color": ..... , "shields": [...........] },
                 "Aserai": {  
"tiers": {
 "4": { "mode": 3, ....... },
 "5": { "mode": 2, ....... },
"6": { "shields": []   }
}
                                           }

}
}
}
}
}

If you now want all your Cavalry units and Archers to wear black:

"clans": {
"PlayerClan":{
"units":{
"Trooper": {
"cultures": {
           "Vlandia": {"mode": 3, "color": ..... , "shields": [...........] },
                    "Aserai": {
"tiers": {
 "4": { "mode": 3, ....... },
 "5": { "mode": 2, ....... },
"6": { "shields": [.....]   }
                   }
    }

},
"types": { 
                        "Cavalry": {  "mode": 3, "color": ["#000000", "#000000"]},
       "Archer": {  "mode": 3, "color": ["#000000", "#000000"]}
                                                       }
}
}
}
}


Those new criteria can also be defined within groups... But keep in mind the hierarchy of the criteria:

if you want to define configs based on types and tiers, use:     "tiers": { "X": {    "types": { "Y" ....}  } }

and not  "types": {   "Y": { "tiers": { "X": {.......}   }    }  }

units can contain "cultures", "tiers" and "types" sections,
"cultures" can contain "tiers" and "types" sections,
"tiers" can only contain "types" sections.

The log file will now give hints on each unit criteria: it will print whether the unit is mounted, ranged, its tier and culture:

such as:
==> character is: [Sanion] of clan [Argoros] of kingdom [Western Empire] isPlayerKingdom [False] isPlayerClan [False] isPlayer [False] isKing [False] isLeader [False] isHero [True] isMounted [True] isRanged [False] tier [0] culture [Empire]

==> character is: [Vlandian Champion] of clan [Joes] of kingdom [Vlandia] isPlayerKingdom [False] isPlayerClan [True] isPlayer [False] isKing [False] isLeader [False] isHero [False] isMounted [True] isRanged [False] tier [5] culture [Vlandia]


Use those logs hints to help defining your configs.




NEW IN VERSION 1.0.28+:

- unit groups:

"groups": [  {... group1 ...}, { ... group 2 ...}, ....{ ....groupN....}  ]

each group can contain any configuration attribute, but has to include the "units" attribute, which is an array of unit's names.

GROUP DEFINITION =>   {   "units": ["unit1","unit2", .... ] , "mode": X, "color": [...],  "banner":...., "shields": .......  }

The config attributes defined inside a group will be applied to all units of that group.

"groups"  can be defined in the root element, kingdoms or clans.


examples:


...
 "kingdoms": {
"Vlandia": {
  "groups": [
         {
             "units": ["King", "Leader"],
  "mode": 3,
             "color": .....,
             "banners": .....,
             "shields": .....
  },
      {
              "units": ["John", "Bob", "Joe" ],
              "mode": 2
  },
         {
              "units": ["solder type1", "soldier type2"],
              "mode": 3,
              "color": [ ... ]
         }
]
}
...


{
   "kingdoms": { .....},
   "clans": { ..... },
   "units": { .....},
   "groups": [ .... ]
}

....
"clans" : {
  "PlayerClan": {
                  "units": {   "Player": {.....}  },
"groups": [ ....... ]
  }

}
....




NEW IN VERSION 1.0.27+:

- New units wildcards:

- "King":  will match any unit which is king of a kingdom
- "Leader": will match any clan leader
- "Hero": will match any hero unit
- "Trooper": will match any trooper unit

examples:


...
 "kingdoms": {
"Vlandia": {
  "units":
     {
        "King": {.... king of vlandia },
        "Leader": { ... any vlandia clan leader ...}
  }
}
...


"clans": {
"PlayerClan": {"units": {   "Hero": { ... any hero of playerClan...},
                                   "Trooper": { ... any trooper of playerClan ... } }     }
}

Those wildcards can be used in any "units" section:  being it inside a kingdom, clan or standalone config.


- Combat Banners and Shields:

"combatBanners": ["list", "of", "banners" ] ==> use this to override units banners in combat
"combatShields": [ "list", "of", "shields" ]
==> use this to override units shields in combat

These parameters can be set anywhere in the config (kingdoms, clans or units sections) and be used to override the banners and shields used during combat.
With these you can define different banners/shields when on the campaign maps or inventory or parties windows and during battle.

It's useful if you want to have all clans or kingdoms share the same banner in the campaign map for simplicity, and still want to have a variety of shields/banners during battle.


...
 "kingdoms": {
"Vlandia": {
  "banner": ["code of vlandia banner"],
      "combatBanners": ["banner1", "banner2", "banner3", "banner4", ...., "bannerN" ],
      "clans": {
          "AnyClan" : {  "combatBanners": ["clanBanner1", "clanBanner2", .... , "clanBannerN"]  }
      }
}
}
...


- Kingdoms and Clans parties icons:

"kingdomShield": ["banner.code"]  ==> define this within a kingdom config section to use this banner as the shield icon for all kingdom parties

"clanShield": ["banner.code"]  ==> define this within a clan config section to use this banner as the shield icon for all clans parties
  this will override kingdomShield if set.


examples:

...
 "kingdoms": {
"Vlandia": {
  "kingdomShield": ["code of vlandia banner"]
}
...


- Parameterized banner codes:

Now with poc color mod, you can define variables to be replaced within you banner codes. Variables can be any string that will replace a piece of banner code.

example with the following banner code config:

"clanBanner": "11.x.y.1836.1836.724.746.1.0.0.424.121.116.500.500.787.747.1.1.0"

(the background colors were replaced with variables x and y).

i could also do this:

"clanBanner": "bannerVar"
(the whole banner code is replaced with variable bannerVar).

Variables have to be defined within the attribute "vars":

"vars": [     { .... group1 ... }, { ... group2 ...}, { .... group3 .....} ]

vars is an array of groups.
Each group will be a set of variables:

"vars": [     { "var1": ["list", "of", "values" ],   "var2": ["list", "of", "values" ]  ..... } , { ...group2 ...}, { ..group3 ....}, ....    ]

Each variable will be a list of possible values:  the value of a variable will be chosen randomly from that list.
Variables within a group will be synchronized. So for each variable within the same group, the values picked up will have the same index. The value arrays should have the same size.

so for instance, if i have this:  

vars: [  {  "x": ["1", "2", "3"], "y":["1", "2", "3"]  } ]   

I have a single group, of 2 variables (x and y).  Since x and y are in the same group, they will be synchronized (the values with the same index will be chosen),  so their value will always be equals:

and i will have only any of those combinations chosen randomly:  (x=1, y=1), (x=2, y=2), (x=3, y=3)

If i define x and y in different groups:

vars: [  {  "x": ["1", "2"] }, { "y":["1", "2"]  } ]   

Then x and y will not be synchronized, and i will have any of the following combinations, chosen randomly:   (x=1, y=1), (x=2, y=1), (x=1,y=2), (x=2,y=2)

vars can be defined in any config section. But vars defined in a unit will override vars defined in a clan or kingdom, and vars defined in a clan will override vars defined in a kingdom. So beware that when you use vars, all the variables used inside a banner code have to be defined either in the current scope or inherited from a lower scope. vars defined in different scopes won't be merged.
!!!! If you have unresolved vars in your banner code it will crash your game AS you will have an invalid banner code !!!!

Example:

"kingdoms": {
    "Vlandia": {     "vars": [  {  "x": ["1", "2"] }, { "y":["1", "2"]  } ],
       "units":  {       "Player":{     "vars": [ {  "z": ["1","2","3"] } ],
                                                 "banner": "x.y.z.1836.1836.724.746.1.0.0.424.121.116.500.500.787.747.1.1.0"  }
       }
    }
}
====> this will crash you game when the player will be part of Vlandia!  As the "Player" vars will override the "Vlandia" vars, and variables x and y will be undefined (only z will be known).

To fix it, you need to be sure that inside "player", you have x, y and z variables defined. 2 ways to fix that:

solution 1: add z inside vlandia vars and remove player's vars

"kingdoms": {
    "Vlandia": {     "vars": [  {  "x": ["1", "2"] }, { "y":["1", "2"]  }, { "z":["1", "2", "3"] } ],
       "units":  {       "Player":{  "banner": "x.y.z.1836.1836.724.746.1.0.0.424.121.116.500.500.787.747.1.1.0"  }
       }
    }
}

solution 2: 
add x and y inside player vars

"kingdoms": {
    "Vlandia": {     "vars": [  {  "x": ["1", "2"] }, { "y":["1", "2"]  } ],
       "units":  {       "Player":{          "vars": [  {  "x": ["1", "2"] }, { "y":["1", "2"]  }, { "z":["1", "2", "3"] } ], 
                                        "banner": "x.y.z.1836.1836.724.746.1.0.0.424.121.116.500.500.787.747.1.1.0"  }
       }
    }
}

If you use vars smartly you can save a lot of space within configs, and have a lot of randomization (like having figures randomized, background randomized, colors randomized, positions/size randomized etc... ).

have fun!


NEW IN VERSION 1.0.26+:

"FollowKingdomBackgroundOnly": "true/false"   

Use this option to force the clans' banner background colors to match their kingdom's primary color. Only the clan banner background will be updated (as a uniform background), and its color will match the clan's kingdom primary color. The other elements of the banner will be left untouched.

You can set this config parameter within kingdoms or clans config sections.

examples:

...
 "kingdoms": {
"Vlandia": {
  "FollowKingdomBackgroundOnly": "true"
}
...


"clans": {
"PlayerClan": { "FollowKingdomBackgroundOnly": "true" }
}



NEW IN VERSION 1.0.23+:

Now you can configure specifically the ruling clans/units colors, banners and shield:

The following config parameters have been added:

"BearRulerColors": "true/false"   
"BearRulerBanner": "true/false" 
"BearRulerShield": "true/false"   

If omitted, they are "true" by default.

those 3 parameters can be defined in the "defaultConfig" or any "kingdom", "clan", or "unit" section. They allow to specify whether an entry part of a ruling clan will have to bear the kingdom colors, banner or shield.

So for instance, if you want "Vlandia" leader to bear "Vlandia" Banner (instead of its own clan banner) and disable it for the other kingdoms/clans you can set:

"defaultConfig": {
    "BearRulerColors" : "false",
    "BearRulerBanner" : "false",
    "BearRulerShield" : "false"
 },

kingdoms": {
    "Vlandia": {    "BearRulerColors" : "false",   "BearRulerBanner" : "true",    "BearRulerShield" : "false" .... }

Now any Vlandian units, part of the ruling clan, will bear the banner of the kingdom, but will still bear their own clan's shield and colors.

Of course you can define them for your hero's units so that, only the heros will bear the kingdom's colors, and normal units of the ruling clan, will bear the clan's colors.

Along, with those parameters, new parameters have been added to allow overriding the Ruler mode, colors, banner and shield:

"rulerMode": X  
====> set any mode, that will only be applied when BearRulerColors is true for the given unit, and unit is part of ruling clan
"rulerColor":  [ "palette", "of", "color" ]
  ===> set the main color palette to be used with the rulerMode
"rulerColor2": [ "palette", "of", "color", "2" ]  ===> set the secondary color palette to be used with the rulerMode
"rulerBanner": "banner.code" ===> allows to set a specific banner for units that match the "BearRulerBanner" parameter and are part of the ruling clan.
"rulerShield": "shield.banner.code"
===> allows to set a specific shield for units that match the "BearRulerShield" parameter and are part of the ruling clan.

if those parameters are not defined, but "BearRulerColors", "BearRulerBanner" and "BearRulerShield" are true. The kingdom Banner will be used as RulerBanner, RulerShield, and the uniform color mode will be "mode: 2"


NEW IN VERSION 1.0.22+:

Now you can use the following modes:

"mode": 4    ===> uniform colors will match banner colors (not shield)
"mode": 41  ===> uniform colors will match banner colors (alternate between primary and secondary)
"mode": 42  ===> uniform colors will match banner colors (randomize all colors in the banner)



NEW IN VERSION 1.0.10+:


  • NOW, you can set the primary or secondary colors of any kingdom or clan banners (if for instance you just want to adjust the colors).

 (you should use a palette color code here and not an #RGB color code. Since the colors will be applied to the banner, #RGB code will not work there. These are the color codes of the online banner editor => https://bannerlord.party/banner-colors  ):


In a kingdom or clan section of the json, add the following attributes:


"primaryColor": "color code"

"secondaryColor": "color code"



The clans banner will be updated depending on the color you set. If you override the clans banner, the colors will be applied to the specified banner (like in VANILLA).

BUT, the kingdomBanner will not get updated! When you set the primary and secondary colors at the kingdom level, it will only impact the default banner, or the clans banners (through followkingdomColors attribute). If you also override the banner with "kingdomBanner", the colors will have to be changed on the banner code. They won't get updated with the primary and secondary colors.

This was done like this, so you can with a single kingdom definition, have all the clans to share the same colors while having a different banner (and colors) for the leading clan (which uses the kingdom banner).



  • Now, you can specify whether you want the clans to follow automatically the kingdom colors.


 Put either in the defaultConfig, in a kingdom section, or clan section the following attribute:



"FollowKingdomColors": "true"   => with this value the underlying clans of a kingdom (if defined for a kingdom), or single clan (if defined for a clan)  will follow the colors (by default, if no banner is specified, this will be the case. Just like VANILLA).

"FollowKingdomColors": "false"  => with this value the clan(s) will not follow the kingdom colors.



Default behaviour is "true", so when not specified, the vanilla behaviour will be applied.

Whenever a "clanBanner" is defined, or clan primary or secondary colors are set, the clan will not follow the kingdom colors.
So, if you want to specify a custom banner for a clan AND want matching colors use "FollowKingdomColors": "true"  to enforce the colors to match kingdom colors on your overriden banner (the banner set with clanBanner).


BE CAREFUL: if  the value follow colors "true" is defined for the kingdom, and a clan is defined under this kingdom, the clan config will assume  follow colors "true" (inherited from kingdom), even though you have defined "clanBanner". In order to change the behaviour, you have to set "FollowKingdomColors": "false".


Whenever you set this for a kingdom, the value will be inherited by the following clans. So if you define it for a kingdom, and want a specific clan to have a different rule, just add the attribute within that clan configuration (like in the example below):


exemple:
....
"generateTemplate":false,
  "defaultConfig": {
    "mode": 2,
    "FollowKingdomColors" : "false"   <====== this will set the default behaviour to have clans NOT follow kingdom colors
  },
  "kingdoms": {
"My kingdom": {
"kingdomBanner":
"2.12.12.1764.3167.779.754.1.0.-30.220.111.111.253.259.616.660.0.1.90.220.111.111.253.259.895.674.0.1.90.220.111.111.253.259.758.919.0.1.90",
                 "primaryColor" : "88",
                 "secondaryColor" : "40",
                 "FollowKingdomColors" : "true",   <====== this will make all clans of this kingdom to match the colors

                 "clans": {
                      "my super clan": {
                                    "clanBanner": "11.45.116.1536.1536.768.768.1.0.0.160.0.15.512.512.769.764.1.0.0",
 "primaryColor": "70",
 "FollowKingdomColors" : "false",                 <==== here you can change the value to be different from the kingdom, because even though we set
                  "mode": 3,                                                                  clanBanner  and primary color, the value would be inherited from the kingdom config
      
          "color": ["#000000","88"] as it is defined explicitly as "true" in the parent kingdom config.
                      }
}         
}
  }
...
}
 


NEW IN VERSION 1.0.9+:


  • Specify in your config.json the banners of the kingdoms or clans (the feature is the same as obsolete kingdom color mod):


In a kingdom section of the json, add the following attribute:

"kingdomBanner": "banner.code.of.the.kingdom"

if kingdomBanner is defined, along with primary and/or secondary colors, the kingdomBanner colors won't be updated! So when kingdomBanner is set, its colors can't be changed using the primary and secondary colors attribute: you have to change the banner code directly.


In a clan section of the json, add the following attribute:

"clanBanner": "banner.code.of.the.clan"

if clanBanner is defined, along with primary and/or secondary colors (or if followKingdomColors is set to true) , the clanBanner colors will be updated accordingly to the specified primary or secondary (kingdom or clan).



example:

....
"kingdoms": {
    "Vlandia": {  
          "kingdomBanner": "11.45.119.1536.1536.768.768.1.0.0.160.0.15.512.512.769.764.1.0.0",

"clans": {
"dey Cortain": {
"clanBanner": "11.45.116.1536.1536.768.768.1.0.0.160.0.15.512.512.769.764.1.0.0"
}
}
             }
  }
....
"clans": {
      "dey Meroc": {
    "clanBanner": "11.45.2.1536.1536.768.768.1.0.0.160.0.15.512.512.769.764.1.0.0"
    }
}

....




The mod will not override the default game behaviour => the leading clan of a kingdom will automatically use its kingdom banner as its own banner. 



"


HOW TO INSTALL:

Vortex install:

  • Fresh Installation:
- Download the PocColor-XXXXX.zip, and activate with Vortex.
- Download the optional config-files.zip
- copy one (and only one) of the config.json file directly into the mod directory:   <BANNERLORD PATH>/Modules/PocColor

                         or alternatively:

- rename the config.json_prod from the mod directory: <BANNERLORD PATH>/Modules/PocColor  into config.json


  • Update:
Download the PocColor-XXXXX.zip, and activate with Vortex. If the mod was already installed and configure, you already have a config.json file, and the update will not override it.


Manual install:

- Download the PocColor-XXXXX.zip, and unzip the content into <BANNERLORD PATH>/Modules
- Download the optional config-files.zip
- copy one (and only one) of the config.json file directly into the mod directory:   <BANNERLORD PATH>/Modules/PocColor

                     or alternatively:

- rename the config.json_prod from the mod directory: <BANNERLORD PATH>/Modules/PocColor  into config.json



Troubleshootings:


A log file is generated in the mod directory: log.txt
You can open this file to see what's happening, and it will give you hints about what's going on.

First and foremost, at the very beginning of the file, you'll see if your config.json has been read correctly:
- If you see "read config file"'  and nothing else: everything's fine!
- if you see "read config file", followed by an error message: something bad happened; The message should be relatively straightforward about what happened. If you see "Could not parse the config file :(". That basically means your config.json file is corrupted or incorrect syntactically. Help yourself with an online json editor site to figure out what's wrong, or ask for help!

The mod will load the banner, Kingdom and Clan info in a cache: so you'll see a lot of "adding new cache...."
It will give you basically the list of kingdom and clans (with their names), that you can configure in your json file.

When colors are applied to a unit, you'll see a log like this:


> character is: [Bushwacker] of clan [] of kingdom []

this will tell you the name of the unit, its clan, and kingdom.
So basically, those are the information you need if you want to configure this unit specifically.




==> Applying colors according to: mode[2] colors[] colors2[] newBanner[]

The applying colors log, will tell you which mode and which colors will be applied according to what's found in your configuration.

If you configured mode:3 for this unit, and see mode[2], that means something is incorrect in your config file (either a default config is used, or the kingdom or clan hierarchy is wrong).



Using the mod is perfectly safe: nothing is changed in the game structure, it will only override the units colors and banners in memory.

You can deactivate/activate the mod at will, at any time; You don't need to restart a new game: it should be compatible with previous savegame. And i guess pretty safe to combine it with other  mods. I personally recommend to using it with the Kingdom Color mod.



Be Warned though: 
the mod will only really shine if you take advantage of editing and tuning the config file to suit your needs (if you're satisfied with the default config, that's truely great).
But it can be a tedious and not so easy task depending on whether or not you're familliar to editing markup languages or json...

Otherwise, just take a deep breath, and go on with the "MOD CUSTOMIZATION" part:


MOD CUSTOMIZATION:


Everything should be configured through the config.json file in the mod directory (you can work on the default config.json, or start from the config.json.example in the mod directory):

Mount & Blade II Bannerlord\Modules\PocColor



The json is quite straightforward (there is a sample for you in the mod directory):

you can specify sections for:

  • defaultConfig
  • kingdoms / clans / units
  • clans (without kingdoms)
  • units (global definition)

each section is defined by its name (You can check the log.txt file in the mod directory that will be generated: it will give you information on the name you need to use to define each section).

Each section can have several attributes:


"mode": 0 


=> this is the color mode set to vanilla (aka nothing should change option)


"mode": 1 



=> this will randomize the color of the units (using the whole game palette, if nothing is specified). But you can set your own palette: we'll se that later. The primary AND the secondary will be random:  so for 2 colors, you will have:   A/B, B/A, A/A, B/B


"mode": 11 


=> aka randomized linked:  this will randomize the color of the units, but primary and secondary colors will be linked together: either they will be set by pair (not independantly), or will be set to be the same. You can have them randomized:   A/A, B/B only or A/B, B/A only.


"mode": 2  => this mode (it is the one active by default):  set your unit colors to match those of the shield.



"mode": 21=> this mode   set your unit colors to match those of the shield, like mode 2, but randomize primary and secondary (they will alternate)


"mode": 22=> this mode will randomize the colors building a palette from all the colors of the shields:  if you have 100 elements in your shield, with 10 different colors that will be a 10 colors palette.



"mode": 4
 

=> this mode is like mode 2, but use the banner colors instead:  set your unit colors to match those of the banner.


"mode": 41

=> this mode   set your unit colors to match those of the banner, like mode 4, but randomize primary and secondary (they will alternate)



"mode": 42

=> this mode will randomize the colors building a palette from all the colors of the banners:  if you have 100 elements in your banner, with 10 different colors that will be a 10 colors palette.




"mode": 3 



=> this mode will set a specific set of colors for your units (a pair of color for the primary and secondary colors).

NB:  mode 2 can allows already to set specific colors if you use kingdom color mod: you can override the clan banner (and use dummy colors as the first and the last object of the banner, and use this trick to set any uniform color with that). But if you don't have kingdom color mod i recommend using it, since it is very complementary of this very mod.



 "color": [ "color1", "color2"] 

=> set this when you use mode 3 (you need to specify the pair of colors to use. color1 is primary, color2 is secondary.



"color": ["color1", "color2", "color3", .... , "colorN"] 


=> use this when you use either mode 1 or 11. If used with mode 1: primary and secondary will be picked up randomly from this palette. If you use with mode 11: primary and secondary will be identical (ie: monocolor mode).



 "color2": ["color1", "color2", "color3", ...., "colorN"]

=> use this either with mode 1 or mode 11,  when you have already "color" defined, to enhance the customization: both "color" and "color2" have to be set in this case. When in mode 1: primary will be picked up in "color", secondary will be picked up in "color2" (each will be randomized of course).  When in mode 11: primary will be picked up in "color", secondary in "color2", BUT! The color indexes will be the same: so the two lists must have the same number of colors (or the min will be used):  


ex:   "'color":[ "color1", "color2"],  "color2":[ "color3", "color4"]   if you use mode 1: you can have all combinations: c1/c3, c2/c3, c1/c4, c2/c4; 

if you use mode 11:  you have only those combinations:   c1/c3 and c2/c4.

Colors can be defined by a standard hex RGB code:   #RRGGBB
Or you can use in game color numbers : just like the Kingdom Color mod.

- "kingdomBanner": "banner code"

Allows to override the kingdom banner. The cities' banner icon will be affected as well as clan banners in the encyclopedia


- "clanBanner": "banner code"

Allows to override the clan banner. The cities' banner icon will be affected as well as clan banners in the encyclopedia

- "kingdomShield": "banner code"

Allows to override the parties icons for a whole kingdom. If set, all parties icons will match this banner. (The attribute can only be used within a kingdom config section).


- "clanShield": "banner code"

Allows to override the parties icons for a whole clan. If set, all parties icons will match this banner.
(The attribute can only be used within a clan config section). If both kingdomShield and clanShield are set, clanShield value will override kingdomShield value.



- "banner": "banner code"           


=> this can be used to override the banner of a unit. If nothing else is set; The shield will match this as well.
mode 2 will make the uniform color match these banner colors (this is a new way to change unit colors).


- "banners": ["list", "of", "banner", "codes"]      

This will allow to change banner/shields randomly from this list. If both "banner" and "banners" are set, the list will be the combination of "banners" and "banner" codes.


- "shields": ["list", "of", "shield", "codes"]

If "shields" is set, shields will be randomize among the specified values.
Uniforms colors will automatically match the shield color in mode 2.  If you want to keep the old behaviour of matching colors with "clan" banner, just set clan to "mode 3" and specify the colors (it will be easier this way, than configuring each units).


- "combatBanners": ["list", "of", "banner", "codes"]
     
This will allow to set banners/shields in battles ONLY.
If "banner" and/or "banners" are set, during battles, this list will override them. With this you can have different banners during battles and in campaign map.


- "combatShields": ["list", "of", "shield", "codes"]

This will allow to set shields in battles ONLY.
If "shields" are set, during battles, this list will override them. With this you can have different shields set during battles
and in campaign map.


"FollowKingdomColors": "true / "false"

This will allow to have clans follow the kingdom colors (like in vanilla game).  By default this parameter is assumed to be true. So set to false to disable the color change of clans when they join a kingdom.


"FollowKingdomBackgroundOnly": "true / "false"

This will allow to have clans follow the kingdom colors, but only the background color will be applied. Items of the banner will be left untouched.



"primaryColor": "colorCode"

"secondaryColor": "colorCode"

Allow those 2 attributes to change a kingdom or clan's primary and secondary colors. Use only game color ID's and NOT hexa RGB colors (since they will be applied to banners, if you use RGB codes, this will crash the game).


"BearRulerColors": "true" / "false"

"BearRulerBanner": "true" / "false"

"BearRulerShield": "true" / "false

Set these values to disable or force the ruling clan of a kingdom to bear the kingdom colors, banner or shield.
If set to true, the ruling clan (and its units) will always use the uniform colors, banners and shields of the kingdom

If you set one of those parameter to true, you can also override the "ruling mode colors, banners and shields" using the following parameters:


"rulerMode": any_mode_value

"rulerColor": [ "ruler color1", "ruler color2" ]

"rulerColor2": [ "ruler color1", "ruler color2", .... ]

"rulerBanner": "ruler.banner.code"

"rulerShield": "ruler.shield.code"



Units wildcards:

You can reference any king with the unit wildcard "King".
You can reference any clan leader with the unit wildcard  "Leader".
You can reference any hero unit with the unit wildcard "Hero".
You can reference any common trooper unit with unit wildcard "Trooper".

Those wildcards are case-sensitive.

ex:

...
"units" : {   "King": { .....},  "Trooper": { .....}   }
....



Player Kingdom, Clan and character:


with version 1.0.1 and onwards,  you can directly reference the player character using "Player" as a unit name in the json.
(The full name string of your Character can also be used, and will override the "Player" entry if both exist in the file)

The player kingdom can be referenced using: "PlayerKingdom" name.

The player clan can be referenced using: "PlayerClan" name.

Using specific naming however will always override the "wildcard", so that if you play with multiple save and different clan names, you can have multiple definitions for your clan and units which are save-dependant.

If you use the wildcards, of course, the value will not be save dependant.

So you can use both...

The wildcards are case-sensitives.


Default Config:

The default config can be overriden in the json, by adding in your json    (check config.json.prod):

  "defaultConfig": {
    "mode": X
    "color": .............
  },


Template Generation:

A full template of json config file can be generated by adding the following value into your config.json file   (check config.json.prod) :

"generateTemplate":false

This will, after your savegame has been loading, build a template in the mod
directory will all the kingdoms, clans and units of your savegame.
But be aware, that It will not be useable as it is, because the colors are only placeholders for you to edit.

It was only added for you to have an exhaustive list of units and clans if
you want to make a complete overhaul of the clans and units colors.


some examples:


"mode": 1, "color":["1","2","3"] 
   

    => primary and secondary will be picked up independantly from colors 1,2 and 3


"mode":1, "color":["1"], "color2"=["2","3"]


   => primary color will be always 1, and secondary will be randomly either 2 or 3


"mode":11, "color":["1","2","3"]

=> primary and secondary will be linked together and will be either 1, 2 or 3


"mode":11, "color":["1"], "color2"=["2","3"]

=> since both arrays do not match in size: only one pair will be used:   1/2, so everytime the primary will be 1, the secondary will be 2.


"mode":11, "color":["1","4"], "color2"=["2","3"] 

=> now, primary will be randomly 1 or 4, and secondary will match accordingly:   if primary is 1, secondary will be 2; If primary is 4, secondary will be 3.




So if you want to configure a kingdom as a whole:   add a definition section for this kingdom in the kingdoms section:

{
  "kingdoms": {
"Vlandia": {"mode": 0},
  "Northern Empire": {"mode": 1},
  "Khuzait": {"mode": 11},
  "Battania": {"mode": 2},
  "Western Empire": {"mode": 3, "color":["#FF0000","40"]}
  }
}


If you want to customize a clan (if standalone), add it as a root section in the "clans" section:


{
  "kingdoms": {
      "Vlandia": {"mode": 0},
  "Northern Empire": {"mode": 1},
  "Khuzait": {"mode": 11},
  "Battania": {"mode": 2},
  "Western Empire": { "mode": 3, "color":["#FF0000","40"] }
  },
  "clans": {
"my clan": {"mode": 0}
  }
}

NB: here, the "my clan" is defined as a standalone clan: it means that, whatever the kingdom of the clan, the rule will apply. But if my clan join the Sturgia, and i add a setting for the Sturgian kingdom and my clan as part of Sturgian, it will override this configuration.


If you want to customize a clan (as part of a kingdom), add it in the "clans" section, for the corresponding kingdom:


{
  "kingdoms": {
  "Vlandia": {"mode": 0, "clans": { "my clan": {"mode": 2}  }},
  "Northern Empire": {"mode": 1},
  "Khuzait": {"mode": 11},
  "Battania": {"mode": 2},
  "Western Empire": {"mode": 3, "color":["#FF0000","40"]}
  }
}


Now, with the former example: if my clan joins Sturgia, the new rule (mode:1) under sturgia kingdom will override the bottom rule (mode:0)

{
  "kingdoms": {
      "Vlandia": {"mode": 0},
  "Northern Empire": {"mode": 1},
  "Khuzait": {"mode": 11},
  "Battania": {"mode": 2},
  "Western Empire": { "mode": 3, "color":["#FF0000","40"] },
         "Sturgia": { "clans":{ "my clan": {"mode":1 }} }
  },
  "clans": {
"my clan": {"mode": 0}
  }
}



If you want to customize a unit, add it eitheir, as a standalone unit, as a kingdom unit, or clan unit:

{
  "kingdoms":
     {
  "Vlandia": {     "mode": 0,
                          "clans": {
                               "my clan":  {
                                     "mode": 2,
                                     "units": {
                                                 "my companion1":{"mode":2 },
                                                 "my companion2":{"mode":3, "color":["12","12"]}
                                           }
                                           }
          }
                    },
  "Northern Empire": {"mode": 1},
  "Khuzait": {"mode": 11},
  "Battania": {"mode": 2},
  "Western Empire": {"mode": 3, "color":["#FF0000","40"]}
     },
     "units": { "Looter": {"mode": 1 } }
 }


Player kingdom, clan and character  can be referenced using wildcards, so if you want to have your config independant of player clan name, you can use "PlayerClan":
{
  "kingdoms":
     {
  "Vlandia": {     "mode": 0,
                          "clans": {
                               "PlayerClan":  {
                                     "mode": 2,
                                     "units": {
         "Player":{"mode":21},
                                                 "my companion1":{"mode":2 },
                                                 "my companion2":{"mode":3, "color":["12","12"]}
                                           }
                                           }
          }
                    },
  "Northern Empire": {"mode": 1},
  "Khuzait": {"mode": 11},
  "Battania": {"mode": 2},
  "Western Empire": {"mode": 3, "color":["#FF0000","40"]}
     },
     "units": { "Looter": {"mode": 1 } }
 }



A sample config file "config.json.example"  exists in the mod directory as an example.


The hierachy use inheritance, so as long as a config match your unit, the most specific configuration will be used:  that means, that sometimes you may have to add a more specific rule to cancel an existing generic rule.

Ex: i want all vlandian to be All red, except this clan: So if you set a rule to vlandia, kingdom: all Vlandians units will be red. You'll have to add under kingdom Vlandia, the clan you want to be the exception and set a specific rule for it to cancel out the "all red" rule.

The names of kingdom, clans and units are those printed in game; If you have a doubt, check the log.txt file in the mod directory (it will tell you the names you have to use: you can copy and paste from there in your json file).

JSON is very powerful, but can be tricky sometimes. Help yourself with online beautifier site (this will check your syntax, and allows for more readability and control over your code) such as:    https://codebeautify.org/jsonviewer.

NB: a side note, in the JSON, all parameters are String, except the mode. So always put some double quotes around names and parameters, except the digital value of the mode. Like in the examples.