Skip to content

SetPlayerPerkPoints

Sets the perk points a stat, a skill or the main level has not spent yet.

name is a stat’s or skill’s name, or mainlevel for the main level’s pool (the points that belong to no stat or skill); points is 0 .. 999. The count is what it says - a smaller one takes points away - and the level is left as it is. The player’s game puts the points on the character, and the record (GetPlayerPerkPoints) holds them at once. Called before the player is in the world, the set waits for their spawn and is applied right after it, in the order it was made.

SetPlayerProgress sets the points too, together with the levels; this is the call for the points alone (SetPlayerStat and SetPlayerSkill leave them). Like the other sets it does not reach OnPlayerProgressChange, which is for what the player’s game did.

SetPlayerPerkPoints(pid, name, points)
Parameter Type
pid number the player
name string a stat’s or skill’s name, or mainlevel for the pool
points number 0 .. 999

boolean - false for a name that is neither a stat nor a skill, a number outside 0..999, or a player not connected

-- the swordmaster's gift: three more points to spend on swordsmanship perks
local points = GetPlayerPerkPoints(pid, "weapon_sword")
SetPlayerPerkPoints(pid, "weapon_sword", points + 3)
-- and a clean slate for the points that belong to no skill
SetPlayerPerkPoints(pid, "mainlevel", 0)

GetPlayerPerkPoints · SetPlayerProgress · SetPlayerStat · AddPlayerSkillXP · the Stats, skills, XP and perks group of the index