SetPerkEffects
The game’s health perks on this server - Revenant’s regeneration, Diehard’s save from a killing blow and the prayer’s Guardian Angel.
The server owns every player’s health, so a perk whose effect is a health change cannot work in the player’s own game online:
the server plays it instead, to every player who holds the perk (their game reports it, and so do SetPlayerProgress and
AddPlayerPerk). Revenant and Diehard are on by default, with the game’s own numbers; the Guardian Angel is off until
the mode sets guardianAngel = true.
Revenant: health comes back revenantRate a second (0.125) up to revenantCap of the maximum (0.5 = 50 of 100),
revenantIICap with Revenant II (0.75) - never in a fight (with a player, an NPC actor or an animal), in the game’s own
combat mode, while bleeding or knocked out, nor for revenantPause seconds (5) after a blow taken. A potion’s healing adds
to it.
Diehard (the game’s “Hard to kill”): a blow from a player, an NPC actor or an animal that would kill the player leaves them
at 1 health and heals diehardHeal (25) over diehardSeconds (2); another killing blow while that heal runs is survived
the same way, and once it ends the perk rests diehardCooldown seconds (3000) before it saves again. A fall, a bleed-out or
SetPlayerHealth is never saved, and the player’s death callback does not run for a save.
Guardian Angel: a player with Fundamentals of Divinity who prays at a shrine gets the game’s Guardian Angel; it saves them
from one killing blow the way Diehard does (1 health, the same heal, killing blows inside it survived too), and then it is
spent and gone from their game. The game’s own limit of 12 game hours (24 with Fundamentals of Divinity II) still applies. A
player who also holds Diehard is saved by Diehard first; their prayer adds no second save. A mode can give the angel itself
with GivePlayerBuff ("perk_basic_theology") - it saves the same way, Fundamentals of Divinity or not, while the angel is
on. Turn it on in OnGameModeInit: a player already in the game when it is turned on counts their prayer from their next join.
revenant = false or diehard = false switches that effect off. A key left out keeps the game’s number;
SetPerkEffects(nil) goes back to them all (the angel off).
Syntax
Section titled “Syntax”SetPerkEffects(rules)| Parameter | Type | |
|---|---|---|
rules |
table | {revenant=, revenantRate=, revenantCap=, revenantIICap=, revenantPause=, diehard=, diehardHeal=, diehardSeconds=, diehardCooldown=, guardianAngel=}; nil = the game’s own |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”-- a hardcore server: no regeneration, and Diehard rests ten minutesSetPerkEffects({ revenant = false, diehardCooldown = 600 })
-- Revenant twice as fastSetPerkEffects({ revenantRate = 0.25 })
-- the prayer's Guardian Angel on this server (off unless a mode turns it on)SetPerkEffects({ guardianAngel = true })
-- a chaplain's blessing: the mode gives the angel itself (/bless, an admin's command of the mode's own; the angel must be on)GivePlayerBuff(pid, "perk_basic_theology")See also
Section titled “See also”GetPerkEffects · AddPlayerPerk · HasPlayerPerk · GivePlayerBuff · SetBleedRules · the Vitals group of the index
