• 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 Pick-Only-One-Item Quest LUA Error

ecounlimited

New Member
Joined
Aug 7, 2013
Messages
53
Reaction score
3
So I followed the tutorial here:
http://otland.net/threads/how-to-quests.148708/

I'm using TFS Crying Damson 8.6.


The error I get:

[14/10/2013 18:55:19] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/system.lua:3: '}' expected (to close '{' at line 1) near '['
[14/10/2013 18:55:19] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/system.lua)
[14/10/2013 18:55:19] data/actions/scripts/quests/system.lua:3: '}' expected (to close '{' at line 1) near '['
[14/10/2013 18:55:19] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/system.lua:3: '}' expected (to close '{' at line 1) near '['
[14/10/2013 18:55:19] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/system.lua)
[14/10/2013 18:55:19] data/actions/scripts/quests/system.lua:3: '}' expected (to close '{' at line 1) near '['
[14/10/2013 18:55:19] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/system.lua:3: '}' expected (to close '{' at line 1) near '['
[14/10/2013 18:55:19] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/system.lua)
[14/10/2013 18:55:19] data/actions/scripts/quests/system.lua:3: '}' expected (to close '{' at line 1) near '['

What I did:
I have no idea what I'm doing when it comes to scripting, so I followed the tutorial and basically mimicked exactly what I saw in the LUA file already. (http://puu.sh/4QhT7.png) Wand13 is the quest I tried to make. The player gets to choose his level 13 weapon, whether it is the wand of dragonbreath or moonlight rod; but only one. After that, I went into data/actions/actions.xml like the tutorial says to and I added my quest line (http://puu.sh/4Qi1H.png). Mine is the one for actionid 2002, and I just mimicked the other lines I saw in there.
 
"[Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/system.lua)" cannot load script with path data/actions/scripts/quests/ named system.lua

data/actions/scripts/quests/system.lua:3: '}' expected (to close '{' at line 1) near '['
that mean

Script ex {
bla
blah=bla
bla
MISSING " } "
in system.lua

also you can do it by
making lua file in action/script/quest/dwarfv1.lua

paste

Code:
local config = {
storage = 40006,
item = 2160,
count = 5,
itemname = "You have found a 5 crystal coin!",
itemcallback = "You can not take the prize twice.",

}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, config.storage) == -1 then
setPlayerStorageValue(cid, config.storage, 1)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, config.itemname)
doPlayerAddItem(cid,config.item, config.count)

else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, config.itemcallback)
end
return true
end

on it, and if other quest will have same storage ID in code player will be able to get only one chest reward.

you can make another file same code other reward.

after that you go to action.xml
and add
<action uniqueid="30022" script="quests/dwarfv1.lua"/>
<action uniqueid="30023" script="quests/dwarfv2.lua"/>
<action uniqueid="30024" script="quests/dwarfv3.lua"/>
<action uniqueid="30025" script="quests/dwarfv4.lua"/>
<action uniqueid="30026" script="quests/dwarfv5.lua"/>

dwarfv1/2/3/4/5 its name of lua file you made in quests folder and unique id its unique id of chest you place in editor chest has to be empty unique id has to be difrent in every chest and also it cannot be same as storage id.
 
Last edited:
"[Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/system.lua)" cannot load script with path data/actions/scripts/quests/ named system.lua

data/actions/scripts/quests/system.lua:3: '}' expected (to close '{' at line 1) near '['
that mean

Script ex {
bla
blah=bla
bla
MISSING " } "
in system.lua
But in this picture (http://puu.sh/4QhT7.png) the "}" is there, I didn't delete it.
 
Why don't you just post the script. Make a screenshot? Are you serious?

There is a comma missing after 30015.
 
To make it so you can only get one. Put the chests on the map editor...put the item in it....set the actionid of the chest to the items id

set all the chests unique ids to the same thing. they will only be able to pick one.
 
Otherwise you can use this code...and just set the information right. Set the chests unique id to the one in the scirpt with the map editor...

Code:
----------------chestid--------item_given----------------
local chest1 = {itemid = 1111, reward = 1111}
local chest2 = {itemid = 1111, reward = 1111}
local chest3 = {itemid = 1111, reward = 1111}
local chest4 = {itemid = 1111, reward = 1111}

local HAS_CHOSEN = 32144

local uniqueid = 6123

fucntion onUse(cid, words, param, channel)
if getPlayerStorageValue(cid, HAS_CHOSEN) == 0 then
   if item.itemid == chest1.itemid then
     if item.uid == uniqueid then
       doplayerAddItem(cid, chest1.reward, 1)
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_GREEN, "Congratulations you have recived your item.")
       doSendMagicEffect(getPlayerPosition(cid), 11)
       setPlayerStorageValue(cid, HAS_CHOSEN, 1)
     end
   elseif item.itemid == chest2.itemid then
     if item.uid == uniqueid then
       doplayerAddItem(cid, chest2.reward, 1)
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_GREEN, "Congratulations you have recived your item.")
       doSendMagicEffect(getPlayerPosition(cid), 12)
       setPlayerStorageValue(cid, HAS_CHOSEN, 1)
     end
   elseif item.itemid == chest3.itemid then
     if item.uid == uniqueid then
       doplayerAddItem(cid, chest3.reward, 1)
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_GREEN, "Congratulations you have recived your item.")
       doSendMagicEffect(getPlayerPosition(cid), 13)
       setPlayerStorageValue(cid, HAS_CHOSEN, 1)
     end
   elseif item.itemid == chest4.itemid then
     if item.uid == uniqueid then
       doplayerAddItem(cid, chest4.reward, 1)
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_GREEN, "Congratulations you have recived your item.")
       doSendMagicEffect(getPlayerPosition(cid), 14)
       setPlayerStorageValue(cid, HAS_CHOSEN, 1)
     end
   end
else
   doPlayerSendCancel(cid, "You have already chosen your item.")
return false
end
return true
end
 
Back
Top