Results 1 to 4 of 4

Thread: How to fix the faction mechanic bar for any unlocked faction.

  1. #1

    Default How to fix the faction mechanic bar for any unlocked faction.

    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:
    Code:
    faction_key#�vik_fact_west_seaxe;vik_fact_mierce
    �effect_key�vik_english_peasant
    Now, copy out that list and go to this site: https://mothereff.in/byte-counter

    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.

  2. #2

    Default Re: [Tutorial] How to fix the faction mechanic bar for any unlocked faction.

    Just to throw in an example, here is the original hex file piece:

    Code:
    66 61 63 74 69 6F 6E 5F 6B 65 79 23 00 76 69 6B 5F 66 61 63 74 5F 77 65 73 74 5F 73 65 61 78 65 3B 76 69 6B 5F 66 61 63 74 5F 6D 69 65 72 63 65 0A 00 65 66 66 65 63 74 5F 6B 65 79 13 00 76 69 6B 5F 65 6E 67 6C 69 73 68 5F 70 65 61 73 61 6E 74
    and here is a properly done hex to allow northleode to use the Fyrd Mechanic.

    Code:
    66 61 63 74 69 6F 6E 5F 6B 65 79 37 00 76 69 6B 5F 66 61 63 74 5F 77 65 73 74 5F 73 65 61 78 65 3B 76 69 6B 5F 66 61 63 74 5F 6D 69 65 72 63 65 3B 76 69 6B 5F 66 61 63 74 5F 6E 6F 72 74 68 6C 65 6F 64 65 0A 00 65 66 66 65 63 74 5F 6B 65 79 13 00 76 69 6B 5F 65 6E 67 6C 69 73 68 5F 70 65 61 73 61 6E 74

  3. #3
    Malcolm's Avatar Miles
    Join Date
    Mar 2011
    Location
    Scotland
    Posts
    355

    Default Re: [Tutorial] How to fix the faction mechanic bar for any unlocked faction.

    Awesome work Drunk Flamingo, well done on that!

  4. #4

    Default Re: [Tutorial] How to fix the faction mechanic bar for any unlocked faction.

    Seems we had the same idea, I've been working on restoring war fervour too.

    I've got the whole thing working right now, the only problem is that the effect is only displayed on the faction overview tab and not like it was before next to food & co.

    Using the old layout file crashes the game, you've got any ideas to fix this?
    "You can ask me for anything you like, except time."
    Napoleon Bonaparte
    "If you want a thing done well, do it yourself."
    Napoleon Bonaparte
    "You don't reason with intellectuals. You shoot them."
    Napoleon Bonaparte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •