Skip to content

SetPlayerItemHealth

Sets the condition of every item of a class the player carries.

A smith’s repair, a cursed blade, a restore: every item of the class in the player’s bag - worn or not - is set to health (0..100, the inventory’s percent: 100 = as good as the item can be) in the server’s records at once, and their game sets it the game’s own way a moment later (no OnPlayerItemWear comes of it). A GivePlayerItem of the class still on its way is made at the new condition too. A 0 breaks the item the way the game breaks one.

The id of one of the player’s tagged items (GivePlayerTaggedItem) in place of the class sets that one item alone - a tournament prize repaired, a cursed blade that never wears out - while the other items of its class keep their condition. It answers 1.

SetPlayerItemHealth(pid, item, health)
Parameter Type
pid number the player
item string | number the item’s name, id, English name or GUID - or a tagged item’s id
health number the condition, 0..100

number - how many items were set (0 when they carry none, or the item is not in the catalogue)

-- the smith's command: everything they wear made new, for a price
function RepairWorn(pid)
for _, class in ipairs(GetPlayerEquipment(pid)) do
SetPlayerItemHealth(pid, class, 100)
end
end
-- one tournament prize mended, the player's other longswords untouched
SetPlayerItemHealth(pid, "prize-2026-spring", 100)

GetPlayerItemHealth · SetItemWear · OnPlayerItemWear · GivePlayerTaggedItem · the Items and inventory group of the index