CREATURESCRIPT
mortepet.lua
function isPetMonster(cid)
return getCreatureMaster(cid) == 0 and false or isPlayer(getCreatureMaster(cid))
end
function onDeath(cid, corpse, deathList)
if not isPetMonster(cid) then
return true
end
local waittime = 60 -- Tempo de exhaustion em segundos
local strtime = 6660666 -- Storage, nunca usar a mesma em outra Script do mesmo tipo. Ex: mesmo creaturescript, mesmo action e etc...
local master = getCreatureMaster(cid)
doPlayerSendTextMessage(master, MESSAGE_EVENT_ADVANCE, "Your pet is dead.")
exhaustion.set(master, strtime, waittime)
return true
end
TAG
<event type="death" name="MortePet" event="script" value="mortepet.lua"/>
No arquivo XML dos monstros que serão pets:
<script>
<event name="MortePet"/>
</script>