To usano esse script que peguei aqui no fórum:
data\creaturescripts\scripts monstertrans.lua
-- Código feito por Omega (http://www.xtibia.com/forum/topic/221228-peca-aqui-o-seu-sistemaevento)
function doSendAreaEffect(pos, effect, radius)
for x = pos.x-radius, pos.x+radius do
for y = pos.y-radius, pos.y+radius do
doSendMagicEffect({x=x, y=y, z=pos.z}, effect)
end
end
return true
end
function onStatsChange(cid, attacker, type, combat, value)
registerCreatureEvent(cid, "10")
if isPlayer(cid) then return true end
if type == 1 then
local mhp = getCreatureMaxHealth(cid)
local percentChange = 10
local newMonster = 'Giant Gengar'
if (getCreatureHealth(cid) - value) <= percentChange/100*mhp then
local pos = getThingPos(cid)
doRemoveCreature(cid)
newMonster = doCreateMonster(newMonster, pos)
doCreatureAddHealth(newMonster, -math.floor(getCreatureMaxHealth(newMonster) * (100-percentChange) / 100))
doSendAreaEffect(pos, 18, 1)
return false
end
end
return true
end
O script serve pra quando um pokemon (dark haunter) tive com 10% de life, se transforma em outro pokemon (giant gengar)
mai quando eu mato o dark haunter, ele transforma no giant gengar e não da exp, e quando mata o giant gengar não da exp tamem, e aparece esse erro quando eu mato os dois
[03/12/2013 21:30:57] [Error - CreatureScript Interface]
[03/12/2013 21:30:57] data/creaturescripts/scripts/exp2.0.lua:onStatsChange
[03/12/2013 21:30:57] Description:
[03/12/2013 21:30:57] (luaGetCreatureStorage) Creature not found
[03/12/2013 21:30:57] [Error - CreatureScript Interface]
[03/12/2013 21:30:57] data/creaturescripts/scripts/exp2.0.lua:onStatsChange
[03/12/2013 21:30:57] Description:
[03/12/2013 21:30:57] data/creaturescripts/scripts/exp2.0.lua:249: attempt to compare number with boolean
[03/12/2013 21:30:57] stack traceback:
[03/12/2013 21:30:57] data/creaturescripts/scripts/exp2.0.lua:249: in function <data/creaturescripts/scripts/exp2.0.lua:64>
2 REP+
