Makin
New Member
- Joined
- Sep 17, 2018
- Messages
- 37
- Solutions
- 1
- Reaction score
- 2
Hi, I do not know how to make all containers / backpacks so that only the selected ones would fall out
I know so much about this fragment of the script "if hasSkull or math.random(item:isContainer() and 100 or 1000) <= lossPercent then"
sorry for my English
I know so much about this fragment of the script "if hasSkull or math.random(item:isContainer() and 100 or 1000) <= lossPercent then"
sorry for my English
Lua:
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
if getPlayerFlagValue(player, PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
return true
end
local amulet = player:getSlotItem(CONST_SLOT_RING)
local hasSkull = isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull())
if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not hasSkull then
local isPlayer = false
if killer then
if killer:isPlayer() then
isPlayer = true
else
local master = killer:getMaster()
if master and master:isPlayer() then
isPlayer = true
end
end
end
if not isPlayer or not player:hasBlessing(6) then
player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
end
else
local lossPercent = player:getLossPercent()
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(i)
if item then
if hasSkull or math.random(item:isContainer() and 100 or 1000) <= lossPercent then
if not item:moveTo(corpse) then
item:remove()
end
end
end
end
end
if not player:getSlotItem(CONST_SLOT_BACKPACK) then
player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
end
return true
end
Last edited: