Galera estou com um problemão, estou tentando fazer um evento acontecer quando uma criatura morre, que é aparecer um tp por um periodo de tempo
porem não tem geito de funcionar ME AJUDEM POR FAVOR.
ESTE É O MONSTRO
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Dream Eater" nameDescription="a dream eater" race="psychic" experience="2000" speed="527" manacost="0">
<health now="1400" max="1400"/>
<look type="2148" head="45" body="65" legs="95" feet="113" corpse="11893"/>
<targetchange interval="2000" chance="0"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="1"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="1"/>
<flag convinceable="1"/>
<flag pushable="1"/>
<flag canpushitems="0"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="97"/>
<flag runonhealth="0"/>
</flags>
<attacks>
<attack name="melee" interval="2000" chance="100" range="1" min="-500" max="-1000"/>
<attack name="Psybeam" interval="2570" chance="31" range="1"/>
<!-- Magina nao pertence a esse pokemon <attack name="Headbutt" interval="2711" chance="30" range="1"/> --> -->
<attack name="Confusion" interval="2805" chance="29" range="6"/>
<attack name="Psywave" interval="2605" chance="29" range="6"/>
<attack name="Psychic" interval="3005" chance="25" range="6"/>
<attack name="Dream Eater" interval="5070" chance="28" range="6"/>
<attack name="Focus" interval="4920" chance="20" range="3"/>
<attack name="Hypnosis" interval="5061" chance="20" range="3"/>
</attacks>
<defenses armor="0" defense="0"/>
<voices interval="5000" chance="10">
<voice sentence="HYPNO!"/>
</voices>
<loot>
<item id="12194" chance="30" count="1" countmax="1"/> --future orb
<item id="13785" chance="100" countmax="70"/> --enchanted gem
<item id="11452" chance="5" count="1" countmax="1"/> --enigma stone
</loot>
<script>
<event name="Spawn"/>
</script>
<script>
<event name="tp"/>
</script>
</monster>
ESTE É O SCRIPT
tp.lua
local tpId = 1387
local tps = {
["Dream Eater"] = {pos = {x=224, y=1157, z=7}, toPos = {x=271, y=1157, z=7}, time = 300},
}
function removeTp(tp)
local t = getTileItemById(tp.pos, tpId)
if t then
doRemoveItem(t.uid, 1)
doSendMagicEffect(tp.pos, CONST_ME_POFF)
end
end
function onDeath(cid)
local tp = tps[getCreatureName(cid)]
if tp then
doCreateTeleport(tpId, tp.toPos, tp.pos)
doCreatureSay(cid, "O teleport irá sumir em "..tp.time.." segundos.", TALKTYPE_ORANGE_1)
addEvent(removeTp, tp.time*1000, tp)
end
return TRUE
end
ESTE É O XML
<event type="death" name="tp" event="script" value="tp.lua"/>