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

Solved Annihilator Script Error

Progenosis

Member
Joined
Sep 6, 2011
Messages
131
Reaction score
18
Im using TFS 0.3.6

The annihilator's quest script that I'm using on my server is this:


Code:
-- Annihilator by Shawak v2.1

-- CONFIG --

local room = { -- room with demons
fromX = 816,
fromY = 728,
fromZ = 9,
--------------
toX = 824,
toY = 735,
toZ = 9
}

local monster_pos = {
[1] = {pos = {818, 730, 9}, monster = "Demon"},
[2] = {pos = {819, 730, 9}, monster = "Demon"},
[3] = {pos = {820, 730, 9}, monster = "Demon"},
[4] = {pos = {818, 734, 9}, monster = "Demon"},
[5] = {pos = {819, 734, 9}, monster = "Demon"},
[6] = {pos = {820, 734, 9}, monster = "Demon"},
[7] = {pos = {822, 732, 9}, monster = "Demoniccus"},
[8] = {pos = {823, 732, 9}, monster = "Demoniccus"}
}

local players_pos = {
{x = 887, y =728, z = 8, stackpos = 253},
{x = 888, y =728, z = 8, stackpos = 253},
{x = 889, y =728, z = 8, stackpos = 253},
{x = 890, y =728, z = 8, stackpos = 253}
}

local new_player_pos = {
{x = 818, y = 732, z = 9},
{x = 819, y = 732, z = 9},
{x = 820, y = 732, z = 9},
{x = 821, y = 732, z = 9}
}

local playersOnly = "no"
local questLevel = 101

------------------------------------------------------
--- 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 = getThingfromPos(players_pos)
if player.itemid > 0 then
if string.lower(playersOnly) == "yes" then
if isPlayer(player.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 = getThingfromPos(players_pos)
if isPlayer(player.uid) == TRUE then
if getPlayerLevel(player.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
doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
end
for i = 1, #players_pos do
doSendMagicEffect(players_pos, CONST_ME_POFF)
doTeleportThing(player.uid, new_player_pos, FALSE)
doSendMagicEffect(new_player_pos, 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

Everytime 4 players are in position to enter quest and pull the lever, the consonsolo shows this error and the players don't go to the demons room:


Code:
[22/10/2014 09:33:32] [Error - Action Interface]
[22/10/2014 09:33:32] data/actions/scripts/dendenic/annihilatorquest.lua:onUse
[22/10/2014 09:33:32] Description:
[22/10/2014 09:33:32] (luaGetThingFromPos) Tile not found

Also the player who pulls the lever gets this message: You need 4 players to do this quest.

Do you know what exactly the problem is?
I've checked that the tiles on the map editor are right and same in the script but it still gives me the error.


I'll appreciate your help :)
 
Change this
Code:
for i = 1, #players_pos do
player = getThingfromPos(players_pos)
To this
Code:
for i = 1, #players_pos do
player = getThingfromPos(players_pos[i])

Do the same thing for all players_pos that are under the line: for i = 1, #players_pos do
 
Now there are no errors on console nor in the player window, but when pulled the lever, nothing happens, the players are in position but don't teleport to the demon's room
 
Code:
-- Annihilator by Shawak v2.1

-- CONFIG --

local room = { -- room with demons
fromX = 816,
fromY = 728,
fromZ = 9,
--------------
toX = 824,
toY = 735,
toZ = 9
}

local monster_pos = {
[1] = {pos = {818, 730, 9}, monster = "Demon"},
[2] = {pos = {819, 730, 9}, monster = "Demon"},
[3] = {pos = {820, 730, 9}, monster = "Demon"},
[4] = {pos = {818, 734, 9}, monster = "Demon"},
[5] = {pos = {819, 734, 9}, monster = "Demon"},
[6] = {pos = {820, 734, 9}, monster = "Demon"},
[7] = {pos = {822, 732, 9}, monster = "Demoniccus"},
[8] = {pos = {823, 732, 9}, monster = "Demoniccus"}
}

local players_pos = {
{x = 887, y =728, z = 8, stackpos = 253},
{x = 888, y =728, z = 8, stackpos = 253},
{x = 889, y =728, z = 8, stackpos = 253},
{x = 890, y =728, z = 8, stackpos = 253}
}

local new_player_pos = {
{x = 818, y = 732, z = 9},
{x = 819, y = 732, z = 9},
{x = 820, y = 732, z = 9},
{x = 821, y = 732, z = 9}
}

local playersOnly = "no"
local questLevel = 101

------------------------------------------------------
--- 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 = getThingfromPos(players_pos[i])
if player.itemid > 0 then
if string.lower(playersOnly) == "yes" then
if isPlayer(player.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 = getThingfromPos(players_pos[i])
if isPlayer(player.uid) == TRUE then
if getPlayerLevel(player.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
doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
end
for i = 1, #players_pos do
doSendMagicEffect(players_pos, CONST_ME_POFF)
doTeleportThing(player.uid, new_player_pos, FALSE)
doSendMagicEffect(new_player_pos, 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
 
These are the lines you mentioned last:

Code:
doTeleportThing(player.uid, new_player_pos, FALSE)
doSendMagicEffect(new_player_pos, CONST_ME_ENERGYAREA)

so, they should looke like this?


Code:
doTeleportThing(player.uid, player = getThingfromPos((players_pos[i]), new_player_pos, FALSE)
doSendMagicEffect(player = getThingfromPos((players_pos[i]), new_player_pos, CONST_ME_ENERGYAREA)
 
Code:
doTeleportThing(player.uid, new_player_pos[i], FALSE)
doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
 
Back
Top