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.

Pathfinder: Kingmaker Modding Thread

Efe

Erudite
Joined
Dec 27, 2015
Messages
2,597

these tell you about structure of data inside game.
like you can infer from above image how there is a sourcedeck which every event is copied from to current carddeck.

remember the piece of code that adds toughness feat to player? that guid is for toughness. its a unique string representing an object/data/whatever.
everything has one.
 

Pink Eye

Monk
Patron
Joined
Oct 10, 2019
Messages
5,797
Location
Space Refrigerator
I'm very into cock and ball torture
FbLm9QJ.png
 

John Keel

Savant
Joined
Aug 10, 2017
Messages
694
Exemple how to manipulate shit, in this case change the Shuriken weapon type to light.

First, you find the correct JSON in this mess:

Shuriken.e54eafe37766a064c98e702fdfa6328f.json

Code:
var test = ResourcesLibrary.TryGetBlueprint<BlueprintWeaponType>("e54eafe37766a064c98e702fdfa6328f");
Harmony12.AccessTools.Field(typeof(BlueprintWeaponType), "m_IsLight").SetValue(test, true);

TryGetBlueprint<X> needs a Blueprint's GUID of type BlueprintWeaponType

Its in the name of the file and in the file as a parameter itself:

"m_AssetGuid": "e54eafe37766a064c98e702fdfa6328f"

We store the reference in the var Test

Then, AccessTools.Field allow us to acces , change and set the parameter of an Object; in this case we set the "m_IsLight" value of test(e54eafe37766a064c98e702fdfa6328f) to true.

Disclaimer: This shit is mostly from memory, it's probably very wrong, but you get the gist
 

John Keel

Savant
Joined
Aug 10, 2017
Messages
694
MasterworkLongsword.571c56d11dafbb04094cbaae659974b5 is a BlueprintItemWeapon, it's not the same as a BlueprintWeaponType.

571c56d11dafbb04094cbaae659974b5 'inherit' from d56c44bc9eb10204c8b386a02c7eed21
 

John Keel

Savant
Joined
Aug 10, 2017
Messages
694
If you modify a BlueprintWeaponType, it impact every items relying on it, ie:

In my exemple, all shurikens become light weapon

A BlueprintItemWeapon is more 'granular', you use it to create a new class of object deriving from a parent one to change some aspects, ie:

Flaming, masterwork swords etc...

If you want to make a unique/new items, you have to 'create' it from scratch (kinda)
 
Last edited:

Efe

Erudite
Joined
Dec 27, 2015
Messages
2,597
UnitEntityData unitEntityData = Game.Instance.Player.MainCharacter;

unitEntityData.Descriptor.AddFact((BlueprintUnitFact)Utilities.GetBlueprintByGuid<BlueprintFeature>("d09b20029e9abfe4480b356c92095623"), (MechanicsContext)null, new FeatureParam());
I just copied from bag of tricks

if you want to search for arcane, right click UnitEntityData class, go to definition.
There you can inspect everything it has.
Then go to UnitDescriptor class. which has stuff like helmet visibility toggle to spellbooks.
we will figure it out but try not to rush. at least im not rushing.
 

Pink Eye

Monk
Patron
Joined
Oct 10, 2019
Messages
5,797
Location
Space Refrigerator
I'm very into cock and ball torture
>we will figure it out but try not to rush. at least im not rushing.
In that case I am taking a break. Been working on that gold mod for days.
 
Last edited:

Efe

Erudite
Joined
Dec 27, 2015
Messages
2,597
we still havent chosen a goal.
I was hoping for a talking sword
You wanted monk feats. a single feat or whole styles? not sure
White anon wants valerie romance i guess.
 

Efe

Erudite
Joined
Dec 27, 2015
Messages
2,597
try - main job
catch - possible problems and do workarounds
finally - clean up

you are just suppressing the problem i think
 

Terra

Cipher
Joined
Sep 4, 2016
Messages
897
If you want to get something a little more robust, TryParse further streamlines things for this particular usage case.
Code:
private static void OnGUI(UnityModManager.ModEntry modEntry)
{
    goldAmount = GUI.TextField(new Rect(10,10,200,20), goldAmount, 25);
 
    //if the user clicks the enter button and they entered something we can convert to a valid integer (checked by TryParse)
    if(GUILayout.Button("Enter") && int.TryParse(goldAmount, out finalGoldAmount))
    {
        Game.Instance.Player.GainMoney(finalGoldAmount);
    }
}
The reason that exception (the one you got after deleting the text via backspace) occurred with your code after using backspace is you were passing an empty string to int.Parse. No need to do it right now but read up on Parse/TryParse here - https://docs.microsoft.com/en-us/do...ide/types/how-to-convert-a-string-to-a-number. And as always with coding, this is but one of several possible solutions.

Case matters in C#. You're trying to call a method called "Load" in your Info.json EntryMethod, but in your source code you have a method called "load".
 

Efe

Erudite
Joined
Dec 27, 2015
Messages
2,597
pink you can do tryparse
since this is used for every textbox, bag of tricks created a SettingParse method and calls it whenever. a copy of it is in gold mod.

they way you are doing is wrong you can find many examples if you google "try catch c#"

ur code ignores errors because they are inside "try".

add
catch(overflowexception e) goldamount="1"
so wrong input becomes 1
 
Last edited:

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