Jump to content

[Tutorial] Making potions usable outside of combat


Recommended Posts

Yesterday I managed to sneak through the Temple of Eothas, but was stumped at the last bit with the slimes around the pool. I couldn't get past them and I sure as hell couldn't defeat them (Solo PotD), so I devised a plan: Lure the nearby Skuldr family to the pool, run like hell (had the Fast Runner talent) and watch the carnage.

 

I quickly discovered that this was nearly impossible, because they shoot corrosive gunk at you. Well, then I'll just craft a potion of Bulwark against the Elements and drink that before I run! 

 

What. 

 

Long story short, someone thought it made sense to have potions undrinkable outside of combat. You can chug all the beer you want, but drink from a vial, nope. Well, I've had enough of that. I refuse to jump through their hoops. I will bend the game to my will, using the power of applied computer science. Here's how you do that.

 

 

Step 1: The file.

 

Download a program called UABE, short for Unity Asset Bundle Extractor. You need that to edit .unity3d files (well, not edit directly, but look through them). You can also use Disunity version 4, if you find that easier, but for this guide I will assume you are using UABE.

 

Go to the PillarsOfEternity_Data\assetbundles\prefabs\objectbundle folder. Boy, that's a lot of files. This is where most of the game's items, spells, abilities and such are stored. We need to edit one of these files, specifically the one for the Bulwark potion.

 

Find the "potion_of_bulwark_against_the_elements_l2.unity3d" file, start UABE and open that file with it. It should say "CAB" followed by a lot of gobbledygook in the text field. Click the "Info" button.

 

 

Step 2: The value we want to change.

 

In the window that just popped up you'll see a bunch of different assets, representing all the various info the game uses for that potion. We're not interested in the Textures and particle effects and such, what we want to do is modify the potion variable that designates it as unusable outside of combat. That means we need to look at the MonoBehaviour types, scroll all the way down to see those.

 

Well, that's not very helpful. They all look identical, apart from the byte size. But intuitively enough, the biggest one is the one that handles the potion ability itself, and that's where our value hides. Click on that MonoBehaviour, and then "View Data"

 

Doubleclick the Monobehaviour Base thing to expand it. Hurray, variables! See an interesting one? That's right, "CombatOnly", and it's set to 1. Now we know what variable to change... but how do we do that? Read on.

 

 

Step 3: The hex editor

 

Download a program called XVI32. Copy the potion .unity3d file to a new location, and open it there with XVI32. You may think you just stepped into the Matrix, but what you're seeing is really just the bits and bytes of the file, and you now have full access to those, which makes you very 1337 indeed. Each block in the grid represents a byte. A number is stored as four bytes in hexadecimal format, for example the number 9 is stored as 09 00 00 00, the number 10 is stored as 0A 00 00 00, 12 is stored as 0C 00 00 00 and 20 is stored as 14 00 00 00. Easy!

 

Now, you may be tempted to search for "CombatOnly" and edit the value next to it, but unfortunately it's a little more complicated than that. The variable names are stored at a completely different location than the values that they represent, so if you want to change the values you need to find out where they are stored. 

 

That's not an easy task, but one thing that's helpful to know is that they are stored contiguously, i.e. the values appear in the file in the same order that they appear in UABE. Speaking of which, go back to the UABE and look at the variables surrounding CombatOnly. 

 

You should see a Duration of 60.0, then a bunch of variables set to 0, then the CombatOnly at 1, another bunch of zeroes, a 7, a 1, a 0 and then another 60.0. If we can find this pattern in the file, we will know where CombatOnly hides, and then we can change it! But if we just search for 7, 1 or 0 we will end up with thousands of results. We need to search for the number 60.0, as it stands out a bit more. Specifically, the floating point representation of it. 

 

 

Step 4: Finding the value

 

60.0 is a floating point value, which means it can have decimals (integers cannot), But, where integers in the file are stored as 01 00 00 00, 02 00 00 00 and so on, floating point values are stored in a completely different way that is not intuitive at all. We need to find the hexadecimal representation of 60.0, and luckily this website will do just that: http://www.h-schmidt.net/FloatConverter/IEEE754.html

 

If you input 60.0 in the decimal box there, it outputs 42 70 00 00. However, this is what is known as "big-endian" format. In the .unity3d file integers are stored big-endian, but floating point values are little-endian! So what we need to do is to swap the bytes, resulting in 00 00 70 42. This is the number we're looking for. 

 

 

Step 5: The magic moment

 

Go back in XVI32 and open the Search -> Find dialog. Select "Hex string" and enable Case Sensitive. Remember that the MonoBehaviours in UABE were all the way at the bottom in the list? That means you should start your search a fair bit down, by putting the cursor somewhere roughly at 25% from the bottom of the scrollbar. Input 00 00 70 42 in the hex field, and press Search. It should take you to the next occurrence of that value in the file, down from where you started.

 

Look at the hex values where you ended up, going from left to right and then to the next line. Does it look like the 60.0-zeroes-1-zeroes-7-1-0-60.0 pattern we found earlier? If not, press F3 on your keyboard to search again. If it does - congratulations. You are a master hacker.

 

Put your cursor at the 01 that represents CombatOnly, and type 00. Do not use backspace, this will delete bytes and you do not want that. Just type 00. Then save the file, put it back in the folder where you found it (maybe backup the original one first), and launch Pillars of Eternity. You can load a saved game or start a new one, but the important thing is that you can now do this:

 

http://i.imgur.com/rYfBZhH.jpg

 

And that's something to be proud of.

  • Like 7
Link to comment
Share on other sites

Intresting stuff, thanks.

 

Btw.  If You intrest in, IE mod also have option to use skills,potions outside the combat.

Cool!

Skills I feel is a bit too much, but I would love to have scrolls and potions usable outside combat.

 

Any chance it will also let you place more than one trap?

Link to comment
Share on other sites

  • 3 years later...

I know this topic is quite old but any chance you could explain how to actually swap item graphics, e.g. Jack of Wide Waters to look like whatever other armor? Meaning 3D model not just the icon. 

Per aspera ad astra

Bez tytułu.png

Link to comment
Share on other sites

On 12/16/2019 at 4:50 PM, Frykas said:

I know this topic is quite old but any chance you could explain how to actually swap item graphics, e.g. Jack of Wide Waters to look like whatever other armor? Meaning 3D model not just the icon. 

Manged to do it by myself, if someone is looking for an aswer to my question instruction how to do it is here 

 

Per aspera ad astra

Bez tytułu.png

Link to comment
Share on other sites

  • 6 months later...

Man the effort you went to here is just so good,,,  I have not been able to even play POE as I cant spirit **** out of battle..  my favorite game in the world is BG2 and that was the whole fun for me bombing around as a Werewolf (I must have somethhing wrong with me I am sure..but I am not alone with this pet peave).   This saves it    whether I get it working or not the thought that there are those out there willing to help like this is so good :)   And your joke about bending the computer to your will using applied computer science was grade A+ material and was not wasted on me

Edited by MICHAEL CORCORAN
Link to comment
Share on other sites

  • 4 years later...

Thanks for the guide. I was able to repeat these steps without using a hex editor. The UABE I got let me edit the values, not just view them. Pillars 1 has become markedly less painful to mod, though probably still painful per se.

You heard me, folks! You don't need to use a hex editor anymore.

My Deadfire mods
Out With The Good: The mod for tidying up your Deadfire combat tooltip.
Waukeen's Berth: Make all your basic purchases at Queen's Berth.
Carrying Voice: Wider chanter invocations.
Nemnok's Congregation: Lets all priests express their true faith.

Deadfire skill check catalogue right here!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...