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

near sensor of a npc

Tarielle

New Member
Joined
Nov 4, 2007
Messages
214
Reaction score
0
Location
Sweden
Hi, is it possible for a npc to sense a player x squares from the npc?
Like if a player is 2 sqm's close to the npc the npc teleport the player somewhere


thanks
 
Code:
local selfPos = getCreaturePosition(getNpcCid())
local spec = getSpectators(Ballista, 9, 9, false)
local player = 0
local playerPos = 0

if (#spec > 0) then
	for i = 1, #spec do
		player = spec[i]
		playerPos = getCreaturePosition(player)
		if ((math.abs(playerPos.x - selfPos.x) <= 3) and (math.abs(playerPos.y - selfPos.y) <= 3)) then
			selfSay("Go Away!", cid)
			doTeleportThing(player, {x =, y =, z =})
		end
	end
end
 
Back
Top