Olá galerinha do XTIBIA. Estou com um pequeno problema.
Meu npc de Tasks Grizzly funfa quase perfeito, você consegue pegar a task e até ai tudo bem... maaaas, quando você vai matar os monstros, na contagem que aparece no default, não sai do número 0.
vou dar um exemplo, peguei a task das hydras.. devo matar 650, dai quando estou caçando, que vou matando elas.. a mensagem vai aparecendo no default cada vez que mato 1. Deveria ir aumentando até chegar a 650, mas não dai do 0, veja;
05:44 Killing 0 of 650 hydras....
05:45 Killing 0 of 650 hydras....
05:45 Killing 0 of 650 hydras....
05:46 Killing 0 of 650 hydras....
05:46 Killing 0 of 650 hydras....
Entenderam? deveria ir aumentando, mas não sai do 0, e mesmo que eu mate 650, não consigo terminar a task pois não está contando... vou postar aqui o script que peguei no OTLAND:
data/npc/scripts.lua
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 choose = {}
local cancel = {}
local available = {}
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
if isInArray({"tasks", "task", "mission"}, msg:lower()) then
local can = getTasksByPlayer(cid)
if #can > 0 then
local text = ""
local sep = ", "
table.sort(can, (function(a, b) return (a < b) end))
local t = 0
for _, id in ipairs(can) do
t = t + 1
if t == #can - 1 then
sep = " and "
elseif t == #can then
sep = "."
end
text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
end
selfSay("The current task" .. (#can > 1 and "s" or "") .. " that you can choose " .. (#can > 1 and "are" or "is") .. " " .. text, cid)
talkState[talkUser] = 0
else
selfSay("I don't have any task for you right now.", cid)
end
elseif msg ~= "" and canStartTask(cid, msg) then
if #getPlayerStartedTasks(cid) >= tasksByPlayer then
selfSay("Sorry, but you already started " .. tasksByPlayer .. " tasks.", cid)
return true
end
local task = getTaskByName(msg)
if task and getCreatureStorage(cid, QUESTSTORAGE_BASE + task) > 0 then
return false
end
selfSay("In this task you must defeat " .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Are you sure that you want to start this task?", cid)
choose[cid] = task
talkState[talkUser] = 1
elseif msg:lower() == "yes" and talkState[talkUser] == 1 then
selfSay("You haven't finished any task yet.", cid)
else
selfSay("Awesome! you finished " .. (finished > 1 and "various" or "a") .. " task" .. (finished > 1 and "s" or "") .. ". Talk to me again if you want to start a task.", cid)
end
else
selfSay("You haven't started any task yet.", cid)
end
elseif msg:lower() == "started" then
local started = getPlayerStartedTasks(cid)
if started and #started > 0 then
local text = ""
local sep = ", "
table.sort(started, (function(a, b) return (a < b) end))
local t = 0
for _, id in ipairs(started) do
t = t + 1
if t == #started - 1 then
sep = " and "
elseif t == #started then
sep = "."
end
text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
end
selfSay("The current task" .. (#started > 1 and "s" or "") .. " that you started " .. (#started > 1 and "are" or "is") .. " " .. text, cid)
else
selfSay("You haven't started any task yet.", cid)
end
elseif msg:lower() == "cancel" then
local started = getPlayerStartedTasks(cid)
if started and #started > 0 then
selfSay("Cancelling a task will make the count restart. Wich task you want to cancel?", cid)
talkState[talkUser] = 2
else
selfSay("You haven't started any task yet.", cid)
end
elseif getTaskByName(msg) and talkState[talkUser] == 2 and isInArray(getPlayerStartedTasks(cid), getTaskByName(msg)) then
local task = getTaskByName(msg)
if getCreatureStorage(cid, KILLSSTORAGE_BASE + task) > 0 then
selfSay("You currently killed " .. getCreatureStorage(cid, KILLSSTORAGE_BASE + task) .. "/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Cancelling this task will restart the count. Are you sure you want to cancel this task?", cid)
else
selfSay("Are you sure you want to cancel this task?", cid)
end
talkState[talkUser] = 3
cancel[cid] = task
elseif msg:lower() == "yes" and talkState[talkUser] == 3 then
selfSay("You have cancelled the task " .. (tasks[cancel[cid]].name or tasks[cancel[cid]].raceName) .. ".", cid)
talkState[talkUser] = 0
elseif isInArray({"points", "rank"}, msg:lower()) then
selfSay("At this time, you have " .. getCreatureStorage(cid, POINTSSTORAGE) .. " Paw & Fur points. You " .. (getPlayerRank(cid) == 5 and "are an Elite Hunter" or getPlayerRank(cid) == 4 and "are a Trophy Hunter" or getPlayerRank(cid) == 3 and "are a Big Game Hunter" or getPlayerRank(cid) == 2 and "are a Ranger" or getPlayerRank(cid) == 1 and "are a Huntsman" or "haven't been ranked yet") .. ".", cid)
[48] = {killsRequired = 3000, raceName = "Pirates second task", level = {1, 9999}, storage = {REPEATSTORAGE_BASE + 47, 3}, norepeatable = true, premium = true, creatures = {"pirate ghost", "pirate marauder", "pirate cutthroad", "pirate buccaneer", "pirate corsair", "pirate skeleton"}, rewards = { --Requires an storage (Gained completing Raymond Striker's first task three times.) NOTE: The required storage to start this task is: base + first pirate task id (47)
{type = "exp", value = {10000}},
{type = "money", value = {5000}},
{type = "storage", value = {35031, 1}}
}},
[49] = {killsRequired = 5000, raceName = "Minotaurs", level = {1, 40}, storage = {12700, 1}, norepeatable = true, premium = false, creatures = {"minotaur", "minotaur mage", "minotaur archer"}, rewards = { --Requires an storage (Gained on To Outfox a Fox Quest)
{type = "storage", value = {35032, 1}}
}},
[50] = {killsRequired = 4000, raceName = "Necromancers and Priestess", level = {60, 9999}, norepeatable = true, premium = true, creatures = {"necromancer", "priestess"}, rewards = { --Requires an storage (Gained on To Outfox a Fox Quest)
{type = "storage", value = {35033, 1}},
{type = "storage", value = {12800, 1}} --storage to stark the second Necromancers and Priestess task.
}},
[49] = {killsRequired = 1000, name = "Necromancers and Priestess second task", raceName = "Necromancers and Priestess", level = {60, 9999}, storage = {12800, 1}, norepeatable = true, premium = true, creatures = {"necromancer", "priestess"}, rewards = { --Requires an storage (Gained on To Outfox a Fox Quest)
{type = "exp", value = {40000}},
{type = "storage", value = {35033, 1}}
}},
}
tasksByPlayer = 3
repeatTimes = 3
function getPlayerRank(cid)
return (getPlayerStorageValue(cid, POINTSSTORAGE) >= 100 and RANK_ELITEHUNTER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 70 and RANK_TROPHYHUNTER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 40 and RANK_BIGGAMEHUNTER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 20 and RANK_RANGER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 10 and RANK_HUNTSMAN or RANK_NONE)
end
function getTaskByName(name, table)
local t = (table and table or tasks)
for k, v in pairs(t) do
if v.name then
if v.name:lower() == name:lower() then
return k
end
else
if v.raceName:lower() == name:lower() then
return k
end
end
end
return false
end
function getTasksByPlayer(cid)
local canmake = {}
local able = {}
for k, v in pairs(tasks) do
if getCreatureStorage(cid, QUESTSTORAGE_BASE + k) < 1 and getCreatureStorage(cid, REPEATSTORAGE_BASE + k) < repeatTimes then
able[k] = true
if getPlayerLevel(cid) < v.level[1] or getPlayerLevel(cid) > v.level[2] then
able[k] = false
end
if v.storage and getCreatureStorage(cid, v.storage[1]) < v.storage[2] then
able[k] = false
end
if v.rank then
if getPlayerRank(cid) < v.rank then
able[k] = false
end
end
if v.premium then
if not isPremium(cid) then
able[k] = false
end
end
if able[k] then
table.insert(canmake, k)
end
end
end
return canmake
end
function canStartTask(cid, name, table)
local v = ""
local id = 0
local t = (table and table or tasks)
for k, i in pairs(t) do
if i.name then
if i.name:lower() == name:lower() then
v = i
id = k
break
end
else
if i.raceName:lower() == name:lower() then
v = i
id = k
break
end
end
end
if v == "" then
return false
end
if getCreatureStorage(cid, QUESTSTORAGE_BASE + id) > 0 then
return false
end
if (getCreatureStorage(cid, REPEATSTORAGE_BASE + id) >= repeatTimes) or (v.norepeatable and getCreatureStorage(cid, REPEATSTORAGE_BASE + id) > 0) then
return false
end
if getPlayerLevel(cid) >= v.level[1] and getPlayerLevel(cid) <= v.level[2] then
if v.premium then
if isPremium(cid) then
if v.rank then
if getPlayerRank(cid) >= v.rank then
if v.storage then
if getCreatureStorage(cid, v.storage[1]) >= v.storage[2] then
return true
end
else
return true
end
end
else
return true
end
end
else
return true
end
end
return false
end
function getPlayerStartedTasks(cid)
local tmp = {}
for k, v in pairs(tasks) do
if getCreatureStorage(cid, QUESTSTORAGE_BASE + k) > 0 and getCreatureStorage(cid, QUESTSTORAGE_BASE + k) < 2 then
Pergunta
victorcx 0
Olá galerinha do XTIBIA. Estou com um pequeno problema.
Meu npc de Tasks Grizzly funfa quase perfeito, você consegue pegar a task e até ai tudo bem... maaaas, quando você vai matar os monstros, na contagem que aparece no default, não sai do número 0.
vou dar um exemplo, peguei a task das hydras.. devo matar 650, dai quando estou caçando, que vou matando elas.. a mensagem vai aparecendo no default cada vez que mato 1. Deveria ir aumentando até chegar a 650, mas não dai do 0, veja;
05:44 Killing 0 of 650 hydras....
05:45 Killing 0 of 650 hydras....
05:45 Killing 0 of 650 hydras....
05:46 Killing 0 of 650 hydras....
05:46 Killing 0 of 650 hydras....
Entenderam? deveria ir aumentando, mas não sai do 0, e mesmo que eu mate 650, não consigo terminar a task pois não está contando... vou postar aqui o script que peguei no OTLAND:
data/npc/scripts.lua
local keywordHandler = KeywordHandler:new()
RANK_NONE = 0
Link para o comentário
https://xtibia.com/forum/topic/230879-npc-grizzly-adams/Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados