Skip to content

OnPlayerLootActor

A player wants to search a dead actor’s or animal’s body - return false to refuse.

Fires for a body that holds what the mode put on it (SetActorLoot) when a player within reach uses the game’s loot prompt on it. Nothing has opened yet. Return false and nothing opens, without a word; return a text after the false and their chat shows it (return false, "The hunter's mark is on it."). Otherwise the game’s own search screen opens on the body’s list, and what they take is theirs (the list loses it). One player searches a body at a time.

function OnPlayerLootActor(pid, id)
-- ...
end
Parameter Type
pid number the player
id number the dead actor or animal

false refuses saying nothing, false, "text" refuses and tells the player that text; anything else lets them search

-- only the hunter who brought the deer down may skin it
function OnActorDeath(id, killer)
if killer >= 0 then SetEntityData(id, "hunter", killer) end
end
function OnPlayerLootActor(pid, id)
local hunter = GetEntityData(id, "hunter")
if hunter and hunter ~= pid then return false, "This kill belongs to " .. GetPlayerName(hunter) .. "." end
end

SetActorLoot · GetActorLoot · OnActorDeath · the NPC actors group of the index