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

Pink Eye

Monk
Patron
Joined
Oct 10, 2019
Messages
6,195
Location
Space Refrigerator
I'm very into cock and ball torture
This:
ud1AIQE.png


What do?
 

LannTheStupid

Товарищ
Patron
Joined
Nov 14, 2016
Messages
3,195
Location
Soviet Union
Pathfinder: Wrath
You absolute fucking degenerate, avoiding special characters in names is not simply a "best practice". It's the only true basis of our civilization.
Half of the characters in my name are "special" to you. Welcome, Игорь Юрьевич Кузнецов.
 
Joined
May 10, 2020
Messages
56
Not right now
if you are using a button here you go
if (GUILayout.Button("Apply")) {
Game.Instance.Player.GainMoney(100);
}

then you could swap out the 100 with the variable
 

LannTheStupid

Товарищ
Patron
Joined
Nov 14, 2016
Messages
3,195
Location
Soviet Union
Pathfinder: Wrath
Also, thank you for a very down-to-earth modding tutorial that you're making here. I have an idea for a mod, too, and no experience in C#.
 

LannTheStupid

Товарищ
Patron
Joined
Nov 14, 2016
Messages
3,195
Location
Soviet Union
Pathfinder: Wrath
You have the prompt for the user to input something. Call your variable "goldPrompt". This is the text "Input Amount..."
Then you have the user input. It is a string. Call it "inputGold".
Then you try to convert inputGold which is a string (like the string "300") into an integer value. And store it in the integer variable "gold".
 

Efe

Erudite
Joined
Dec 27, 2015
Messages
2,604
public static int finalBuildPointAmount = 1;
private static string buildPointAmount = "1";
one is string other is integer.
buildPointAmount = GL.TextField(buildPointAmount, 10, GL.Width(85f));
this makes value of this variable point to string in textbox

public static void SettingParse(ref string stringSetting, ref int finalSetting) {
if (int.TryParse(stringSetting, out int result)) {
finalSetting = result;
} else {
stringSetting = "";
}
}
copied this directly from bag of tricks. it merely does what anon suggested and tries to turn string into integer.
if it fails it makes result an empty string.

if (GL.Button($"+{buildPointAmount} BP", GL.Width(160f))) {
if (!buildPointAmount.Equals(""))
KingdomState.Instance.BP = KingdomState.Instance.BP + finalBuildPointAmount;
}
this adds bp amount in textbox to kingdom as long as textbox is not empty string like this: ""
combined with settingparse() this should prevent illegal input but honestly i didnt try that yet. might have to format input in other ways otherwise.
 

Efe

Erudite
Joined
Dec 27, 2015
Messages
2,604
why do you have a goldprompt string.
use goldamount you declared earlier?
 

LannTheStupid

Товарищ
Patron
Joined
Nov 14, 2016
Messages
3,195
Location
Soviet Union
Pathfinder: Wrath
I will try to explain in pseudocode, because your error is not about C#, but about the logic.

Step 1. Define the prompt
string goldPrompt ="Input Amount of Gold: "

Step 2. Define the variable for user input
string goldInput =""
(the string is empty, because we do not know what a user will enter)

Step 3. Get the user input
This is something specific to C#, but you need to pass your prompt and somehow get your input.
goldInput =GUI.TextField(new Rect(10, 10, 200, 20), goldPrompt, 25)

Step 4. Convert the user input from string to integer to use in further calculations
int gold = Convert.ToInt32(goldInput)

Again, this is not a code to use. This is the logic one should follow.

Hope it helps.
 

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