Itutorial
Excellent OT User
- Joined
- Dec 23, 2014
- Messages
- 2,325
- Solutions
- 68
- Reaction score
- 999
Can anyone tell me why this doesn't work? Player should always lose backpack without AOL. Nothing else unless redskull.
Player doesn't lose backpack is the problem.
Player is above level 50, no skull, no AOL, and isnt nogenloot
Lua:
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
return true
end
local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) then
player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
return true
end
if player:getLevel() < 50 then
return true
end
if table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) then
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(i)
if item then
if not item:moveTo(corpse) then
item:remove()
end
end
end
else
local backpack = player:getSlotItem(CONST_SLOT_BACKPACK)
if item then
if not item:moveTo(corpse) then
item:remove()
end
end
end
if not player:getSlotItem(CONST_SLOT_BACKPACK) then
player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
end
return true
end
Player doesn't lose backpack is the problem.
Player is above level 50, no skull, no AOL, and isnt nogenloot
Last edited: