As the title says, I'm getting this error:
This is the script:
Any help will be really appreciated. And of course Rep+.
Code:
[07/11/2010 19:38:26] [Error - LuaScriptInterface::loadFile] data/npc/scripts/killinginthenameof.lua:31: '}' expected (to close '{' at line 2) near '['
[07/11/2010 19:38:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/killinginthenameof.lua
[07/11/2010 19:38:26] data/npc/scripts/killinginthenameof.lua:31: '}' expected (to close '{' at line 2) near '['
This is the script:
Lua:
local tasks =
{
[1] = {questStarted = 1510, questStorage = 65000, killsRequired = 50, raceName = "Cyclops", rewards = {{enable = true, type = "exp", values = 5000}, {enable = true, type = "money", values = 1000}}},
[2] = {questStarted = 1511, questStorage = 65001, killsRequired = 100, raceName = "Dragons", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "money", values = 2500}}},
[3] = {questStarted = 1512, questStorage = 65002, killsRequired = 150, raceName = "Dragon Lords", rewards = {{enable = true, type = "exp", values = 50000}, {enable = true, type = "money", values = 5000}}},
[4] = {questStarted = 1513, questStorage = 65003, killsRequired = 150, raceName = "Hydras", rewards = {{enable = true, type = "exp", values = 80000}, {enable = true, type = "money", values = 8000}}},
[5] = {questStarted = 1514, questStorage = 65004, killsRequired = 200, raceName = "Wyrms", rewards = {{enable = true, type = "exp", values = 100000}, {enable = true, type = "money", values = 10000}, {enable = true, type = "points", values = 2}}},
[6] = {questStarted = 1515, questStorage = 65005, killsRequired = 200, raceName = "Giant Spiders", rewards = {{enable = true, type = "money", values = 150000}, {enable = true, type = "money", values = 12000}, {enable = true, type = "points", values = 2}}},
[7] = {questStarted = 1516, questStorage = 65006, killsRequired = 200, raceName = "Frost Dragons", rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "points", values = 1}}},
[8] = {questStarted = 1517, questStorage = 65007, killsRequired = 100, raceName = "Nightmares", rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "points", values = 1}}},
[9] = {questStarted = 1518, questStorage = 65008, killsRequired = 150, raceName = "Grim Reapers", rewards = {{enable = true, type = "exp", values = 400000}, {enable = true, type = "money", values = 15000}, {enable = true, type = "points", values = 2}}},
[10] = {questStarted = 1519, questStorage = 65009, killsRequired = 150, raceName = "Serpent Spawns", rewards = {{enable = true, type = "exp", values = 1500000}, {enable = true, type = "money", values = 15000}, {enable = true, type = "points", values = 2}}},
[11] = {questStarted = 1520, questStorage = 65010, killsRequired = 200, raceName = "Quaras", rewards = {{enable = true, type = "exp", values = 1000000}, {enable = true, type = "points", values = 1}}},
[12] = {questStarted = 1521, questStorage = 65011, killsRequired = 150, raceName = "Behemoths", rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 16000}, {enable = true, type = "points", values = 2}}},
[13] = {questStarted = 1522, questStorage = 65012, killsRequired = 300, raceName = "Orcs", rewards = {{enable = true, type = "exp", values = 2500000}, {enable = true, type = "money", values = 20000}, {enable = true, type = "points", values = 1}}},
[14] = {questStarted = 1523, questStorage = 65013, killsRequired = 75, raceName = "Blue Djinns", rewards = {{enable = true, type = "exp", values = 3000000}, {enable = true, type = "points", values = 2}}}
[15] = {questStarted = 1524, questStorage = 65014, killsRequired = 75, raceName = "Green Djinns", rewards = {{enable = true, type = "exp", values = 3500000}, {enable = true, type = "money", values = 25000}, {enable = false, type = "points", values = 1}}}
}
local rankStorage = 32150
local storage = 64521
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local voc = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
local s = getCreatureStorage(cid, storage)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
if msgcontains(msg, "task") then
if(s < 1) then
doCreatureSetStorage(cid, storage, 1)
s = getCreatureStorage(cid, storage)
end
if(getCreatureStorage(cid, rankStorage) < 1) then
doCreatureSetStorage(cid, rankStorage, 0)
end
if tasks[s] then
if(getCreatureStorage(cid, tasks[s].questStarted) < 1) then
if(getCreatureStorage(cid, tasks[s].creatureStorage) < 0) then
doCreatureSetStorage(cid, tasks[s].creatureStorage, 0)
end
if(getCreatureStorage(cid, tasks[s].questStorage) < 0) then
doCreatureSetStorage(cid, tasks[s].questStorage, 0)
end
doCreatureSetStorage(cid, tasks[s].questStarted, 1)
selfSay("You have started the task number " .. getPlayerStorageValue(cid, storage) .. ", in this task you need to kill " .. tasks[s].killsRequired .. " " .. tasks[s].raceName .. ".", cid)
else
selfSay("You are currently making task about " .. tasks[s].raceName .. ".", cid)
end
else
print("[Warning - Error::Killing in the name of::Tasks config] Something is wrong.")
end
elseif msgcontains(msg, "report") then
if tasks[s] and tasks[s].questStarted > 0 then
if(getCreatureStorage(cid, tasks[s].creatureStorage) < 0) then
doCreatureSetStorage(cid, tasks[s].creatureStorage, 0)
end
if(getCreatureStorage(cid, tasks[s].questStorage) < 0) then
doCreatureSetStorage(cid, tasks[s].questStorage, 0)
end
if(getCreatureStorage(cid, tasks[s].questStorage) >= tasks[s].killsRequired) then
for i = 1, table.maxn(tasks[s].rewards) do
if(tasks[s].rewards[i].enable) then
if tasks[s].rewards[i].type == "boss" or tasks[s].rewards[i].type == 1 then
doTeleportThing(cid, tasks[s].rewards[i].values)
elseif tasks[s].rewards[i].type == "exp" or tasks[s].rewards[i].type == 2 then
doPlayerAddExperience(cid, tasks[s].rewards[i].values)
elseif tasks[s].rewards[i].type == "item" or tasks[s].rewards[i].type == 3 then
doPlayerAddItem(cid, tasks[s].rewards[i].values[1], tasks[s].rewards[i].values[2])
elseif tasks[s].rewards[i].type == "money" or tasks[s].rewards[i].type == 4 then
doPlayerAddMoney(cid, tasks[s].rewards[i].values)
elseif tasks[s].rewards[i].type == "storage" or tasks[s].rewards[i].type == 5 then
doCreatureSetStorage(cid, tasks[s].rewards[i].values[1], tasks[s].rewards[i].values[2])
elseif tasks[s].rewards[i].type == "points" or tasks[s].rewards[i].type == 6 then
doCreatureSetStorage(cid, rankStorage, getCreatureStorage(cid, rankStorage) + tasks[s].rewards[i].values)
else
print("[Warning - Error::Killing in the name of::Tasks config] Bad reward type: " .. tasks[s].rewards[i].type .. ", reward could not be loaded.")
end
end
end
local rank = getCreatureStorage(cid, rankStorage)
selfSay("Great!... you have finished the task number " .. s .. "" .. (rank > 4 and ", you are a " or "") .. "" .. (((rank > 4 and rank < 10) and ("Huntsman") or (rank > 9 and rank < 20) and ("Ranger") or (rank > 19 and rank < 30) and ("Big Game Hunter") or (rank > 29 and rank < 50) and ("Trophy Hunter") or (rank > 49) and ("Elite Hunter")) or "") .. ". Good job.", cid)
doCreatureSetStorage(cid, storage, s + 1)
else
selfSay("Current " .. getCreatureStorage(cid, tasks[s].questStorage) .. " " .. tasks[s].raceName .. " killed, you need to kill " .. tasks[s].killsRequired .. ".", cid)
end
else
selfSay("You do not have started any task.", cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Any help will be really appreciated. And of course Rep+.