Skip to content

Coding tips

When searching through the Lua types, you may find a GetSomething function on a class, but it doesn't return anything.
To get a return value from a GetSomething function you need to:

lua
-- Get the BP_StoreManager as a class
local mgr = FindFirstOf("BP_StoreManager_C")
-- Create an output table
local out = {}
-- The Money value will be stored in the output table
mgr:GetMoney(out)
-- Get the value of out.Money and print it out
-- Money is the name of the parameter that the GetMoney function has
print(string.format("Money: %s", out.Money))

When trying to use self from RegisterHook, you may encounter an UObject reference is nullptr error. To actually get self you need to:

lua
RegisterHook("/Game/BPs/AI/Employees/BP_Employee.BP_Employee_C:ReceiveBeginPlay", function(self)
    local employee = self:get()
    -- do stuff here with the employee
end)

More

Palworld modding wiki, UE4SS wiki and UE Modding repository have useful stuff.
You can look at how other mods were built on NexusMods by just downloading them and looking at the Lua files.
You can ask questions on the GSS Modding Community Discord server.