gianflogao
Member
- Joined
- Jun 6, 2014
- Messages
- 134
- Solutions
- 2
- Reaction score
- 13
I need an amulet forever, as the title, skull, red skull, black skull and receives "bless" when use.
function onEquip(cid, item, slot)
if not getPlayerBlessing(cid,5) then
for i = 1,5 do
doPlayerAddBlessing(cid,i)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The amulet has shielded you with the 5 blessings!")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
end
return true
end
<event type="preparedeath" name="SkullAmulet" event="script" value="script.lua"/>
registerCreatureEvent(cid, "SkullAmulet")
local corpse_ids = {
[0] = 3065,
[1] = 3058
}
function onPrepareDeath(cid, deathList)
if getCreatureSkullType(cid) < 6 then
if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2196 then
doCreatureSetDropLoot(cid, false)
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
end
return true
end
well,, the Script i will write now is not mine it based on @JDB script
at first
in creaturescripts/creaturescripts.xml add this
thenCode:<event type="preparedeath" name="SkullAmulet" event="script" value="script.lua"/>
in creaturescripts/scripts/login.lua add this
thenCode:registerCreatureEvent(cid, "SkullAmulet")
create file and name it script.lua in creaturescripts/scripts
paste this in it
Code:local corpse_ids = { [0] = 3065, [1] = 3058 } function onPrepareDeath(cid, deathList) if getCreatureSkullType(cid) < 6 then if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2196 then doCreatureSetDropLoot(cid, false) 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 end return true end
local corpse_ids = {
[0] = 3065,
[1] = 3058
}
function onPrepareDeath(cid, deathList)
if getCreatureSkullType(cid) < 6 then
if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2196 then
doCreatureSetDropLoot(cid, false)
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
end
return true
end
function onLogin(cid)
if (getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2196 AND getPlayerBlessing(cid,1)) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed by Forever aol")
else
for i = 1,5 do
doPlayerAddBlessing(cid,i)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings from Forever aol!")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
end
return true
end
registerCreatureEvent(cid, "BlessAmulet")
<event type="login" name="BlessAmulet" event="script" value="necklacebless.lua"/>
function onEquip(cid, item, slot)
if getPlayerBlessing(cid,1) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed by Forever aol")
else
for i = 1,5 do
doPlayerAddBlessing(cid,i)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings from Forever aol!")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
end
return true
end
<movevent event="Equip" itemid="2196" function="onEquipItem" slot="necklace" script="necklacebless.lua"/>