Hey all, this is going to be a quick tutorial on how to go from the ed up black bar that takes up your entire top of the screen to this:
You will need:
Any text editor with find and replace, or some Lua ability if you want to do it *properly*
HexD, or some other hex editor capable of editing compiled CA UIC files.
Steps:
1. Take a faction mechanic script, go inside and change all the faction keys from the old faction to the new one. You don't actually have to do it this way, you can create a whole new script so that both factions work, but this is the fastest to get a proof of concept. I opened the mierce faction mechanics script in vikings.pack campaigns/vik_attila/miercna_faction_mechanics.lua and simply found "vik_fact_mierce" and replaced with "vik_fact_northleode".
2. Find the faction keys of the factions who used to have the mechanic. For my example, this means I need:
vik_fact_west_seaxe;vik_fact_mierce
3. Go to ui/campaign ui/layout (its an extensionless file) and extract that file. Then open it in HexD. Search the file for the two faction keys who currently use it until you find what you are looking for. There will be plain text nearby saying what the mechanic is. For instance near the edit I made to produce the above picture, it says "vik_english_peasant".
4. Once you have found the area, look for a list that looks like this:
Now, copy out that list and go to this site: https://mothereff.in/byte-counterCode:faction_key#�vik_fact_west_seaxe;vik_fact_mierce �effect_key�vik_english_peasant
Copy the string into there, and then add your next faction key and note down the byte-length. Here the original is 35 bytes long and with northleode added to the end it becomes "vik_fact_west_seaxe;vik_fact_mierce;vik_fact_northleode", which is 55 bytes.
Between "faction_key" and the start of the list, there are two bytes. One is 00, the other is a number corresponding to the byte length of the list. Update that byte number to match the length of your new list, then, with your new list on the clip board, highlight the old list and hit paste. Accept the fact that it will change the file size.
Now, put layout and your found-replaced lua script into your .pack file and launch the game as normal. The mechanics bar will work. A few fun facts:
1. you can assign any mechanic to anyone as far as I have tested.
2. You don't need to assign multiple mechanics, it seems as long as they have one, the bar doesn't bug out.
3. War fervor is still in this file, and I am working on restoring it.
4. You might be able to get the UI to work with no mechanics whatsoever if you just enable war fervour on the new faction, but I haven't tested this yet. Enabling War fervour on a faction doesn't actually show it on the UI anymore but I'm not sure if this is done in hex or script.
Also do remember: the script does all the gameplay parts, this hex edit simply allows the UI component to appear for the factions.