• 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!

[Function] Check monster in area

perdigs

New Member
Joined
Aug 22, 2010
Messages
114
Reaction score
1
I need a help to one fucntion to check in determined area the monster and players
for example im create one area

ex:
area_square = {
{1, 1, 1},
{1, 2, 1},
{1, 1, 1},
},

2 is the pos of cid and 1 is the area to check i need to check players and monster uids
and return in one table.

on make plz add a option to check monsters and player or only monsters or only players uids.

Please help me...Rep ++
Thks for attention.
 
i try to use thsi fucntion fo mock but dont work

i need one to check only the creatures, and add to one table to execute in this areas other function

----Edit
thks ciko im crete my own fucntion to check the selected area and return the uids of area...

look for there

PHP:
function checkAreaUid(pos, area, showP, showM) -- By Wantedzin(Perdigs)
    local creaturesList = {}
	local center = {}
	center.y = math.floor(#area/2)+1
	for y = 1, #area do
		for x = 1, #area[y] do
			local number = area[y][x]
			if number > 0 then
				center.x = math.floor(table.getn(area[y])/2)+1
				local pos =  getTopCreature {x = pos.x + x - center.x, y = pos.y + y - center.y, z = pos.z, stackpos = STACKPOS_TOP_CREATURE}
                if (pos.type == 1 and showP == 1) or (pos.type == 2 and showM == 1) then
                table.insert(creaturesList, pos.uid)
                end
			end
		end
	end
	return creaturesList
end
 
Last edited:
Back
Top