• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Annihilator script error: (luaGetThingFromPos) Tile not found

Sorbal

Member
Joined
Jul 23, 2010
Messages
406
Reaction score
11
Location
Poland
Hello Otlanders, I appeal to you for help. I am using TFS 0.3.6 and Annihilator by Shawak v2.1:
PHP:
 -- Annihilator by Shawak v2.1
 
        -- CONFIG --
 
        local room = { -- room with demons
        fromX = 931,
        fromY = 971,
	fromZ = 12,
        --------------
        toX = 939,
        toY = 979,
	toZ = 12
        }
 
 	 
 
        local monster_pos = {
        [1] = {pos = {932, 972, 12}, monster = "demon"},
        [2] = {pos = {934, 972, 12}, monster = "demon"},
        [3] = {pos = {933, 978, 12}, monster = "demon"},
        [4] = {pos = {935, 978, 12}, monster = "demon"},
        [5] = {pos = {936, 975, 12}, monster = "demon"},
        [6] = {pos = {937, 975, 12}, monster = "demon"}
        }
 
 
 
        local players_pos = {
        {x = 956, y =967, z = 8, stackpos = 253},
        {x = 957, y =967, z = 8, stackpos = 253},
        {x = 958, y =967, z = 8, stackpos = 253},
        {x = 959, y =967, z = 8, stackpos = 253}
        }
 
        local new_player_pos = {
        {x = 932, y = 975, z = 12},
        {x = 933, y = 975, z = 12},
        {x = 934, y = 975, z = 12},
        {x = 935, y = 975, z = 12}
        }
 
        local playersOnly = "no"
        local questLevel = 13
 
        ------------------------------------------------------
        --- CONFIG END ---------------------------------------
        ------------------------------------------------------
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local all_ready, monsters, player, level = 0, 0, {}, 0
        if item.itemid == 1945 then
                for i = 1, #players_pos do
                        table.insert(player, 0)
                end
                for i = 1, #players_pos do
                        player[i] = getThingfromPos(players_pos[i])
                        if player[i].itemid > 0 then
                                if string.lower(playersOnly) == "yes" then
                                        if isPlayer(player[i].uid) == TRUE then
                                                all_ready = all_ready+1
                                        else
						monsters = monsters+1
					end
                                else
                                        all_ready = all_ready+1
                                end
                        end
                end
                if all_ready == #players_pos then
			for i = 1, #players_pos do
				player[i] = getThingfromPos(players_pos[i])
				if isPlayer(player[i].uid) == TRUE then
					if getPlayerLevel(player[i].uid) >= questLevel then
						level = level+1
					end
				else
					level = level+1
				end
			end
                        if level == #players_pos then
                                if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then 
                                        for _, area in pairs(monster_pos) do
                                                        doCreateMonster(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
                                        end
                                        for i = 1, #players_pos do
                                                doSendMagicEffect(players_pos[i], CONST_ME_POFF)
                                                doTeleportThing(player[i].uid, new_player_pos[i], FALSE)
                                                doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
                                                doTransformItem(item.uid,1946)
                                        end
                                else
                                        doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
                                end
                        else
                                doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.")
                        end
                else
                        doPlayerSendTextMessage(cid,19,"You need "..table.getn(players_pos).." players to do this quest.")
                end
        elseif item.itemid == 1946 then
                local player_room = 0
                for x = room.fromX, room.toX do
                        for y = room.fromY, room.toY do
				for z = room.fromZ, room.toZ do
					local pos = {x=x, y=y, z=z,stackpos = 253}
					local thing = getThingfromPos(pos)
					if thing.itemid > 0 then
						if isPlayer(thing.uid) == TRUE then
							player_room = player_room+1
						end
					end
                                end
                        end
                end
                if player_room >= 1 then
                        doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")           
                elseif player_room == 0 then
			for x = room.fromX, room.toX do
				for y = room.fromY, room.toY do
					for z = room.fromZ, room.toZ do
						local pos = {x=x, y=y, z=z,stackpos = 253}
						local thing = getThingfromPos(pos)
						if thing.itemid > 0 then
							doRemoveCreature(thing.uid)
						end
					end
                                end
                        end
                        doTransformItem(item.uid,1945)
                end
        end
        return TRUE
end
When the first team pull the lever and get teleported the script does not print any errors in the console(all working good), but when each next team pull the lever and the old demons are removed, in the console appears spam of this error:
PHP:
[06/11/2011 15:48:05] [Error - Action Interface] 
[06/11/2011 15:48:05] data/actions/scripts/annihilator2.lua:onUse
[06/11/2011 15:48:05] Description: 
[06/11/2011 15:48:05] (luaGetThingFromPos) Tile not found
How to repair it?
 
I'm not good at scripting so Im just gonna give u the script that Im using and it should work fine :D done into english. :) xD

Code:
--Anihilator Script by Rahim
local monsters = {  --lvl for each moneter [COLOR="#0000CD"]I would ignore that part if i were u ;d[/COLOR]
    [100] = "demon",
    [150] = "orshabaal",
    [200] = "ghazbaran"
    }
local items = {  --rewards. [item.uid chest] = item.itemid reward
    [8001] = 2494,
    [8002] = 2400,
    [8003] = 2431,
    [8004] = 2112
}
local config = {
    --lever
    storage = 6217412,
    tylkoRaz = "nie", --only once can do the quest. if "nie" = "no" if "tak" = "yes". xD sorry for polish xD
    lvl = 100, --level required
    tylkoRazNaDzien = "tak", --quest only once a day? same as above, "tak" = "yes", "nie"= "no"
    summonowacPotwory = "tak", --does the script should summon demons? put "nie" if you have monsters in map editor already. I prefer if u delete those in map editor and leave "tak" here
    --Pozycje do dzwigni
    players = {  --players position
        {x=33222, y=31671, z=13, stackpos=253},
        {x=33223, y=31671, z=13, stackpos=253},
        {x=33224, y=31671, z=13, stackpos=253},
        {x=33225, y=31671, z=13, stackpos=253}},
    npos = {  --players position after using lever (the room with demons)
        {x=33219, y=31659, z=13},
        {x=33220, y=31659, z=13},
        {x=33221, y=31659, z=13},
        {x=33222, y=31659, z=13}},
    monsterPos = {  --names and position of monsters
        {"Demon",{x=33220,y=31657,z=13,stackpos=253}},
        {"Demon",{x=33219,y=31661,z=13,stackpos=253}},
        {"Demon",{x=33222,y=31657,z=13,stackpos=253}},
        {"Demon",{x=33221,y=31661,z=13,stackpos=253}},
        {"Demon",{x=33223,y=31659,z=13,stackpos=253}},
        {"Demon",{x=33224,y=31659,z=13,stackpos=253}}
        }
}
local function getMonster(lv)
    local x = 100
    for i = 2, 4 do
        if(monsters[i*50] > lv) then
            x = monsters[i*50]
        end
    end
    return monsters[x]
end
function onUse(cid, item, frompos, item2, topos)
    if item.itemid == 1945 then
        local tbl = {}
        for k, v in pairs(config.players) do
            local player = getThingfromPos(v)
            if(not isPlayer(player.uid)) then
                doPlayerSendCancel(cid, "You need four players for this quest.")
                return TRUE
            end
            if(getPlayerLevel(player.uid) < config.lvl) then
                doPlayerSendCancel(cid,"Somebody in your team hasn't required level!")
                return TRUE
            end
            if(config.tylkoRaz == "tak") then
                if(getPlayerStorageValue(player.uid,config.storage) == 1) then
                    doPlayerSendCancel(cid,"Somebody in your team already has a quest.")
                    return TRUE
                end
            end
            table.insert(tbl, player.uid)
        end
        for i, v in ipairs(tbl) do
            doTeleportThing(v, config.npos[i])
            doSendMagicEffect(config.npos[i], 12)
            doSendAnimatedText(config.npos[i], "Fight!", 192)
        end
        if(config.tylkoRazDziennie == "tak") then
            doTransformItem(item.uid,item.itemid+1)
        end
        if(config.summonowacPotwory ~= "tak") then
            return TRUE
        end
        local lv = getPlayerLevel(cid)
        for k, v in pairs(config.monsterPos) do
            local monster = getThingfromPos(v[2])
            if monster.uid > 0 then  --if a script will find a monster on the position of demons, it will kill it automatically and then summon new demons
                doCreatureAddHealth(monster.uid, -9999999999)
            end
            doSummonCreature(getMonster(lv), v[2])
            doSendMagicEffect(v[2], CONST_ME_MAGIC_BLUE)
        end
        return TRUE
    end
    if(getPlayerStorageValue(cid,config.storage) == 1) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This's empty.")
        return TRUE
    end
    local nagroda = items[item.uid]
    if(not nagroda) then
        return FALSE
    end
    doPlayerAddItem(cid, nagroda, 1)
    setPlayerStorageValue(cid, config.storage, 1)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. getItemName(nagroda) .. ".")
    return TRUE
end

Im sure u know how to set it up, like the uid of lever and u just change ur line in actions.xml :)
 
Last edited:
demon -> Demon
not working
@Galaxy
After pull the lever i got this error and there is no demons :/

Code:
[06/11/2011 17:08:08] [Error - Action Interface] 
[06/11/2011 17:08:08] data/actions/scripts/annihilator2.lua:onUse
[06/11/2011 17:08:08] Description: 
[06/11/2011 17:08:08] data/actions/scripts/annihilator2.lua:43: attempt to compare number with string
[06/11/2011 17:08:08] stack traceback:
[06/11/2011 17:08:08] 	data/actions/scripts/annihilator2.lua:43: in function 'getMonster'
[06/11/2011 17:08:08] 	data/actions/scripts/annihilator2.lua:87: in function <data/actions/scripts/annihilator2.lua:49>
 
PHP:
local t = {
	lvl = 100,
	entrada =
	{
		{x = 33222, y = 31671, z = 13},
		{x = 33223, y = 31671, z = 13},
		{x = 33224, y = 31671, z = 13},
		{x = 33225, y = 31671, z = 13}

	},
	saida =
	{
		{x = 33219, y = 31659, z = 13},
		{x = 33220, y = 31659, z = 13},
		{x = 33221, y = 31659, z = 13},
		{x = 33222, y = 31659, z = 13}
	},
	monstros =
	{
		{{x = 33220, y = 31657, z = 13}, "Demon"},
		{{x = 33219, y = 31661, z = 13}, "Demon"},
		{{x = 33222, y = 31657, z = 13}, "Demon"},
		{{x = 33221, y = 31661, z = 13}, "Demon"},
		{{x = 33223, y = 31659, z = 13}, "Demon"},
		{{x = 33224, y = 31659, z = 13}, "Demon"}
	} 
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local check = {}
	for _, k in ipairs(t.entrada) do
		local x = getTopCreature(k).uid
		if(x == 0 or not isPlayer(x) or getPlayerLevel(x) < t.lvl) then
			doPlayerSendCancel(cid, 'You need four players for this quest or your team has required level '..t.lvl..' or more.')
			return true
		end
		table.insert(check, x)
	end
				for _, summon in pairs(t.monstros) do
					local creature = getTopCreature(summon[1]).uid
					if(creature > 0 and not isPlayer(creature)) then
						doRemoveCreature(creature)
					end
					doCleanTile(summon[1])
					doCreateMonster(summon[2], summon[1])
				end
	for i, tid in ipairs(check) do
		doSendMagicEffect(t.entrada[i], CONST_ME_POFF)
		doTeleportThing(tid, t.saida[i], false)
		doSendMagicEffect(t.saida[i], CONST_ME_ENERGYAREA)
	end
	doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
	return true
end
 
Back
Top