Hello,
I'm trying to make a globalevent to check if there is a monster in X area. But i'm having problem with it.
It seems that the script can't find the variable named "thing".
It always return as "ERROR" it can't even check if "thing" is a monster.
Here is the script
I'm trying to make a globalevent to check if there is a monster in X area. But i'm having problem with it.
It seems that the script can't find the variable named "thing".
It always return as "ERROR" it can't even check if "thing" is a monster.
Here is the script
Code:
local config = {
feroxaArea = {
fromX = 33372,
fromY = 31527,
fromZ = 11,
toX = 33408,
toY = 31557,
toZ = 11
}
}
function onThink(cid, interval, lastExecution)
for x = config.feroxaArea.fromX, config.feroxaArea.toX do
for y = config.feroxaArea.fromY, config.feroxaArea.toY do
for z = config.feroxaArea.fromZ, config.feroxaArea.toZ do
local pos = {x=x, y=y, z=z}
local thing = getTopCreature(pos)
if (isMonster(thing.uid) == TRUE) and getCreatureName(thing.uid):lower() == "Feroxa" then
Game.broadcastMessage("OKK", MESSAGE_EVENT_ADVANCE)
else
Game.broadcastMessage("ERROR", MESSAGE_EVENT_ADVANCE)
end
end
end
end
return true
end