• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

new infinite aol not working 1.4x

2057623

Member
Joined
Jan 16, 2012
Messages
97
Reaction score
12
I added 3 new necklaces on my server, but even with them players lose loot, most of the time they lose the entire backpack.
I already tried to use

<attribute key="preventDrop" value="1" />

it still won't lose, then I saw a topic that says that in a 1.x+ server they use a code for aol, it doesn't lose anything, and in my code I found it called "droploot" but there's no way to put the item ID or something, I tried modifying but it gave error, if someone can modify or pass some code that these 3 paste works like aol and is unlimited thank you.


function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
return true
end

local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
local isRedOrBlack = table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull())
if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not isRedOrBlack 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
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(i)
local lossPercent = player:getLossPercent()
if item then
if isRedOrBlack or math.random(item:isContainer() and 100 or 1000) <= lossPercent then
if (isRedOrBlack or lossPercent ~= 0) and 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

I'll pass the id and names of the items in case you need it.

18402 Ceifadora Sombria Colar
10220 Radiante da Virtude Colar
18407 Arcanum Celeste Colar


These are the 3 necklaces. Please, can someone help me
 
Solution
E
try this:
Lua:
function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
        return true
    end

    local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
    local isAol = {ITEM_AMULETOFLOSS, 18402, 10220, 18407}
    local isRedOrBlack = table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull())
    if amulet and table.contains(isAol, amulet.itemid) and not isRedOrBlack then
        local isPlayer = false
        if killer then
            if killer:isPlayer() then
                isPlayer = true
            else
                local master = killer:getMaster()
                if...
Here it is. Just enter the IDs and test. You won't lose the entire backpack, just the Amulet of Loss when you die. It should work for you.


Lua:
local amulet = 18402

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    if isPlayer(cid) then
        local playerAmulet = getPlayerSlotItem(cid, CONST_SLOT_NECKLACE)
        if playerAmulet.itemid == amulet then
            if getCreatureSkullType(cid) == SKULL_RED or getCreatureSkullType(cid) == SKULL_BLACK then
                doCreatureSetDropLoot(cid, FALSE)
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
            end

            doPlayerRemoveItem(cid, amulet, 1)
        end
    end
    return true
end

XML:
<!-- Aols -->
    <event type="preparedeath" name="aol" script="aol.lua" />
login.lua
Lua:
player:registerEvent('aol')

If you want the infinite Amulet of Loss, just delete that line.
doPlayerRemoveItem(cid, amulet, 1)
 
Last edited:
try this:
Lua:
function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
        return true
    end

    local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
    local isAol = {ITEM_AMULETOFLOSS, 18402, 10220, 18407}
    local isRedOrBlack = table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull())
    if amulet and table.contains(isAol, amulet.itemid) and not isRedOrBlack 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
            if amulet and amulet.itemid == ITEM_AMULETOFLOSS then
                player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
            end
        end
    else
        for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
            local item = player:getSlotItem(i)
            local lossPercent = player:getLossPercent()
            if item then
                if isRedOrBlack or math.random(item:isContainer() and 100 or 1000) <= lossPercent then
                    if (isRedOrBlack or lossPercent ~= 0) and 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 by a moderator:
Solution
Here it is. Just enter the IDs and test. You won't lose the entire backpack, just the Amulet of Loss when you die. It should work for you.


Lua:
local amulet = 18402

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    if isPlayer(cid) then
        local playerAmulet = getPlayerSlotItem(cid, CONST_SLOT_NECKLACE)
        if playerAmulet.itemid == amulet then
            if getCreatureSkullType(cid) == SKULL_RED or getCreatureSkullType(cid) == SKULL_BLACK then
                doCreatureSetDropLoot(cid, FALSE)
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
            end

            doPlayerRemoveItem(cid, amulet, 1)
        end
    end
    return true
end

XML:
<!-- Aols -->
    <event type="preparedeath" name="aol" script="aol.lua" />
login.lua
Lua:
player:registerEvent('aol')

If you want the infinite Amulet of Loss, just delete that line.
This one didn't catch, it still keeps losing BP, and sometimes it loses some item from the random set.

try this:
Lua:
function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
        return true
    end

    local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
    local isAol = {18402, 10220, 18407}
    local isRedOrBlack = table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull())
    if amulet and table.contains(isAol, amulet.itemid) and not isRedOrBlack 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
    else
        for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
            local item = player:getSlotItem(i)
            local lossPercent = player:getLossPercent()
            if item then
                if isRedOrBlack or math.random(item:isContainer() and 100 or 1000) <= lossPercent then
                    if (isRedOrBlack or lossPercent ~= 0) and 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
This code worked for donated items, but the Amulet of loss, when you die with it, loses loot and the amulet of loss doesn't disappear, it stays. Both the Amulet of loss and the donated necklace did not want to lose an item, but only AOL I wanted it to be removed from the player after death, the donated items are infinite.
 
This code worked for donated items, but the Amulet of loss, when you die with it, loses loot and the amulet of loss doesn't disappear, it stays. Both the Amulet of loss and the donated necklace did not want to lose an item, but only AOL I wanted it to be removed from the player after death, the donated items are infinite.
I've update the post with the new code, can you test it?
 
Sorry for the delay, I tested it here, AOL is now losing loot when it dies, even though it has AOL and when it dies, it doesn't add AOL.
Now the donated items are working 100%.
sorry, forgot to add its id to the isAol array, add it there and it should work as intended
 
sorry, forgot to add its id to the isAol array, add it there and it should work as intended
Friend same thing, nothing has changed, my code is this.

function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
return true
end

local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
local isAol = {18402, 10220, 18407}
local isRedOrBlack = table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull())
if amulet and table.contains(isAol, amulet.itemid) and not isRedOrBlack 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
if amulet and amulet.itemid == ITEM_AMULETOFLOSS then
player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
end
end
else
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(i)
local lossPercent = player:getLossPercent()
if item then
if isRedOrBlack or math.random(item:isContainer() and 100 or 1000) <= lossPercent then
if (isRedOrBlack or lossPercent ~= 0) and 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
 
Friend same thing, nothing has changed, my code is this.

function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
return true
end

local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
local isAol = {18402, 10220, 18407}
local isRedOrBlack = table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull())
if amulet and table.contains(isAol, amulet.itemid) and not isRedOrBlack 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
if amulet and amulet.itemid == ITEM_AMULETOFLOSS then
player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
end
end
else
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(i)
local lossPercent = player:getLossPercent()
if item then
if isRedOrBlack or math.random(item:isContainer() and 100 or 1000) <= lossPercent then
if (isRedOrBlack or lossPercent ~= 0) and 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
change:
local isAol = {18402, 10220, 18407}

to:
local isAol = {ITEM_AMULETOFLOSS, 18402, 10220, 18407}
 
Back
Top