• 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!

Lua Unlimited Aol?

fishie

fishies-war
Joined
Oct 27, 2016
Messages
78
Reaction score
2
Ive tried multiple old scripts ive found here on otland but none seem to work, i want to make it possible for players to get a neckless like broken amulet or something and it act as an AOL that never disapears. Is this possible without editing sourcess?
 
<attribute key="charges" value="2" />
in items.xml
or
use any amulet and than use this script in creaturescript
this script don't save rs
Code:
function onDeath(cid, corpse, deathlist)
    if getCreatureSkullType(cid)  <= 2 and getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == amulet id then
        doCreatureSetDropLoot(cid, false)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
        doCreatureSay(cid, "Forever Aol!! NO LOOT FOR YOU!", TALKTYPE_ORANGE_1)
    end
    return true
end
this script save rs :D
Code:
function onDeath(cid, corpse, deathlist)
    if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == id of amulet then
        doCreatureSetDropLoot(cid, false)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
        doCreatureSay(cid, "Forever Aol!! NO LOOT FOR YOU!", TALKTYPE_ORANGE_1)
    end
    return true
end
 
I mean how would i change so it worked with item 2196? Just put this?

unction onDeath(cid, corpse, deathlist)
if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid 2196 == id of amulet then
doCreatureSetDropLoot(cid, false)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
doCreatureSay(cid, "Forever Aol!! NO LOOT FOR YOU!", TALKTYPE_ORANGE_1)
end
return true
end
 
Code:
function onDeath(cid, corpse, deathlist)
    if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2196 then
        doCreatureSetDropLoot(cid, false)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
        doCreatureSay(cid, "Forever Aol!! NO LOOT FOR YOU!", TALKTYPE_ORANGE_1)
    end
    return true
end
 
Im getting this error,
Code:
Dec 18 18:04:36 158-69-12-209 tfs[8073]: Lua Script Error: [CreatureScript Interface]
Dec 18 18:04:36 158-69-12-209 tfs[8073]: data/creaturescripts/scripts/foreveraol.lua:onDeath
Dec 18 18:04:36 158-69-12-209 tfs[8073]: data/creaturescripts/scripts/foreveraol.lua:3: attempt to call global 'doCreatureSetDropLoot' (a nil value)
Dec 18 18:04:36 158-69-12-209 tfs[8073]: stack traceback:
Dec 18 18:04:36 158-69-12-209 tfs[8073]:         [C]: in function 'doCreatureSetDropLoot'
Dec 18 18:04:36 158-69-12-209 tfs[8073]:         data/creaturescripts/scripts/foreveraol.lua:3: in function <data/creaturescripts/scripts/foreveraol.lua:1>
 
creaturescripts/scripts/droploot.lua
Code:
local infAol = 2196

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_NECKLACE)
    if amulet then
        if amulet.itemid == infAol then
            return true
        elseif amulet.itemid == ITEM_AMULETOFLOSS and not isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull()) 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)
                if item then
                    if isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull()) or math.random(item:isContainer() and 100 or 1000) <= player:getLossPercent() then
                        if not item:moveTo(corpse) then
                            item:remove()
                        end
                    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
 
Back
Top