Skip to content

GetActorInventory

An actor’s items, as SetActorInventory and GiveActorItem left them.

The weapon and the shield an actor drops at its death leave the list (they lie on the ground as pickups); the rest stays, for a mode that hands out loot from the corpse.

GetActorInventory(id)
Parameter Type
id number the actor

table | nil - a list of {class =, amount =, health =, worn =}; nil when the actor was never given items (its presets dress it)

function OnActorDeath(id, killer)
if killer >= 0 then
for _, item in ipairs(GetActorInventory(id) or {}) do
if not item.worn then GivePlayerItem(killer, item.class, item.amount) end
end
end
end

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