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

CreatureEvent Forever Amulet (Red & Black Skull Protection)

perfection

FATAL DAMAGE
Joined
Aug 27, 2011
Messages
196
Reaction score
8
in creaturescripts/scripts/preparedeath.lua

Lua:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if(getPlayerSlotItem(cid, 2).itemid == 2196) and getPlayerSkullType(cid) >= 0 then
		doCreatureSetDropLoot(cid, false)
	end
return true
end

and in creaturescripts/scripts/login.lua add

Lua:
registerCreatureEvent(cid, "onPrepareDeath")

and add in creaturescripts.xml

Lua:
<event type="preparedeath" name="onPrepareDeath" event="script" value="preparedeath.lua"/>

NOW to change the name of the item

in items.xml

change:
Lua:
	<item id="2196" article="a" name="broken amulet">
		<attribute key="weight" value="420" />
		<attribute key="slotType" value="necklace" />
	</item>


to:

Lua:
	<item id="2196" article="a" name="Forever Amulet">
		<attribute key="weight" value="420" />
		<attribute key="slotType" value="necklace" />
	</item>
 
No need to check skull type.
Already released but good job.
 
You usually use broken amulet for forever aol though..

thats why i used broken amulet coz i played tibia 4 yrs and never saw another amulet used as forever amulet ...

@@Optus thx for ur constant crticism :D
 
in actions/scripts/foreverquest.lua

Lua:
local chest = XXX -- Unique Id of quest chest
local storage = 3438 -- Storage
local reward = 2196, 1 -- Id Of Forever Aol
function onUse(cid, item, frompos, item2, topos)
	if item.itemid == chest and getPlayerStorageValue(cid, storage) ~= 1 then
		doPlayerAddItem(cid, reward)
		setPlayerStorageValue(cid, storage, 1)
		doPlayerSendTextMessage(cid,25,"You Recieved a Forever Amulet")
	else
		doPlayerSendCancel(cid,"You Already Done That Quest")
	end
return 1
end

hope this helps
 
When I die,I lose the amulet!
Fix that script,everything is OK but when dying,the amulet is gone,just as an regular AOL
 
@ up

add this into the "forever aol" items.xml

Lua:
<attribute key="charges" value="99999"/>


that should work "Tested" and it worked for me

Hope this helps!
 
its protect items but when dead no dead human and teleport me to temple im use tfs 3.6 please fix it to me
 
Cool script..
but @perfection haven't edited the corpses xd!

- - - Updated with corpses xd! - - -

heba, i have your solution =)
i edited the script for the dead human appears e.e

just change the script in creaturescripts/scripts/preparedeath.lua for this:

Lua:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if(getPlayerSlotItem(cid, 2).itemid == 2196) and getPlayerSkullType(cid) >= 0 then
		doCreatureSetDropLoot(cid, false)
if getPlayerSex(cid) == 1 then
     corpse = doCreateItem(3058, 1, getThingPos(cid))
else
     corpse = doCreateItem(3065, 1, getThingPos(cid))
end
                doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ".")
	end
return true
end

4 nothing
PD: U must edit the IDS 3058 and 3065 for the real ID of corpses, u can see it searching for dead human on items.xml
 
Last edited:
So u wan't fix that: don't write killed by "monster name and still teleport

And teleport to temple, right? xd


Lua:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if(getPlayerSlotItem(cid, 2).itemid == 2196) and getPlayerSkullType(cid) >= 0 then
if getPlayerSex(cid) == 1 then
     corpse = doCreateItem(3058, 1, getThingPos(cid))
else
     corpse = doCreateItem(3065, 1, getThingPos(cid))
end
                doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ".")
	end
       doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
          doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
          doCreatureAddMana(cid, getCreatureMaxMana(cid))
return true
end

And the thing of "killed by monster" i'm thinking how to fix it xd
 
Last edited:
02:24 You see a dead human (Vol:10).
You recognize Hero Fun. He was killed by Orshabaal summoned by Bazir.
02:24 You see a dead human (Vol:10).
You recognize Hero Fun.

its add 2 human :S one where u dead and one in temple :S
 
Back
Top