JDB
OtLand Veteran
- Joined
- Jun 1, 2009
- Messages
- 4,145
- Solutions
- 2
- Reaction score
- 115
creaturescripts/creaturescripts.xml
creaturescripts/scripts/login.lua
creaturescripts/scripts/script.lua
creaturescripts/scripts/script.lua
Code:
<event type="preparedeath" name="RedSkullAmulet" event="script" value="script.lua"/>
creaturescripts/scripts/login.lua
Code:
registerCreatureEvent(cid, "RedSkullAmulet")
- Version 1.0 - Tested and working on 0.3 & 0.4.
creaturescripts/scripts/script.lua
Code:
function onPrepareDeath(cid, deathList)
if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == [COLOR="red"]2196[/COLOR] then
if getCreatureSkullType(cid) < 5 and doPlayerRemoveItem(cid, [COLOR="red"]2196[/COLOR], 1) then
doSetCreatureDropLoot(cid, false)
end
end
return true
end
- Version 2.0 - Beta
creaturescripts/scripts/script.lua
Code:
local corpse_ids = {
[0] = 3065,
[1] = 3058
}
local config = {
charges = 5
}
function onPrepareDeath(cid, deathList)
if getCreatureSkullType(cid) < 5 then
if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2196 then
if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid < 100 then
doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).uid, "aid", (100 + config.charges - 1))
elseif getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid > 101 then
doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).uid, "aid", (getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid - 1))
elseif getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid == 101 then
doRemoveItem(getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).uid)
end
end
end
return doCreatureSetDropLoot(cid, false) and doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).uid, "description", "It has " .. (getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid - 101) .. "x charge" .. ((getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid - 101) > 1 and "s" or "") .. ".") and doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by " .. (isMonster(deathList[1]) and "a " .. string.lower(getCreatureName(deathList[1])) or isCreature(deathList[1]) and getCreatureName(deathList[1]) or "a field item") .. ".\nHis soul was protected.")
end
- Update Log - Beta Version 2.0
- Charges are now optional for the amulet.
- Corpse now creates and has the following description.
- The amulet itself will have the amount of charges left.
Last edited: