Kthxbye
New Member
- Joined
- Jul 11, 2012
- Messages
- 122
- Reaction score
- 2
how is it not counting but it is counting?but it's not counting the asks and when I did kill 100 it says this
Adonai: You didn't kill them all, you still need to kill 98 Trolls.
Some are counting some aren'thow is it not counting but it is counting?
Don't work
Demon Skeleton
Frost Dragons
mino
vampire
Tarantulas
wyrm
bonebeast
silencer
bonelord
grim reaper
hydra
elder wyrm
Work
Orcs
Rotworm
hero
giant spider
demon
-- Monster Tasks by Limos
-- Edited by Zeeb (aka Demnish)
local config = {
repeatTask = true
}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local xmsg = {}
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 storage = 62003
local monsters = {
["Orcs"] = {storage = 5011, mstorage = 19001, amount = 100, exp = 1000, items = {{id = 2152, count = 5}}},
["Rotworms"] = {storage = 5012, mstorage = 19002, amount = 100, exp = 5000, items = {{id = 2152, count = 10}}},
["Dragons"] = {storage = 5013, mstorage = 19003, amount = 100, exp = 10000, items = {{id = 2152, count = 25}}},
["Giant Spiders"] = {storage = 5014, mstorage = 19004, amount = 100, exp = 25000, items = {{id = 2152, count = 50}}},
["Heroes"] = {storage = 5015, mstorage = 19005, amount = 100, exp = 50000, items = {{id = 2160, count = 2}}},
["Demons"] = {storage = 5016, mstorage = 19006, amount = 666, exp = 1000000, items = {{id = 2160, count = 10}, {id = 24301, count = 1}}},
["Bonelords"] = {storage = 5017, mstorage = 19007, amount = 100, exp = 8000, items = {{id = 2152, count = 20}}},
["Frost Dragons"] = {storage = 5018, mstorage = 19008, amount = 250, exp = 150000, items = {{id = 2160, count = 5}}},
["Vampires"] = {storage = 5019, mstorage = 19009, amount = 150, exp = 30000, items = {{id = 2160, count = 1}}},
["Bonebeasts"] = {storage = 5020, mstorage = 19010, amount = 200, exp = 15000, items = {{id = 2152, count = 50}}},
["Tarantulas"] = {storage = 5021, mstorage = 19011, amount = 100, exp = 8000, items = {{id = 2152, count = 15}}},
["Minotaur"] = {storage = 5022, mstorage = 19012, amount = 500, exp = 10000, items = {{id = 2152, count = 30}}},
["Cyclops"] = {storage = 5023, mstorage = 19013, amount = 500, exp = 15000, items = {{id = 2160, count = 1}}},
["Demon Skeletons"] = {storage = 5024, mstorage = 19014, amount = 100, exp = 8000, items = {{id = 2152, count = 50}}},
["Grim Reapers"] = {storage = 5025, mstorage = 19015, amount = 500, exp = 800000, items = {{id = 2160, count = 10}, {id = 25413, count = 1}}},
["Wyrms"] = {storage = 5026, mstorage = 19016, amount = 500, exp = 500000, items = {{id = 2160, count = 5}}},
["Elder Wyrms"] = {storage = 5027, mstorage = 19017, amount = 300, exp = 400000, items = {{id = 2160, count = 5}}},
["Dark Torturers"] = {storage = 5028, mstorage = 19018, amount = 800, exp = 2000000, items = {{id = 2160, count = 20}}},
["Silencers"] = {storage = 5029, mstorage = 19019, amount = 150, exp = 100000, items = {{id = 2160, count = 3}, { id = 2195, count = 1}}},
["Sea Serpents"] = {storage = 5030, mstorage = 19020, amount = 1000, exp = 1500000, items = {{id = 2160, count = 10}, {id = 8884, count = 1}}},
["Serpent Spawns"] = {storage = 5031, mstorage = 19021, amount = 800, exp = 1000000, items = {{id = 2160, count = 15}}},
["Medusas"] = {storage = 5032, mstorage = 19022, amount = 500, exp = 800000, items = {{id = 2160, count = 10}}},
["Hydras"] = {storage = 5033, mstorage = 19023, amount = 400, exp = 300000, items = {{id = 2160, count = 5}}},
}
local function getItemsFromTable(itemtable)
local text = ""
for v = 1, #itemtable do
count, info = itemtable[v].count, ItemType(itemtable[v].id)
local ret = ", "
if v == 1 then
ret = ""
elseif v == #itemtable then
ret = " and "
end
text = text .. ret
text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
end
return text
end
local function Cptl(f, r)
return f:upper()..r:lower()
end
function creatureSayCallback(cid, type, msg)
local player, cmsg = Player(cid), msg:gsub("(%a)([%w_']*)", Cptl)
if not npcHandler:isFocused(cid) then
if msg == "hi" or msg == "hello" then
npcHandler:addFocus(cid)
if player:getStorageValue(storage) == -1 then
local text, n = "", 0
for k, x in pairs(monsters) do
if player:getStorageValue(x.mstorage) < x.amount then
n = n + 1
text = text .. ", "
text = text .. ""..x.amount.." {"..k.."}"
end
end
if n > 1 then
npcHandler:say("Well met adventurer. I have several tasks for you to kill monsters"..text..", which one do you choose? I can also show you a {list} with rewards and you can {stop} a task if you want.", cid)
npcHandler.topic[cid] = 1
xmsg[cid] = msg
elseif n == 1 then
npcHandler:say("I have one last task for you adventurer"..text..".", cid)
npcHandler.topic[cid] = 1
else
npcHandler:say("You already did all tasks, I have nothing for you to do anymore, good job though.", cid)
end
elseif player:getStorageValue(storage) == 1 then
for k, x in pairs(monsters) do
if player:getStorageValue(x.storage) == 1 then
npcHandler:say("Did you kill "..x.amount.." "..k.."?", cid)
npcHandler.topic[cid] = 2
xmsg[cid] = k
end
end
end
else
return false
end
elseif monsters[cmsg] and npcHandler.topic[cid] == 1 then
if player:getStorageValue(monsters[cmsg].storage) == -1 then
npcHandler:say("Good luck, come back when you killed "..monsters[cmsg].amount.." "..cmsg..".", cid)
player:setStorageValue(storage, 1)
player:setStorageValue(monsters[cmsg].storage, 1)
else
npcHandler:say("You already did the "..cmsg.." mission.", cid)
end
npcHandler.topic[cid] = 0
elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 2 then
local x = monsters[xmsg[cid]]
if player:getStorageValue(x.mstorage) >= x.amount then
if x.exp ~= nil and x.exp > 0 then
npcHandler:say("Good job, here is your reward, "..x.exp.." experience and "..getItemsFromTable(x.items)..".", cid)
else
npcHandler:say("Good job, here is your reward, "..getItemsFromTable(x.items)..".", cid)
end
for g = 1, #x.items do
player:addItem(x.items[g].id, x.items[g].count)
end
if x.exp ~= nil and x.exp > 0 then
player:addExperience(x.exp)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
end
if config.repeatTask then
player:setStorageValue(x.storage, -1)
player:setStorageValue(x.mstorage, -1)
else
player:setStorageValue(x.storage, 2)
end
player:setStorageValue(storage, -1)
npcHandler.topic[cid] = 3
else
npcHandler:say("You didn't kill them all, you still need to kill "..x.amount -(player:getStorageValue(x.mstorage) + 1).." "..xmsg[cid]..".", cid)
end
elseif msgcontains(msg, "task") and npcHandler.topic[cid] == 3 then
local text, n = "", 0
for k, x in pairs(monsters) do
if player:getStorageValue(x.mstorage) < x.amount then
n = n + 1
text = text .. (n == 1 and "" or ", ")
text = text .. ""..x.amount.." {"..k.."}"
end
end
if text ~= "" then
npcHandler:say("Want to do another task? You can choose "..text..".", cid)
npcHandler.topic[cid] = 1
else
npcHandler:say("You already did all tasks.", cid)
end
elseif msgcontains(msg, "no") and npcHandler.topic[cid] == 1 then
npcHandler:say("Ok then.", cid)
npcHandler.topic[cid] = 0
elseif msgcontains(msg, "stop") then
local text, n = "", 0
for k, x in pairs(monsters) do
if player:getStorageValue(x.mstorage) < x.amount then
n = n + 1
text = text .. (n == 1 and "" or ", ")
text = text .. "{"..k.."}"
if player:getStorageValue(x.storage) == 1 then
player:setStorageValue(x.storage, -1)
end
end
end
if player:getStorageValue(storage) == 1 then
npcHandler:say("Alright, let me know if you want to continue an other task, you can still choose "..text..".", cid)
else
npcHandler:say("You didn't start any new task yet, if you want to start one, you can choose "..text..".", cid)
end
player:setStorageValue(storage, -1)
npcHandler.topic[cid] = 1
elseif msgcontains(msg, "list") then
local text = "Tasks\n\n"
for k, x in pairs(monsters) do
if player:getStorageValue(x.mstorage) < x.amount then
text = text ..k .." ["..(player:getStorageValue(x.mstorage) + 1).."/"..x.amount.."]:\n Rewards:\n "..getItemsFromTable(x.items).."\n "..x.exp.." experience \n\n"
else
text = text .. k .." [DONE]\n"
end
end
player:showTextDialog(1949, "" .. text)
npcHandler:say("Here you are.", cid)
elseif msgcontains(msg, "bye") then
npcHandler:say("Bye.", cid)
npcHandler:releaseFocus(cid)
else
npcHandler:say("What?", cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
is it possible to convert it to modal window?
-- Monster Tasks by Limos
-- Edited by Zeeb (aka Demnish)
local config = {
repeatTask = true
}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local xmsg = {}
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 storage = 62003
local monsters = {
["Trolls"] = {storage = 5010, mstorage = 19000, amount = 100, exp = 1000, items = {{id = 2152, count = 5}}},
["Orcs"] = {storage = 5011, mstorage = 19001, amount = 100, exp = 1000, items = {{id = 2152, count = 5}}},
["Rotworms"] = {storage = 5012, mstorage = 19002, amount = 100, exp = 5000, items = {{id = 2152, count = 10}}},
["Dragons"] = {storage = 5013, mstorage = 19003, amount = 100, exp = 10000, items = {{id = 2152, count = 25}}},
["Giant Spiders"] = {storage = 5014, mstorage = 19004, amount = 100, exp = 25000, items = {{id = 2152, count = 50}}},
["Heroes"] = {storage = 5015, mstorage = 19005, amount = 100, exp = 50000, items = {{id = 2160, count = 1}}},
["Demons"] = {storage = 5016, mstorage = 19006, amount = 6, exp = 1000000, items = {{id = 2160, count = 10}, {id = 24301, count = 1}}}
}
local function getItemsFromTable(itemtable)
local text = ""
for v = 1, #itemtable do
count, info = itemtable[v].count, ItemType(itemtable[v].id)
local ret = ", "
if v == 1 then
ret = ""
elseif v == #itemtable then
ret = " and "
end
text = text .. ret
text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
end
return text
end
local function Cptl(f, r)
return f:upper()..r:lower()
end
function creatureSayCallback(cid, type, msg)
local player, cmsg = Player(cid), msg:gsub("(%a)([%w_']*)", Cptl)
if not npcHandler:isFocused(cid) then
if msg == "hi" or msg == "hello" then
npcHandler:addFocus(cid)
if player:getStorageValue(storage) == -1 then
local text, n = "", 0
for k, x in pairs(monsters) do
if player:getStorageValue(x.mstorage) < x.amount then
n = n + 1
text = text .. ", "
text = text .. ""..x.amount.." {"..k.."}"
end
end
if n > 1 then
npcHandler:say("Well met adventurer. I have several tasks for you to kill monsters"..text..", which one do you choose? I can also show you a {list} with rewards and you can {stop} a task if you want.", cid)
npcHandler.topic[cid] = 1
xmsg[cid] = msg
elseif n == 1 then
npcHandler:say("I have one last task for you adventurer"..text..".", cid)
npcHandler.topic[cid] = 1
else
npcHandler:say("You already did all tasks, I have nothing for you to do anymore, good job though.", cid)
end
elseif player:getStorageValue(storage) == 1 then
for k, x in pairs(monsters) do
if player:getStorageValue(x.storage) == 1 then
npcHandler:say("Hey! Did you kill "..x.amount.." "..k.."? I can also show you a {list} with rewards and you can {stop} a task if you want.", cid)
npcHandler.topic[cid] = 2
xmsg[cid] = k
end
end
end
else
return false
end
elseif monsters[cmsg] and npcHandler.topic[cid] == 1 then
if player:getStorageValue(monsters[cmsg].storage) == -1 then
npcHandler:say("Good luck, come back when you killed "..monsters[cmsg].amount.." "..cmsg..".", cid)
npcHandler:releaseFocus(cid)
player:setStorageValue(storage, 1)
player:setStorageValue(monsters[cmsg].storage, 1)
else
npcHandler:say("You already did the "..cmsg.." mission.", cid)
end
npcHandler.topic[cid] = 0
elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 2 then
local x = monsters[xmsg[cid]]
if player:getStorageValue(x.mstorage) >= x.amount then
if x.exp ~= nil and x.exp > 0 then
npcHandler:say("Good job, here is your reward, "..x.exp.." experience and "..getItemsFromTable(x.items)..". Want to do another {task}?", cid)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "[Grizzly Adams Task] Reward received: +"..x.exp.." and "..getItemsFromTable(x.items)..".")
else
npcHandler:say("Good job, here is your reward, "..getItemsFromTable(x.items)..".", cid)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "[Grizzly Adams Task] Reward received: "..getItemsFromTable(x.items)..".")
end
for g = 1, #x.items do
player:addItem(x.items[g].id, x.items[g].count)
end
if x.exp ~= nil and x.exp > 0 then
player:addExperience(x.exp)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
Game.sendAnimatedText("+"..x.exp.."", getCreaturePosition(cid), TEXTCOLOR_WHITE)
end
if config.repeatTask then
player:setStorageValue(x.storage, -1)
player:setStorageValue(x.mstorage, -1)
else
player:setStorageValue(x.storage, 2)
end
player:setStorageValue(storage, -1)
npcHandler.topic[cid] = 3
else
npcHandler:say("You didn't kill them all, you still need to kill "..x.amount -(player:getStorageValue(x.mstorage) + 1).." "..xmsg[cid]..".", cid)
end
elseif msgcontains(msg, "task") and npcHandler.topic[cid] == 3 then
local text, n = "", 0
for k, x in pairs(monsters) do
if player:getStorageValue(x.mstorage) < x.amount then
n = n + 1
text = text .. (n == 1 and "" or ", ")
text = text .. ""..x.amount.." {"..k.."}"
end
end
if text ~= "" then
npcHandler:say("You can choose "..text..".", cid)
npcHandler.topic[cid] = 1
else
npcHandler:say("You already did all tasks.", cid)
end
elseif msgcontains(msg, "no") and npcHandler.topic[cid] == 1 then
npcHandler:say("Ok then.", cid)
npcHandler.topic[cid] = 0
elseif msgcontains(msg, "stop") then
local text, n = "", 0
for k, x in pairs(monsters) do
if player:getStorageValue(x.mstorage) < x.amount then
n = n + 1
text = text .. (n == 1 and "" or ", ")
text = text .. "{"..k.."}"
if player:getStorageValue(x.storage) == 1 then
player:setStorageValue(x.storage, -1)
end
end
end
if player:getStorageValue(storage) == 1 then
npcHandler:say("Alright, let me know if you want to continue an other task, you can still choose "..text..".", cid)
else
npcHandler:say("You didn't start any new task yet, if you want to start one, you can choose "..text..".", cid)
end
player:setStorageValue(storage, -1)
npcHandler.topic[cid] = 1
elseif msgcontains(msg, "list") then
local text = "Tasks\n\n"
for k, x in pairs(monsters) do
if player:getStorageValue(x.mstorage) < x.amount then
text = text ..k .." ["..(player:getStorageValue(x.mstorage) + 1).."/"..x.amount.."]:\n Rewards:\n "..getItemsFromTable(x.items).."\n "..x.exp.." experience \n\n"
else
text = text .. k .." [DONE]\n"
end
end
player:showTextDialog(1949, "" .. text)
npcHandler:say("Here you are.", cid)
elseif msgcontains(msg, "bye") then
npcHandler:say("Bye.", cid)
npcHandler:releaseFocus(cid)
else
npcHandler:say("See you later.", cid)
npcHandler:releaseFocus(cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)