Skip to content

OnPlayerButcher

A player wants to butcher a dead animal - return false to refuse.

Fires when a player within reach holds the game’s “Butcher” on a carcass you made butcherable (SetActorButcher). Nothing has happened yet. Return false and nothing happens, without a word; return a text after the false and their chat shows it. Otherwise their game butchers it - the animation, then the game’s own meat to take from the carcass - and the others see them at it.

function OnPlayerButcher(pid, id)
-- ...
end
Parameter Type
pid number the player
id number the carcass

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

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

SetActorButcher · IsActorButchered · OnPlayerLootActor · the NPC actors group of the index