Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Pillars of Eternity Coding/Hacking Thread

mutonizer

Arcane
Patron
Joined
Sep 4, 2014
Messages
1,041
Yea, with all the possible combinations between move, attack, inspect and whatnot, things can get a little crazy sometimes when bound to identical stuff, or moved around.
 

Bester

⚰️☠️⚱️
Patron
Vatnik
Joined
Sep 28, 2014
Messages
11,003
Location
USSR
The colors themselves are on the Prefabs I think, not sure. I managed to make Friendly look Greyish instead of Green/Blue, like neutrals, but that's not really the point is it?

I think they're most likely to be textures with predefined colors, can't change them programmatically. Projectors cast a material on the ground in Unity.
 

agris

Arcane
Patron
Joined
Apr 16, 2004
Messages
6,764
Is it possible to remove the ugly inspection icons, so that they only show when you press the highlight key? Even better would be if usable items only got a wireframe outline like in the Gates.
 

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
Possibly, yes.

By the way guys, I want to remove the recovery time pause when moving. That's easy to do in the Update() Method inside CharacterStats

if ((double) this.m_recoveryTimer > 0.0 && !this.IsMoving)
this.m_recoveryTimer -= Time.get_deltaTime();

However, recovery time still needs to be paused for firearms. What logic would I use to retain the firearm pause?

if ((double) this.m_recoveryTimer > 0.0 && !this.IsMoving && [something firearm] ?

Just need help with the last part
 

Bester

⚰️☠️⚱️
Patron
Vatnik
Joined
Sep 28, 2014
Messages
11,003
Location
USSR
Just need help with the last part

Hm, something like this.

Equipment tempThing = base.gameObject.GetComponent<Equipment>();
Weapon tempCurrentWeapon;

if (tempThing != null)
{
tempCurrentWeapon = tempThing.CurrentItems.PrimaryWeapon;
}

if (this.m_recoveryTimer > 0f && !this.IsMoving && (tempCurrentWeapon.WeaponType == "Arquebus" || tempCurrentWeapon.WeaponType == "Pistol"))
{
this.m_recoveryTimer -= Time.deltaTime;
}

p.s. your code looks a little different from mine, what did you decompile it with? I used ILSpy.
Also, I haven't tried recompiling anything yet, I'm flying blind here a little.

Oh and I just realized that you're also probably going to need to know which weaponset your character is using right now - primary or secondary.
I think you can find that out with tempThing.CurrentItems.SelectedWeaponSet - it's an int.
 

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
Bester it has to be for all firearms (pistol, arquebus, blunderbuss and arbalest), and it has to persist across weapon set changes as well. That code looks a bit convoluted, hopefully there's a simpler way of calling it.

I decompiled using dotPeek but I recompile using ilasm and editing the IL code (only way of doing it that works so far)
 
Last edited:

Bester

⚰️☠️⚱️
Patron
Vatnik
Joined
Sep 28, 2014
Messages
11,003
Location
USSR
Bester it has to be for all firearms (pistol, arquebus, blunderbuss and arbalest),

You can use any types you want from this enum

public enum WeaponType
{
Arbalest, Arquebus, BattleAxe, Blunderbuss, Club, Crossbow, Dagger, Estoc, Flail, GreatSword, Hatchet, HuntingBow, Mace, MorningStar, Pike, Pistol, Pollaxe, Quarterstaff, Rapier, Rod, Sabre, Stiletto, Sceptre, Spear, Sword, Wand, WarBow, WarHammer, Count
}

and it has to persist across weapon set changes as well.
Well why wouldn't it?
 

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
Bester

okay so what I'm thinking of doing is writing the method in a text file and then compiling it and getting the ildasm output and copy pasting it into the il of the Assembly-CSharp, do you think that would work ?
 

Bester

⚰️☠️⚱️
Patron
Vatnik
Joined
Sep 28, 2014
Messages
11,003
Location
USSR
Frankly, I literally had to google what IL was a few hours ago. I only have a vague understanding now.
 

SymbolicFrank

Magister
Joined
Mar 24, 2010
Messages
1,668
While wondering what the best way is to handle enumerating through lists in my own thread-safe, message-passing programming language, this thread came to mind.

If you want to be able to use multiple mods, you either need a mod manager that makes all the changes, like WeiDu, or you need an API that handles events (messages). The first solution still requires mod makers to know about and conform to other mods.

Then again, although message parsing will go a long way in making everything transparent, it isn't a silver bullet, either.

So, whatever you want to do: you need a mod manager. Literally. A person who will manage the mods.
 

SCO

Arcane
In My Safe Space
Joined
Feb 3, 2009
Messages
16,320
Shadorwun: Hong Kong
you always need something like mlox obviously, a expert system of mod compatibility (which is why it is surprising that there isn't a general tool for that yet with specific rules for different games). But weidu-likes make it possible for more mods to be compatible that wouldn't be if you just replaced files.

A listener api (what you're considering) makes for code that 'only' works for what the programmer thought to be 'listenable'. It may keep in check crazy modders that want to check every frame/tick for something, giving the control back to the programmer to decide the period (1/s) when it's 'necessary' to notify. Push not pull model.
 
Last edited:

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
Well that was easier than expected. Firearms reload independently of recovery time anyway. All I had to do was remove the check for isMoving.
 
Joined
Sep 18, 2013
Messages
1,258
Is it, or do you think it will be, possible to issue commands to the NPCs in combat? I'm thinking if the game can be modded to be turn based. For instance, you can literally make combat turn-based in TES/FO3 with extensively convoluted and clever scripting as the all the necessary commands and variables were provided for modders.

Granted, it would likely be an immense undertaking and perhaps not worth the effort but if the accessible data and the eventual modding provide the necessary tools, still a mind exercise.
 

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
Personally I'm not interested in that.

Btw guys, one thing that's really holding me back is the fact that I cannot get at the prefabs. I've tried various Unity decompiling tools and while some can pull files from them, I can't get any of the data I'm after (values for spells, abilities, characters, items etc)

The Source code should contain the IO class/code that reads those files yes? Such as one of the Polenters, or something in the actual Unity code itself. I'm pretty fucking awful at programming myself, but it would be good if someone could take a look at that for me and see if it's possible to create at least a command line tool to extract the data into a readable format. If the game can read it, we should be able to as well right ?

I did write a program that could read/write .csv files at uni, this would be more complicated but I'd have a stab if no one else was willing to.
 

Bester

⚰️☠️⚱️
Patron
Vatnik
Joined
Sep 28, 2014
Messages
11,003
Location
USSR
I've tried various Unity decompiling tools and while some can pull files from them, I can't get any of the data I'm after (values for spells, abilities, characters, items etc)
Have you tried disunity?

The Source code should contain the IO class/code that reads those files yes? Such as one of the Polenters, or something in the actual Unity code itself.
Nah, they're just standard unity files, they're not serialized with sharpserializer(polenter). PoE only uses sharpserializer for save game files.
On a side note, while fucking around with the assembly, I managed to force PoE to save game in form of human-readable xml files instead of binary. Sigh. I could write a savegame editor for a human-readable xml, but a savegame editor that requires you to modify the game files is as useless as a marzipan dildo. The binary save files are deserializable too, though, but considering the amount of work it requires... pfffff.

I can't get any of the data I'm after (values for spells, abilities, characters, items etc)
If you want to see what scripts prefabs contain and access their classes' attributes, I can offer you a way of doing it, but it's not an easy one. At least it seems difficult because I personally haven't found an easy way of injecting my own code. I managed to do it with .net reflector, but it's such a pain in the ass, that it's like forget about it.

Anyway, if you're going to do it, you need to instantiate the prefab you're interested in, like so: GameObject obj = Instantiate(Resources.Load(name_of_the_prefab_without_the_extension) as GameObject;
Then if you need to start guessing what scripts the prefab might contain. Like, let's say you want to see if a spell's prefab contains the SpellMaxCastLevelData. In order to check that, you do this:
SpellMaxCastLevelData foundclass = obj.GetComponent<SpellMaxCastLevelData>();
if (foundclass) write_to_console_that_you_found_a_class;
Then you can access its attributes very easily, of course.
 
Last edited:

Bester

⚰️☠️⚱️
Patron
Vatnik
Joined
Sep 28, 2014
Messages
11,003
Location
USSR
I wish somebody could just decompile the whole assembly completely, rewriting those yield-returns from scratch cause they can't be decompiled correctly automatically. I guess somebody might end up doing it eventually and then modifying anything will be a piece of cake.
 

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
I've tried various Unity decompiling tools and while some can pull files from them, I can't get any of the data I'm after (values for spells, abilities, characters, items etc)
Have you tried disunity?

Yeah, disunity can get some of the raw text, but it doesn't contain any information about any of the in game variables. I managed to get the creature stats from resources.assets, but nothing useful from any prefabs.

So none of the classes contain the IO that reads the prefabs?
 

Bester

⚰️☠️⚱️
Patron
Vatnik
Joined
Sep 28, 2014
Messages
11,003
Location
USSR
Yeah, disunity can get some of the raw text, but it doesn't contain any information about any of the in game variables.
Oh no, it contains everything, it's just that it's in binary (the files you get when you do "extract-raw").
If you need to find damaging values for spells, it's doable. Use a hex editor. They're either stored as ints or as floats. So let's say a fireball damages for 30 dmg.
1. You convert the number 30 into a 4 bytes hexadecimal.
2. You look for this number in binary files with a hex editor. Found it? Set it to 60 for example, repackage the asset, your fireball now hits for 60dmg.

I don't know any sites that make the necessary conversion so here's the code that does it:

float floattest = 99.9f; // 99 is an example
int inttest = 12; // example too
byte[] byteArray = BitConverter.GetBytes(inttest); // or use floattest
System.Console.WriteLine("Inspecting bytes of an int/float: " + BitConverter.ToString(byteArray));

Sometimes they use ints, sometimes floats, so try searching for both.

Now if you're going to look for values other than damage numbers, this method might not work at all. For example, if you're looking for a binary flag, you'll never find it, cause there's gonna be a hundred of "01" bytes, obviously.

So none of the classes contain the IO that reads the prefabs?
I don't know, I haven't looked :) If I stumble upon anything, I'll let you know.

Update: oops, forgot a line of code.
 

Sensuki

Arcane
Joined
Oct 26, 2012
Messages
9,799
Location
New North Korea
Codex 2014 Serpent in the Staglands Shadorwun: Hong Kong A Beautifully Desolate Campaign
Oh no, it contains everything, it's just that it's in binary (the files you get when you do "extract-raw").

there's also an extract-txt option which converts everything into readable text, but I don't see any values or anything that looks like stuff from the game, looks like there's missing text ... could be wrong though

Perhaps I'll try and write a hex converter like you suggested.
 

Bester

⚰️☠️⚱️
Patron
Vatnik
Joined
Sep 28, 2014
Messages
11,003
Location
USSR
there's also an extract-txt option which converts everything into readable text
No, it only converts to text what it can deserialize from the binary format. But there's tons of stuff it can't deserialize.
 

Bester

⚰️☠️⚱️
Patron
Vatnik
Joined
Sep 28, 2014
Messages
11,003
Location
USSR
I haven't actually got Unity installed on my PC though.
You might just need to.

I managed to deserialize the assets (spells, abilities, items, everything), but I've only tested it on spells yet.

I've tried altering the damaging values for a certain spell, but for some reason the game keeps using old values. I'll see about it tomorrow or after-tomorrow. Once I get the complete workflow, I'll send you everything you need.

In the meantime, in case I die or something less spectacular like "suddenly lose all interest", here's what you need to know. Initially the problem was that in order to deserialize something, you always need all the scripts associated with the serialized information, because they contain obligatory data, like types and structure (or something along the lines). So without the game's source code, can't deserialize assets.
I tried to hook up Assembly-CSharp.dll before, because it actually contains everything you need, but that dll contained some references, like Assembly-CSharp-firstpass.dll and some others, which if you tried to hook up as well, Unity threw tons of errors (some conflicts with names or I don't know what).
So in order to avoid that problem, you take the code from ILSpy and manually correct or throw out everything that refuses to compile. Once it's done, you're good to go. You extract any asset you want with "disunity bundle-extract", rename the resulting file to whatever.asset and import it into Unity.

And then, here's how it's gonna look:

fan_of_flame.jpg
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom