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

[Request] Checking if Monsters are at XYZ

Elvarion

Member
Joined
Apr 14, 2010
Messages
99
Reaction score
13
Distro: NaxedOt 8 (8.6)

Brief overview.
Here is a screenshot that might be of some help.
http://a.imageshack.us/img828/6172/questexpl.png
However, There should be no Corpses left behind. as in the picture.

Overview of the "Event"
----
All the monsters are on the correct tiles (so i need to be able to set each of their Pos)

Player steps on the Tile with UID = xxxx

Case 1 = Player has storage value xxxxx -> Teleport to xxx,xxx,x, And remove the monsters.
Case 2 = Player does not have storage value xxxx -> Nothing should happen even if the monsters are on the correct place. No poff, event msg or anything.

Thanks for reading
Signed, Elvarion.
 
example
Lua:
local pos = {x=1,y=1,z=1}

local pid = getThingFromPos(pos).uid

if isCreature(pid) then
-- do what you want
end
 
Hmm, Wasnt really able to get it to work by myself. So i had some help.
But it's still not working.

So if anyone could take a look at this and maybe figure something out that would be great!

Lua:
local pos = {
		[1] = {x=153, y=45, z=5, stackpos=255}, --dog
		[2] = {x=167, y=45, z=5, stackpos=255}, --crab
		[3] = {x=154, y=56, z=5, stackpos=255}, --rat
		[4] = {x=166, y=56, z=5, stackpos=255} --sheep
	}
local monster = {"dog","crab","rat","sheep"}
local teleto = {x=160, y=49, z=5}
local check = {}
local storage = 5952
 
function onStepIn(cid, item, fromPosition, toPosition)
	if isPlayer(cid) then
         if getPlayerStorageValue(cid, storage) > 1 then
		for i = 1, 4 do
			if getCreatureName(getThingFromPos(pos[i]).uid) == ""..monster[i].."" then
				table.insert(check, 1)
			else
				table.insert(check, 0)
			end
		end
          end
	end
	if check[1] == 1 and check[2] == 1 and check[3] == 1 and check[4] == 1 then
		doTeleportThing(cid, teleto)
		doSendMagicEffect(teleto, 10)
                for i = 1, 4 do
                  doRemoveCreature(getThingFromPos(pos[i]).uid)
                end
		return true
	end
end
 
you need to get top creature

Lua:
local pos = {x=1,y=1,z=1}
 
local pid = getTopCreature(pos).uid
 
if isCreature(pid) then
-- do what you want
end
 
Last edited:
Durr, I wish i was better at lua scripting.. I tried following your advice Damadger but that ended with a horrible code ^^, And it didnt even work properly.

Yes, you may laugh :p (I know im not good at lua, so why pretend XD)
Lua:
local pos1 = {x=153, y=45, z=5}
local pos2 = {x=167, y=45, z=5}
local pos3 = {x=154, y=56, z=5}
local pos4 = {x=166, y=56, z=5}

local teleto = {x=160, y=45, z=5}
 
local pid1 = getTopCreature(pos1).uid
local pid2 = getTopCreature(pos2).uid
local pid3 = getTopCreature(pos3).uid
local pid4 = getTopCreature(pos4).uid

function onStepIn(cid, item, fromPosition, toPosition)
	if isCreature(pid1) and isCreature(pid2) and isCreature(pid3) and isCreature(pid4) then
	doTeleportThing(cid, teleto)
end
end
 
try
Lua:
local pos1 = {x=153, y=45, z=5}
local pos2 = {x=167, y=45, z=5}
local pos3 = {x=154, y=56, z=5}
local pos4 = {x=166, y=56, z=5}
 
local teleto = {x=160, y=45, z=5}
 
local pid1 = getTopCreature(pos1).uid
local pid2 = getTopCreature(pos2).uid
local pid3 = getTopCreature(pos3).uid
local pid4 = getTopCreature(pos4).uid
 
function onStepIn(cid, item, fromPosition, toPosition)
	if isCreature(pid1) and isCreature(pid2) and isCreature(pid3) and isCreature(pid4) then
	doTeleportThing(cid, teleto)
end
return true
end
 
Nothing happens, nothing in the console either :7
Id also need to specify the specific creature since they need to stand on the correct position (More of a Puzzle) So people cant just place them like they wish and beat it)
 
Back
Top