Page 1 of 1

Newbie Attempt: Pathfinder Kingmaker Script

Posted: Sat Oct 20, 2018 5:23 am
by Doombeard762
Hi!

I just recently started reading about LUA in an attempt to create my own "Level Up" script for Pathfinder Kingmaker. I'm not yet sure how to correlate the memory address for the current instance to the variable, or if this is even the correct way to go about it. Any tips/pointers is appreciated!

Code: Select all

function xpBtnClk1(sender)
--Get Current XP amount
currentXP = ;

--Get Max XP for This Level
currentLevel = ;

--Level Up - Set Current to Max +1
currentXP = currentLevel +1;

return currentXP;

end

Re: Newbie Attempt: Pathfinder Kingmaker Script

Posted: Sat Oct 20, 2018 10:14 am
by TimFun13
Doombeard762 wrote:
Sat Oct 20, 2018 5:23 am
Hi!

I just recently started reading about LUA in an attempt to create my own "Level Up" script for Pathfinder Kingmaker. I'm not yet sure how to correlate the memory address for the current instance to the variable, or if this is even the correct way to go about it. Any tips/pointers is appreciated!

Code: Select all

function xpBtnClk1(sender)
--Get Current XP amount
currentXP = ;

--Get Max XP for This Level
currentLevel = ;

--Level Up - Set Current to Max +1
currentXP = currentLevel +1;

return currentXP;

end
You'll need to read and write to the memory location (address); so you'll need to know the value type and size, for this you'll just have to see how the game uses the value. And then you need to create a symbol for the address in a separate hook, or find/create a static pointer; to use with the Lua read or write.

But for what you have there; you'll need to find address for experience, and an array to all level experience limits. Just doing a plus experience might be easier.

There is a file in the CE (EXE) folder, "celua.txt" that has the current CE Lua documentation.
Here are some links to the CE Wiki for Lua.
[Link]
[Link]

Here's a "level current weapon" script from my Borderlands 2 table as an example.

Code: Select all

local playerLevel = readInteger('[[[ptrBaseHook]+8]+24]+258')
local weaponAddr = getAddressSafe('[ptrWeaponHook]')
if weaponAddr ~= nil and playerLevel > 0 then
	writeInteger(weaponAddr + 0x1E0, playerLevel)
	writeInteger(weaponAddr + 0x1E4, playerLevel)
	writeInteger(weaponAddr + 0xE3C, playerLevel)
	writeInteger(weaponAddr + 0xE6C, playerLevel)
end