wafuboe
Active Member
- Joined
- Dec 24, 2010
- Messages
- 884
- Solutions
- 2
- Reaction score
- 26
Hello ive been working on editing this script, i resolve some issues but this i cant get it heres what is in console.. tfs 1.3
lua.323 unexpected symbol near "["
what is wrong?
thank you
lua.323 unexpected symbol near "["
what is wrong?
thank you
Code:
-- Collecting items and monster missions by Limos
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local missions = {
[1] = {
items = {
{id = 10609, count = 5},
{id = 2230, count = 1},
{id = 12437, count = 5}
},
message = "Great, for your first mission you need to collect some items, I need for a ritual",
level = 7, -- minimum level voor this mission
rewarditems = {
{id = 2152, count = 5}
},
rewardexp = 5000
},
[2] = {
monsters = {
{name = "Rotworms", count = 30, storage = 21900}
},
message = "Thanks, we have a problem in the city sewers for your next mission kill",
level = 7,
rewarditems = {
{id = 5710, count = 5}
},
rewardexp = 10000
},
[3] = {
items = {
{id = 10569, count = 1},
{id = 12400, count = 15},
{id = 12399, count = 15}
},
message = "Awesome rookie, now get me from the amazon camp",
level = 10,
rewarditems = {
{id = 2463, count = 1}
},
rewardexp = 170000
},
[4] = {
monsters = {
{name = "Minotaurs", count = 50, storage = 21901},
{name = "Minotaur Archers", count = 25, storage = 21902},
{name = "Minotaur Mages", count = 15, storage = 21903},
{name = "Minotaur Guards", count = 15, storage = 21904}
},
message = "Good job, we are having problems in the outer camps near plains of havoc now kill",
level = 15,
rewarditems = {
{id = 2152, count = 35}
},
rewardexp = 40000
},
[5] = {
items = {
{id = 10574, count = 45},
{id = 7398, count = 1}
},
message = "Good, i need some items from the cyclops camp,",
level = 20,
rewarditems = {
{id = 2486, count = 1}
},
rewardexp = 50000
},
[6] = {
monsters = {
{name = "Dwarf Soldiers", count = 50, storage = 21905},
{name = "Dwarf Guards", count = 25, storage = 21906},
{name = "Dwarf Geomancer", count = 5, storage = 21907}
},
message = "Good job, we are having problems with dwarf rebels in the mine now kill",
level = 20,
rewarditems = {
{id = 5880, count = 20}
},
rewardexp = 65000
},
[7] = {
items = {
{id = 11198, count = 45},
{id = 8859, count = 25}
},
message = "Excellent, i need some arachnids items for my research on the plague bring me",
level = 20,
rewarditems = {
{id = 8872, count = 1}
},
},
[8] = {
monsters = {
{name = "Dragons", count = 15, storage = 21908}
},
message = "Impressive those dwarfs will stay calm, you need a real challenge kill",
level = 30,
rewarditems = {
{id = 2516, count = 1},
{id = 2392, count = 1}
},
rewardexp = 80000
},
[9] = {
items = {
{id = 10566, count = 20},
{id = 12422, count = 20},
{id = 12423, count = 50},
{id = 10564, count = 10},
{id = 11200, count = 15},
{id = 10602, count = 5}
},
message = "I'm amazed, ok i need some undead items for my ritual try not to die okay? Bring me",
level = 30,
rewarditems = {
{id = 2656, count = 1}
},
},
[10] = {
monsters = {
{name = "Blue Djinns", count = 40, storage = 21909},
{name = "Green Djinns", count = 40, storage = 21910}
},
message = "Tension between the djinns are causing serious problems kill",
level = 35,
rewarditems = {
{id = 7730, count = 1}
},
rewardexp = 90000
},
[11] = {
items = {
{id = 12413, count = 35},
{id = 5877, count = 20},
{id = 5920, count = 5}
},
message = "That would be it. Merchants are asking me for dragon products. Bring me",
level = 40,
rewarditems = {
{id = 2160, count = 2}
},
},
[12] = {
monsters = {
{name = "Necromancers", count = 150, storage = 21911}
},
message = "We have to erracticate Necromancers, they are kidnaping people for their rituals. Kill ",
level = 40,
rewarditems = {
{id = 8922, count = 1},
{id = 8910, count = 1}
},
rewardexp = 120000
},
[13] = {
items = {
{id = 11225, count = 50},
{id = 10585, count = 25},
{id = 10579, count = 20},
{id = 11228, count = 20}
},
message = "The king thanks you.I'm on a research of the cause of mutation I need you to bring me",
level = 40,
rewarditems = {
{id = 2160, count = 1},
{id = 2476, count = 1},
{id = 2477, count = 1}
},
},
[14] = {
monsters = {
{name = "Orc Berserkers", count = 50, storage = 21912},
{name = "Orc Leaders", count = 30, storage = 21913},
{name = "Orc Shamans", count = 50, storage = 21914},
{name = "Orc Warlords", count = 15, storage = 21915}
},
message = "Thank you. The orcs are trying to do something, cut the head of them! kill ",
level = 45,
rewarditems = {
{id = 8891, count = 1},
{id = 11323, count = 1},
{id = 2160, count = 2}
},
rewardexp = 140000
},
[15] = {
items = {
{id = 11222, count = 60},
{id = 11339, count = 20}
},
message = "I need some materials to enchants an earth barrier bring me",
level = 50,
rewarditems = {
{id = 2160, count = 2},
{id = 7884, count = 1},
{id = 7885, count = 1}
},
},
[16] = {
monsters = {
{name = "Bonebeasts", count = 150, storage = 21916}
},
message = "This will help. Some creatures are hunting merchants in the desert kill",
level = 50,
rewarditems = {
{id = 5925, count = 45},
{id = 2528, count = 1},
{id = 2160, count = 3}
},
rewardexp = 180000
},
[17] = {
items = {
{id = 10548, count = 100}
},
message = "I need some materials for a powerful venom bring me",
level = 50,
rewarditems = {
{id = 2160, count = 4},
{id = 2524, count = 1}
},
},
[18] = {
monsters = {
{name = "Dragons", count = 70, storage = 21917}
},
message = "Great, dragon activity has risen putting on danger the cities, kill ",
level = 50,
rewarditems = {
{id = 7383, count = 1}
},
rewardexp = 220000
},
[19] = {
items = {
{id = 21246, count = 70}
},
message = "A spell barrier is needed to protect the town from evil magic bring me",
level = 50,
rewarditems = {
{id = 2160, count = 2},
{id = 8902, count = 1}
},
},
[20] = {
monsters = {
{name = "Bog Raiders", count = 150, storage = 21918}
},
message = "Some people have sickness because bog near Obre kill",
level = 50,
rewarditems = {
{id = 8849, count = 1},
{id = 2160, count = 4}
},
rewardexp = 260000
},
[21] = {
items = {
{id = 12658, count = 100},
{id = 12659, count = 100},
{id = 10557, count = 150},
{id = 11232, count = 150}
},
message = "I'm researching the infestation of some bugs, bring me",
level = 50,
rewarditems = {
{id = 13307, count = 1}
},
},
[22] = {
monsters = {
{name = "Giant Spiders", count = 80, storage = 21919}
},
message = "Spiders are attacking people near plains of havoc kill",
level = 50,
rewarditems = {
{id = 15489, count = 1}
},
[23] = {
items = {
{id = 5879, count = 15}
},
rewardexp = 270000
},
message = "I need some materials to fabricate a robe for the king bring me",
level = 55,
rewarditems = {
{id = 2487, count = 1},
{id = 2519, count = 1},
{id = 10522, count = 1}
},
},
[24] = {
monsters = {
{name = "Brain Deaths", count = 100, storage = 21920}
},
message = "Master beholders are cursing the lands kill",
level = 55,
rewarditems = {
{id = 13291, count = 1}
},
rewardexp = 290000
},
[25] = {
items = {
{id = 18416, count = 20},
{id = 18417, count = 20},
{id = 18418, count = 20}
},
rewardexp = 270000
},
message = "I need some special gems to enchant my gear bring me",
level = 55,
rewarditems = {
{id = 2160, count = 4}
},
},
[26] = {
monsters = {
{name = "Heros", count = 2000, storage = 21921}
},
message = "These outlaws have cause enough problems to our reign, this in an important mission only someone like you can do this, kill",
level = 60,
rewarditems = {
{id = 2503, count = 1}
},
rewardexp = 2500000
},
[27] = {
items = {
{id = 5904, count = 15}
},
message = "Impressive indeed, by the way i need ingredients to create magic items bring me",
level = 60,
rewarditems = {
{id = 2160, count = 1},
{id = 18412, count = 1}
},
},
[28] = {
monsters = {
{name = "Askarak Demon", count = 100, storage = 21922},
{name = "Askarak Lord", count = 50, storage = 21922},
{name = "Askarak Prince", count = 20, storage = 21922}
},
message = "Thank you, these new breed of demons have cause havoc in Yalmar kill",
level = 60,
rewarditems = {
{id = 2160, count = 7}
},
rewardexp = 300000
},
[29] = {
items = {
{id = 23568, count = 100}
},
message = "Some mutated creatures are spawning to much bring me",
level = 65,
rewarditems = {
{id = 2180, count = 7}
},
},
[30] = {
monsters = {
{name = "Devourers", count = 200, storage = 21923}
},
message = "These creatures are replicating you have to exterminate",
level = 60,
rewarditems = {
{id = 15490, count = 1},
{id = 11304, count = 1},
{id = 2260, count = 4}
},
rewardexp = 340000
},
[31] = {
items = {
{id = 5948, count = 50},
{id = 5882, count = 20}
},
message = "Excellent, i need some draconic material to infuse my armor bring me",
level = 65,
rewarditems = {
{id = 2492, count = 1}
},
},
[32] = {
monsters = {
{name = "Frost Dragons", count = 150, storage = 21924}
},
message = "Thank you, also i need your help in freljord kill",
level = 60,
rewarditems = {
{id = 2492, count = 1},
{id = 2498, count = 1},
{id = 2160, count = 3}
},
rewardexp = 360000
},
[33] = {
items = {
{id = 15455, count = 60},
{id = 15423, count = 60}
},
message = "Nice, i need you to bring me some deepling materials",
level = 65,
rewarditems = {
{id = 2160, count = 8}
},
},
[34] = {
monsters = {
{name = "Hydras", count = 200, storage = 21925}
},
message = "We need help in lacandona dealing with some creatures kill",
level = 65,
rewarditems = {
{id = 18448, count = 1},
},
rewardexp = 400000
},
[35] = {
items = {
{id = 11321, count = 30},
{id = 11322, count = 30},
id = 11314, count = 30},
{id = 12614, count = 30}
},
message = "Nice, i need you to bring me some deepling materials",
level = 65,
rewarditems = {
{id = 2160, count = 5},
{id = 11302, count = 1},
{id = 11301, count = 1},
{id = 11304, count = 1},
{id = 11305, count = 1}
},
},
[36] = {
monsters = {
{name = "Lizard Dragon Priests", count = 50, storage = 21926},
{name = "Lizard Legionnaires", count = 80, storage = 21926},
{name = "Lizard Zaoguns", count = 30, storage = 21926},
{name = "Lizard High Guards", count = 45, storage = 21926},
{name = "Lizard Chosens", count = 25, storage = 21926}
},
message = "Lizardkind are getting very strong kill",
level = 65,
rewarditems = {
{id = 18448, count = 1},
},
rewardexp = 430000
},
[37] = {
items = {
{id = 5930, count = 30},
{id = 5893, count = 30},
id = 12403, count = 100},
{id = 7396, count = 1}
},
message = "Nice, i need you to bring me some behemoth materials",
level = 65,
rewarditems = {
{id = 2160, count = 10},
{id = 7413, count = 1},
{id = 8839, count = 1},
{id = 5930, count = 15},
{id = 5911, count = 40}
},
},
[38] = {
monsters = {
{name = "Destroyers", count = 100, storage = 21927},
},
message = "These creatures are attacking towns kill",
level = 70,
rewarditems = {
{id = 18516, count = 5}
},
rewardexp = 410000
[39] = {
items = {
{id = 10582, count = 200},
},
message = "Well done i need some materials for a special robe bring me",
level = 65,
rewarditems = {
{id = 2160, count = 12},
{id = 15643, count = 1}
},
},
[40] = {
monsters = {
{name = "Hellspawns", count = 500, storage = 21928},
},
message = "These creatures are spawning through a infernal portal this is important kill",
level = 70,
rewarditems = {
{id = 2504, count = 5}
},
rewardexp = 700000
},
}
}
local storage = 45551
local function getItemsMonstersFromTable(imtable)
local text = ""
for v = 1, #imtable do
local ret = ", "
if v == 1 then
ret = ""
elseif v == #imtable then
ret = " and "
end
text = text .. ret
count = imtable[v].count
if imtable[v].id then
info = ItemType(imtable[v].id)
text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
else
text = text .. count .." "..imtable[v].name
end
end
return text
end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
local x = missions[player:getStorageValue(storage)]
if msgcontains(msg, 'mission') or msgcontains(msg, 'quest') then
if player:getStorageValue(storage) == -1 then
selfSay("I have several missions for you, do you accept the challenge?", cid)
npcHandler.topic[cid] = 1
elseif x then
if player:getLevel() >= x.level then
selfSay("Did you "..(x.items and "get "..getItemsMonstersFromTable(x.items) or "kill "..getItemsMonstersFromTable(x.monsters)).."?", cid)
npcHandler.topic[cid] = 1
else
selfSay("The mission I gave you is for level "..x.level..", come back later.", cid)
end
else
selfSay("You already did all the missions, great job though.", cid)
npcHandler:releaseFocus(cid)
end
elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
if player:getStorageValue(storage) == -1 then
player:setStorageValue(storage, 1)
local x = missions[player:getStorageValue(storage)]
selfSay(x.message.." "..getItemsMonstersFromTable(x.items or x.monsters)..".", cid)
elseif x then
local imtable = x.items or x.monsters
local amount = 0
for it = 1, #imtable do
local check = x.items and player:getItemCount(imtable[it].id) or player:getStorageValue(imtable[it].storage)
if check >= imtable[it].count then
amount = amount + 1
end
end
if amount == #imtable then
if x.items then
for it = 1, #x.items do
player:removeItem(x.items[it].id, x.items[it].count)
end
end
if x.rewarditems then
for r = 1, #x.rewarditems do
player:addItem(x.rewarditems[r].id, x.rewarditems[r].count)
end
player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "You received "..getItemsMonstersFromTable(x.rewarditems)..".")
end
if x.rewardexp then
player:addExperience(x.rewardexp)
player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "You received "..x.rewardexp.." experience.")
end
player:setStorageValue(storage, player:getStorageValue(storage) + 1)
local x = missions[player:getStorageValue(storage)]
if x then
selfSay(x.message.." "..getItemsMonstersFromTable(x.items or x.monsters)..".", cid)
else
selfSay("Well done! You did a great job on all your missions.", cid)
end
else
local n = 0
for i = 1, #imtable do
local check = x.items and player:getItemCount(imtable[i].id) or player:getStorageValue(imtable[i].storage)
if check < imtable[i].count then
n = n + 1
end
end
local text = ""
local c = 0
for v = 1, #imtable do
local check = x.items and player:getItemCount(imtable[v].id) or player:getStorageValue(imtable[v].storage)
if check < imtable[v].count then
c = c + 1
local ret = ", "
if c == 1 then
ret = ""
elseif c == n then
ret = " and "
end
text = text .. ret
if x.items then
local count, info = imtable[v].count - player:getItemCount(imtable[v].id), ItemType(imtable[v].id)
text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
else
local count = imtable[v].count - (player:getStorageValue(imtable[v].storage) + 1)
text = text .. count.." "..imtable[v].name
end
end
end
selfSay(x.items and "You don't have all items, you still need to get "..text.."." or "You didn't kill all monsters, you still need to kill "..text..".", cid)
end
end
npcHandler.topic[cid] = 0
elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
selfSay("Oh well, I guess not then.", cid)
npcHandler.topic[cid] = 0
end
return true
end
npcHandler:setMessage(MESSAGE_FAREWELL, "Bye!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye, have a nice day!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())