• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Globalevent help

d4rkbl0od

Member
Joined
Mar 21, 2008
Messages
160
Reaction score
7
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

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
 
Code:
local feroxa = Position(x, y, z)

function onThink(cid, interval, lastExecution)
local specs, spec = Game.getSpectators(feroxa, false, false, 15, 15, 15, 15) -- radius x,x,y,y  from center of room
    for i = 1, #specs do
        spec = specs[i]
        if spec and spec:isMonster() then
            Game.broadcastMessage("OKK", MESSAGE_EVENT_ADVANCE)
        else
            Game.broadcastMessage("ERROR", MESSAGE_EVENT_ADVANCE)
        end
    end
    return true
end
 
Code:
local config = {
    feroxa = Position(x, y, z)
}

function onThink(cid, interval, lastExecution)
local specs, spec = Game.getSpectators(config.feroxa, false, false, 15, 15, 15, 15) -- radius x,y from center of room
    for i = 1, #specs do
        spec = specs[i]
        if spec and spec:isMonster() then
            Game.broadcastMessage("OKK", MESSAGE_EVENT_ADVANCE)
        else
            Game.broadcastMessage("ERROR", MESSAGE_EVENT_ADVANCE)
        end
    end
    return true
end
Code:
function onThink(interval)
    local spec = Game.getSpectators(Position(33388, 31542, 11), false, false, 0, 18, 0, 15)
    if #spec > 0 then
        for i = 1, #spec do
            local thing = spec[i]
            if thing:isMonster() and thing:getName() == 'Feroxa' then
                print('Spec Number: '.. i, thing)
            end
        end
    end
    return true
end
dont need to use two locals for one thing and reassign it
 
Last edited:
Hello guys,
its first time to post here
but im realy want your help!

tried alot to open ports on my router but its always closed not opened :/
any help?
 
Hello guys,
its first time to post here
but im realy want your help!

tried alot to open ports on my router but its always closed not opened :/
any help?
something might be blocking your ports, you are doing it incorrectly, or your isp blocks 7171/7172
edit: make your own thread about this as it is not related to this thread's issue
 
Back
Top