Author Topic: Anyway to cheat to fix my build?  (Read 7833 times)

fingrnuts

  • Noob
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Anyway to cheat to fix my build?
« on: January 20, 2020, 06:11:51 pm »
I messed up and got Paranoia instead of Force User. I just want to switch them out, take out Paranoia and get Force User on my build. Is there like an in-game console where I can type a command and it removes it?..

TheAverageGortsby

  • Faceless
  • *****
  • Posts: 820
  • Karma: +196/-40
    • View Profile
Re: Anyway to cheat to fix my build?
« Reply #1 on: January 21, 2020, 05:30:11 pm »
You'd need to use CheatEngine.  There's no console command for that sort of thing.  CheatEngine isn't terribly difficult to learn, but if you're low-level, it'll actually be quicker to just restart the game.

Don't you have a save from before you levelled up?  An autosave, perhaps?

destroyor

  • Oculite
  • Tchortist
  • **
  • Posts: 488
  • Karma: +81/-29
    • View Profile

davelsan

  • Probably not a Spambot
  • *
  • Posts: 10
  • Karma: +2/-0
    • View Profile
Re: Anyway to cheat to fix my build?
« Reply #3 on: January 30, 2020, 01:14:44 pm »
I suppose the OP has already moved on, but I'd like to add something for future reference.

First, I'd suggest not to use a text editor to make changes in binary data. A simple hex editor (e.g. HxD) is more suitable for that. Also, last time I checked, that tutorial was missing some key information without which you are likely to corrupt the save file.

Both Paranoia and Force User are passive feats, which means they are only stored in a list contiguous to the skills list. Since this is a simple respec, swaping one for the other can be done relatively safely in a few steps:

1. Using the file explorer, go to "C:\Users\<YourUserName>\Documents\My Games\Underrail\Saves\<YourSaveFileName>\".

2. Create a backup of global.dat and store it somewhere outside the save folder.

3. Using 7zip, extract the contents of global.dat (the resulting archive should be named global, but that can change if you have renamed global.dat to something else).

4. Open the extracted archive (global) using HxD

5. In HxD, press Ctrl+F and search for "paranoia".

The result, two columns with hexadecimal code on the left and its ANSI translation on the right, should look something like this:



As you can see, the name of the feat (right column, text highlighted in blue) is encoded as a series of octets (left column, hexadecimal code highlighted in blue). The missing information from the tutorial above is the string-length (left column, octet surrounded by a red square), which corresponds to the hexadecimal length of the feat name. This is a very common way of storing strings, so if you want to change the feat, at the very least this octet needs to be updated accordingly.


6. In the left column, swap-out the name of the feat encoded in hexadecimal code (in this case paranoia), for the name of the feat you want to swap-in (in this case forceuser). Since the name lengths do not match (paranoia < forceuser), you also need to update the string-length from 08 to 09.

The result in HxD should look something like this:




7. Save the modified (decompressed) global archive you just edited.

Now comes the unsafe part, and the reason why you made a backup of global.dat.

8. Using 7zip, open the original global.dat (Right-click -> 7zip -> Open Archive).

9. A 7zip window will open, where you should see a unmodified global archive inside. Drag your modified global archive to the 7zip window. This will overwrite the existing data with your modified one. It will ask if you are sure, accept.

10. In-game, reload the save you have just modified. Note that you should not need to restart the game at all.


The new feat should have replaced your old one. If the save cannot be loaded (i.e. it is corrupted), please leave a message here, I'd like to take a look.

Before you get any ideas, no, you cannot add feats in using this method.

The save file spec has been briefly discussed multiple times before: Oct 22 2016, May 6 2017, Jan 19 2020, Dec 13 2019. While it is true that there is a certain degree of obfuscation, I believe this is just a matter of having a public project dedicated to reverse engineering game files. It doesn't seem like any of us have much time or interest to do it, but if someone wants to start figuring things out I'd be happy to contribute code.

« Last Edit: February 01, 2020, 12:58:33 pm by davelsan »

Ikafati

  • Probably not a Spambot
  • *
  • Posts: 6
  • Karma: +1/-0
    • View Profile
Re: Anyway to cheat to fix my build?
« Reply #4 on: March 01, 2020, 07:54:39 pm »
Successfully respec'ed using the method provided by davelsan, thanks a lot

Two important things to know is that 1 - Feats with multiple words get grouped into 1 and the space between them is not counted, so for example, "Cheap Shots" becomes "cheapshots" in hex editor and counts as 10 symbols instead of 11. 2 - When changing the symbol number value of the feat name, it goes 1:1 for names from 1 to 9 symbols, but changes for 10 or more symbol names. So for example, while "Paranoia" changed to "Force User" changes the symbol number value from 08 to 09, something like "Cheap Shots" would instead change to 0A, because that's the hexadecimal value for decimal 10. Use a decimal to hexadecimal converter and change accordingly.

davelsan

  • Probably not a Spambot
  • *
  • Posts: 10
  • Karma: +2/-0
    • View Profile
Re: Anyway to cheat to fix my build?
« Reply #5 on: March 06, 2020, 11:54:18 pm »
Feats with multiple words get grouped into 1 and the space between them is not counted, so for example, "Cheap Shots" becomes "cheapshots" in hex editor and counts as 10 symbols instead of 11..

I don't know if there is a naming scheme, but I know that some internal feat names are shortened a lot (e.g. aimed shot -> as; psi empathy -> pe, etc.).

I'd suggest to lookup feat names and their descriptions in "<Game_Folder>\Data\Knowledge\feats.k". Just extract the contents using 7zip as above and explore around with your hex editor.