Hello guys, I am making a forever aol and it doesn't seem to work, I will also be adding more amulets but only the forever aol will be forever, the other amulets will be acting like amulets but with only one charge like the normal aol. I will also be adding more amulets, but maybe if I know how to make this forever aol work, then i'll know how to add more amulets like ones with +1% mana and +2% protection in all for example.
items.xml for normal aol
items.xml for forever aol
creaturescripts.xml
droploot.lua this is the default one i used for my droploot2.lua
droploot2.lua
items.xml for normal aol
Lua:
<item id="2173" article="an" name="amulet of loss">
<attribute key="weight" value="420" />
<attribute key="slotType" value="necklace" />
<attribute key="charges" value="1" />
</item>
items.xml for forever aol
Lua:
<item id="18407" article="a" name="forever aol">
<attribute key="charges" value="1" />
<attribute key="weight" value="650" />
<attribute key="slotType" value="necklace" />
</item>
creaturescripts.xml
Lua:
<event type="death" name="DropLoot" script="droploot.lua" />
<event type="death" name="DropLoot2" script="droploot2.lua" />
droploot.lua this is the default one i used for my droploot2.lua
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
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 table.contains({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
if not player:getSlotItem(CONST_SLOT_BACKPACK) then
player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
end
return true
end
droploot2.lua
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 == 18407 and not table.contains({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(18407, 1, -1, false)
end
else
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(i)
if item then
if table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) or math.random(item:isContainer() and 100 or 1000) <= player:getLossPercent() then
if not item:moveTo(corpse) then
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