Skip to content

GetPlayerNourishment

How well fed the player’s character is.

The character’s nourishment (food) in the game’s own scale and the most it can hold, as the player’s game last reported them - and, under [audit] mode = "enforce", never above the game’s own maximum of 150, since a value over it is put back. The game runs it down as the character goes about and up as they eat. After a SetPlayerNourishment made before the player’s game has reported, the value is the one set and the maximum is 0 until the first report - check max before you divide by it.

GetPlayerNourishment(pid)
Parameter Type
pid number the player

number | nil, number | nil - value, max - the nourishment and its maximum, which is 0 while only the mode’s own set is known; nil until the player’s game has reported or the mode has set it, or for a player not connected

local food, max = GetPlayerNourishment(pid)
if food and max > 0 and food < max * 0.2 then GameText(pid, "You are starving", 2000, GAMETEXT_LOWER) end

SetPlayerNourishment · GetPlayerEnergy · GetPlayerProgress · the Stats, skills, XP and perks group of the index