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

Check in area if two monsters are closer, then one is removed.

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
Check in area if two monsters are closer, then one is removed.

The idea is basically a globalevent that works every 5 seconds that will check if two or more monsters are closer, then it removes all monsters-1.

The idea is to make an anti-lure-boss-system.
 
What I try to mean is if there is a cave with 3 bosses (they all the same), and they 3 get together (closer, maybe 5-6 sqms) then the system should remove 2 monsters (all monsters less one), and just leave one.
 
PHP:
function CheckMonster(PosLeft, PosRight, floor)
	for x = PosLeft[1], PosRight[1] do 
		for y = PosLeft[2], PosRight[2] do 
			local monster = getTopCreature({x=x, y=y, z=floor}).uid 
			if monster >= 2 and isMonster(monster) then
				doRemoveCreature(monster)
			end
		end
	end
	return true
end

exemple :


CheckMonster({245,73}, {249,80}, 7)


CheckMonster({begin x, begin y} , {last x, last y}, floor)
 
Maybe try this
LUA:
function RemoveMonstersFromArea(pos1, pos2)
	for areax = pos1.x, pos2.x do
		for areay = pos1.y, pos2.y do
			for areaz = pos1.z, pos2.z do
				pos = {x=areax, y=areay, z=areaz, stackpos=255}
				creature = getThingfromPos(pos)
					if isMonster(creature.uid) then
						pos_2 = getCreaturePosition(creature.uid)
						n_pos1 = {x = pos_2.x - 2, y = pos_2.y - 2, z = pos_2.z}
						n_pos2 = {x = pos_2.x + 2, y = pos_2.y + 2, z = pos_2.z}
							for areax_2 = n_pos1.x, n_pos2.x do
								for areay_2 = n_pos1.y, n_pos2.y do
									pos_2 = {x=areax_2, y=areay_2, z=pos_2.z, stackpos=255}
									creature_2 = getThingfromPos(pos_2)
									if (isMonster(creature_2.uid) and creature_2.uid ~= creature.uid) then
										doRemoveCreature(creature_2.uid)
									end
								end
							end
					end
			end
		end
	end
return true
end
 
Back
Top