silveralol
Advanced OT User
- Joined
- Mar 16, 2010
- Messages
- 1,480
- Solutions
- 9
- Reaction score
- 211
hello folks, I compile my source with a new function called moveTo... then, with this function I want to send my monsters to the spawn position when not have any target
also remove the monster when go out of the spawn area
the check if the monsters is out of the spawn range works, the monsters dissapear and summon another
the problem is not with the function moveTo() I test it with players and works fine...
Also I need check the runHealth, but the function MonsterType(monster):getRunHealth() seems don't work properly...
In my source I removed the check
how make it work ? :S
also remove the monster when go out of the spawn area
Code:
function onThink(creature)
if not creature:isMonster() then
return true
end
local monster = creature:getMonster()
local pos = monster:getSpawnPosition()
if not pos then
return true
end
if not monster:getTarget() then
monster:moveTo(pos)
return true
end
if not monster:isInSpawnRange(monster:getPosition()) then
if monster:getTarget() then
monster:getPosition():sendMagicEffect(CONST_ME_POFF)
monster:remove()
else
monster:moveTo(pos)
end
end
return true
end
the problem is not with the function moveTo() I test it with players and works fine...
Also I need check the runHealth, but the function MonsterType(monster):getRunHealth() seems don't work properly...
In my source I removed the check
Code:
if (!isInSpawnRange(_position)) {
g_game.internalTeleport(this, masterPos);
setIdle(true);
}