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

Errors with anni.lua. Please help me fast!

bazz33

New Member
Joined
Dec 13, 2013
Messages
17
Reaction score
0
Hello guys! I got some problems with my anni.lua and i do wonder if you might be able to help me out!

This is the error that i do recieve:
[26/03/2014 18:33:36] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/anni.lua)
[26/03/2014 18:33:36] data/actions/scripts/quests/anni.lua:5: unexpected symbol near 'local'

do you guys have any idea how to fix it? cuz the way i see it there is no unexpected symbol near 'local' :S

This is the script i use:
local config = {
daily = "no", -- allow only one team to enter per day? (like in global Tibia)
level = 100,
storage = 30015,
local room = { -- room with demons
fromX = 1221,
fromY = 969,
fromZ = 12,
--------------
toX = 1228,
toY = 969,
toZ = 12
}

local monster_pos = {
[1] = {pos = {1224, 967, 12}, monster = "Demon"},
[2] = {pos = {1222, 967, 12}, monster = "Demon"},
[3] = {pos = {1221, 971, 12}, monster = "Demon"},
[4] = {pos = {1223, 971, 12}, monster = "Demon"},
[5] = {pos = {1225, 969, 12}, monster = "Demon"},
[6] = {pos = {1226, 969, 12}, monster = "Demon"}
}

local players_pos = {
{x = 1224, y =969, z = 11, stackpos = 253},
{x = 1223, y =969, z = 11, stackpos = 253},
{x = 1222, y =969, z = 11, stackpos = 253},
{x = 1221, y =969, z = 11, stackpos = 253}
}

local new_player_pos = {
{x = 1224, y = 969, z = 12},
{x = 1223, y = 969, z = 12},
{x = 1222, y = 969, z = 12},
{x = 1221, y = 969, z = 12}
}

local function areaCheck(area)
local monsters, players = {}, {}
for x = config.room[1].x, config.room[2].x do
for y = config.room[1].y, config.room[2].y do
local t = getThingFromPos({x=x, y=y, z=config.room[1].z, stackpos=253})
if t.uid > 0 then
if isPlayer(t.uid) then
table.insert(players, t.uid)
elseif isMonster(t.uid) then
table.insert(monsters, t.uid)
end
end
end
end
return monsters, players
end

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1945) then
if(config.daily) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
else
local monsters, players = areaCheck(config.room)
if #players > 0 then
return doPlayerSendCancel(cid, "There are players inside, please be patient.")
elseif #monsters > 0 then
for _, k in pairs(monsters) do
doRemoveThing(k)
end
end

for _, v in ipairs(config.rocks) do
doCreateItem(1285, 1, v)
end

local closed, open = getTileItemById(config.wall[1], 5108), getTileItemById(config.wall[1], 5109)
if(closed.uid > 0) then
doTransformItem(closed.uid, 1025)
elseif(open.uid > 0) then
doTransformItem(open.uid, 1025)
end

doTransformItem(item.uid, item.itemid + 1)
end
return true
end

if(item.itemid ~= 1946) then
return true
end

local players = {}
for _, position in ipairs(config.stand) do
local pid = getTopCreature(position).uid
if(pid == 0 or not isPlayer(pid)) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
elseif(getCreatureStorage(pid, config.storage) > 0) then
return doPlayerSendCancel(cid, "Someone has already completed this quest.")
elseif(getPlayerLevel(pid) < config.level) then
return doPlayerSendCancel(cid, "Someone is below level 100.")
end

table.insert(players, pid)
end

local stones = {}
for _, v in ipairs(config.rocks) do
local st = getTileItemById(v, 1285)
table.insert(stones, st)
end

for _, st in ipairs(stones) do
doRemoveItem(st.uid, 1)
end

local wall = getTileItemById(config.wall[1], 1025)
if(wall.uid > 0) then
doTransformItem(wall.uid, 5108)
end

for _, pos in ipairs(config.demons) do
doCreateMonster("Demon", pos, false, false)
doSendMagicEffect(pos, CONST_ME_ENERGYAREA)
end

for i, pid in ipairs(players) do
doSendMagicEffect(config.stand, CONST_ME_POFF)
doTeleportThing(pid, config.destination, false)
doSendMagicEffect(config.destination, CONST_ME_TELEPORT)
end

doTransformItem(item.uid, item.itemid - 1)
return true
end



Kind Regards,
Bazz33



Edit: I do not get anymore errors except that i doesn't work to use the switch. Do anyone know why i can't use the switch?
 
Last edited:
Are you sure you want line 5 to read "local room = { -- room with demons".

Missing "_" or extra blank between "local" and "room"?

Or maybe you lost line 5 and/or a closing "}" after your current line 4?
 
I just did it but i still get this error:
[26/03/2014 20:15:00] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/anni.lua)
[26/03/2014 20:15:00] data/actions/scripts/quests/anni.lua:5: unexpected symbol near 'local'

Edit: I did get the error to dissapear but i still can't use the switch :S
 
well, you should consider replacing the whole code, try this one, you just have to change the coordinates:
Code:
local config = {
   daily = "no", -- allow only one enter per day? (like in global Tibia)
   level = 100,
   storage = 30015,
   entry =
   {
     {x = 247, y = 659, z = 13},
     {x = 247, y = 660, z = 13},
     {x = 247, y = 661, z = 13},
     {x = 247, y = 662, z = 13}
   },
   destination =
   {
     {x = 189, y = 650, z = 13},
     {x = 189, y = 651, z = 13},
     {x = 189, y = 652, z = 13},
     {x = 189, y = 653, z = 13}
   }
}

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if(item.itemid == 1946) then
     if(config.daily) then
       doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
     else
       doTransformItem(item.uid, item.itemid - 1)
     end

     return true
   end

   if(item.itemid ~= 1945) then
     return true
   end

   local players = {}
   for _, position in ipairs(config.entry) do
     local pid = getTopCreature(position).uid
     if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
       doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
       return true
     end

     table.insert(players, pid)
   end

   for i, pid in ipairs(players) do
     doSendMagicEffect(config.entry[i], CONST_ME_POFF)
     doTeleportThing(pid, config.destination[i], false)
     doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
   end

   doTransformItem(item.uid, item.itemid + 1)
   return true
end
 
Replace your actions from annihilator for this datapack:

https://github.com/PrinterLUA/FORGOTTENSERVER-ORTS/tree/master/data/actions

\/ after use the fix \/


Fixing:

Annihilator Quest:

  • Annihhilator Quest Door:
at annihilatorQuestDoor.lua, you will see this:

if(item.uid == 2215) then

when in the XML and Map the UID is:

<action uniqueid="2216" script="annihilator quest/annihilatorQuestDoor.lua"/>

So a quick fix for this would be changing the item.uid == 2215 to:

if(item.uid == 2216) then

  • Annihilator Quest lever:
at at annihilatorQuestLever.lua, you will see this in line 69:

p:teleportTo(new_player_pos, false)

which means it will be teleporting p who is the lever pulling player, and him only, to fix this we can replace this line with:

doTeleportThing(getTopCreature(players_pos).uid,new_player_pos,true)
 
Thank you Techrlz. It did help alot! rep++ for you! but i have one more question xD Now i can use the lever but it still says that you need 4 players even if i have 4 players. do you know why? and one more thing. it spawns demons all the time so now it is 6 demons in the middle :S

<3
 
You made the fix?
Yeah i made the fix but it still tells me that i need 4 players :S

Maybe you can come online on teamviewer and fix the problem by yourself. seems easier =)

I do recieve this error now :S :
[28/03/2014 14:32:42] data/actions/scripts/annihilator quest/annihilatorquestlever.lua:eek:nUse
[28/03/2014 14:32:42] Description:
[28/03/2014 14:32:42] .../scripts/annihilator quest/annihilatorquestlever.lua:93: attempt to call global 'Item' (a nil value)
[28/03/2014 14:32:42] stack traceback:
[28/03/2014 14:32:42] .../scripts/annihilator quest/annihilatorquestlever.lua:93: in function <.../scripts/annihilator quest/annihilatorquestlever.lua:86>
 
Last edited by a moderator:
Back
Top