• 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 Check for monsters in area?

Himii

Premium User
Premium User
Joined
Jan 19, 2011
Messages
1,267
Solutions
5
Reaction score
183
Location
Sweden
How can i check if there are any monsters in an specific area?
 
Code:
local fromPos = {x = 100, y = 100, z = 7}
local toPos = {x= 200, y = 200, z = 7}

local amount = 0
for x = fromPos.x, toPos.x do
   for y = fromPos.y, toPos.y do
     for z = fromPos.z, toPos.z do
       local monster = getTopCreature({x=x,y=y,z=z}).uid
       if(isMonster(monster) == TRUE) then
         amount = amount+1
       end   
     end
   end
end
if(amount >= 1) then
   return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "There are "..amount.." monsters in the area.")
end
 
Back
Top