dervin13
Active Member
- Joined
- Apr 26, 2008
- Messages
- 458
- Solutions
- 1
- Reaction score
- 28
Is it possible to make this autoloot collect the item inside the bag in corpse when you kill it?
thanks
thanks
Lua:
local function scanContainer(cid, position)
local player = Player(cid)
if not player then
return
end
local corpse = Tile(position):getTopDownItem()
if not corpse or not corpse:isContainer() then
return
end
if corpse:getType():isCorpse() and corpse:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == cid then
for i = corpse:getSize() - 1, 0, -1 do
local containerItem = corpse:getItem(i)
if containerItem then
for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
if player:getStorageValue(i) == containerItem:getId() then
containerItem:moveTo(player)
end
end
end
end
end
end
function onKill(player, target)
if not target:isMonster() then
return true
end
addEvent(scanContainer, 100, player:getId(), target:getPosition())
return true
end