Total War: WARHAMMER II

Total War: WARHAMMER II

Custom Lord Creation
otMC 9 May, 2024 @ 4:43am
A fix for CTD
(If this is the wrong place to post this, my bad, just delete post)

I was getting CTD anytime I pressed a button after opening the Create Custom menu.
The problem is rooted in UI Modding framework, and I found a solution that worked for me on that mod's page. I'm fixing a typo and making steps more elaborate, but credit for solution goes to greyTiger and 少妇眼中的蛮牛哥

1. Download Rusted PackFile Manager (RPFM) Newest stable https://github.com/Frodo45127/rpfm/releases/tag/v4.2.7
(scroll down and click on rpfm-v4.2.7-x86_64-pc-windows-msvc.zip to download)

2. Find the file Uimf.pack on your PC and make a backup copy (f.ex. to your desktop). If installed manually, it will be in your Warhammer 2 Data folder, if using workshop it will be in a folder inside ~\Steam\SteamApps\workshop\ (just go there and search for uimf.pack)

3. Open rpfm_ui.exe and go PackFile->Open Packfile and select the Uimf.pack in your data folder or workshop subfolder. You might get an error, but it isn't relevant to what we're doing.

4. Under Pack Contents on left hand side, expand uimf.pack -> script -> lib -> mod -> uic -> click text.lua

5. In text.lua find text:DestroyChildren(); (should be line 29)

6. Delete text:DestroyChildren(); and replace it with the four following lines:

for i=0,text:ChildCount()-1 do
local x = UIComponent(text:Find(i));
x:Destroy();
end

When finished, the line above the edited text should read "end" (without quotes) and the line below should read "text:SetStateText(textToDisplay);" (without quotes)

7. In Pack Contents on the left, find util.lua and click on it (same fodler as text.lua).

8. Find line Util.garbage:Adopt(uic:Address()); and line Util.garbage:DestroyChildren(); (should be line 21 and 22)

9. Delete those two lines and replace them with the following three lines:

Log.write("Util.delete starts, target: " .. tostring(uic));
uic:Destroy();
Log.write("Util.delete finishes Destroy uic");

When finished, the line above the edited text should read "function Util.delete(uic)" (without quotes) and the line below should read "end" (without quites.

10. Press CTRL + S or go to Packfile->Save Packfile in header menu to save, and then close the application.

ALL DONE. Just make sure the uimf.pack you edited is the one in your data/workshop folder and not the backup, or move the files accordingly if it was.

If someone knows of a reliable website that can host a file without time limit, pay, or registration, I'd be down to upload the edited uimf.pack, but the internet has gone me by, and the sites I would have used in the past don't exist anymore...