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

Amulets problems

Na Amigo

The crazy girl
Joined
Jun 5, 2017
Messages
254
Solutions
3
Reaction score
18
Location
Egypt
hello i want make those amulets 2198,7890,7888,7887,7889,2197,2131,2130,2201
if you died it remove and protect and prevent this voc "25" for no loss items i've changed the deathlosspercent at my confing to 0 i want another way
i've test with movement
Code:
Equip and DeEquip with slot  necklace
but it dosent work i want another method creaturescript or something like that to solve this
 
i got this error too at creaturescript
Code:
[18:24:12.324] > Loading creaturescripts... [Error - Event::checkScript] Event onDeath not found (data/creaturescripts/scripts/aolremove.lua)
 
and here is the script at my data
Code:
<event type="death" name="aolremove" event="script" value="aolremove.lua"/>
aolremove.lua
Code:
local amulets = {2198,7890,7888,7887,7889,2197,2131,2130,2201}
function onPrepareDeath(cid, deathList)
    local amulet = getPlayerSlotItem(cid, CONST_SLOT_AMULET)
    if not amulet then
        return true
    end
    if isInArray(amulets, amulet.itemid) then
        if getPlayerVocation(cid) == 25 then
            doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
        else
            doRemoveItem(amulet.uid, 1)
        end
    end
    return true
end
on login
Code:
    registerCreatureEvent(cid, "aolremove")
 
and here is the script at my data
Code:
<event type="death" name="aolremove" event="script" value="aolremove.lua"/>
aolremove.lua
Code:
local amulets = {2198,7890,7888,7887,7889,2197,2131,2130,2201}
function onPrepareDeath(cid, deathList)
    local amulet = getPlayerSlotItem(cid, CONST_SLOT_AMULET)
    if not amulet then
        return true
    end
    if isInArray(amulets, amulet.itemid) then
        if getPlayerVocation(cid) == 25 then
            doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
        else
            doRemoveItem(amulet.uid, 1)
        end
    end
    return true
end
on login
Code:
    registerCreatureEvent(cid, "aolremove")
You miss "function onDeath" in lua
 
Why did you change the creaturescript line in xml?
The script for preparedeath was working fine earlier in the thread.

Attempting to read post #13 in this thread..

Every vocation, including vocation 25, should drop their amulet when they die.
However, Vocation 25 should never lose their other items.

Honestly, if this isn't what you want, I'm not going to post again.

Lua:
-- <event type="preparedeath" name="zzzzz" event="script" value="zzzzz.lua"/>
-- registerCreatureEvent(cid, "zzzzz")

local amulets = {2198,7890,7888,7887,7889,2197,2131,2130,2201}
function onPrepareDeath(cid, deathList)
   print("Xikini's prepare death script is functioning..")
   if getPlayerVocation(cid) == 25 then
       local amulet_id = getPlayerSlotItem(cid, CONST_SLOT_AMULET).itemid
       if amulet_id == 0 then
           print("No amulet. Xikini's prepare death script finished.")
           return true
       end
       if isInArray(amulets, amulet_id) then
           doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
       end
   end
   print("Xikini's prepare death script finished.")
   return true
end
Lua:
-- <event type="login" name="yyyyyyyyy" script="yyyyyyyyy.lua"/>
-- registerCreatureEvent(cid, "yyyyyyyyy")

local amulets = {2198,7890,7888,7887,7889,2197,2131,2130,2201}

function onDeath(cid, corpse, deathList)
   print("Xikini's death script is functioning..")
   local amulet_id = getPlayerSlotItem(cid, CONST_SLOT_AMULET).itemid
   if amulet_id == 0 then
       print("No amulet. Xikini's death script finished.")
       return true
   end
   if isInArray(amulets, amulet_id) then
       doRemoveItem(getPlayerSlotItem(cid, CONST_SLOT_AMULET).uid, 1)
       doAddContainerItem(corpse, amulet_id, 1)
   end
   print("Xikini's death script finished.")
   return true
end
note: line 13 might need to be corpse.uid instead of corpse, not sure without testing
 
Last edited:
Back
Top