Well, im making a global project and I was wondering how can I fix this issue here.. I want the Demon Oak quest same as tibia-rl... When player obtain 100 task points and finish the Demons task (6666 monsters), the NPC Grizzly Adams give him a Holy Icon and then following to the wiki tutorial...
Issues: Grizzly Adams isn't finishing the Demon Task and have no Holy Icon... And Oak quest it's buggy! (follow scripts)...
grizzly adams (1st half of script)
Issues: Grizzly Adams isn't finishing the Demon Task and have no Holy Icon... And Oak quest it's buggy! (follow scripts)...
grizzly adams (1st half of script)
Code:
grizzly adams.lua
[CODE]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 choose = {}
local cancel = {}
local available = {}
local grizzlyAdamsConfig = {
ranks = {
--NOTE: The variable 'name' is not necessary to be declared. I let it so people who wants to change the script will now wich item is each one.
huntsMan_rank = {
{id=11208, buy=0, sell=50, name='antlers'},
{id=10549, buy=0, sell=100, name='bloody pincers'},
{id=11183, buy=0, sell=35, name='crab pincers'},
{id=10573, buy=0, sell=55, name='cyclops toe'},
{id=10564, buy=0, sell=30, name='frosty ear of a troll'},
{id=11193, buy=0, sell=600, name='hydra head'},
{id=11366, buy=0, sell=80, name='lancer beetle shell'},
{id=10578, buy=0, sell=420, name='mutated bat ear'},
{id=11222, buy=0, sell=400, name='sabretooth'},
{id=11367, buy=0, sell=20, name='sandcrawler shell'},
{id=10547, buy=0, sell=280, name='scarab pincers'},
{id=11365, buy=0, sell=60, name='terramite legs'},
{id=11363, buy=0, sell=170, name='terramite shell'},
{id=11184, buy=0, sell=95, name='terrorbird beak'},
{id=7398, buy=0, sell=500, name='cyclops trophy'},
{id=11315, buy=0, sell=15000, name='draken trophy'},
{id=11336, buy=0, sell=8000, name='lizard trophy'},
{id=7401, buy=0, sell=500, name='minotaur trophy'}
},
bigGameHunter_rank = {
{id=7397, buy=0, sell=3000, name='deer trophy'},
{id=7400, buy=0, sell=3000, name='lion trophy'},
{id=7394, buy=0, sell=3000, name='wolf trophy'}
},
trophyHunter_rank = {
{id=7393, buy=0, sell=40000, name='demon trophy'},
{id=7396, buy=0, sell=20000, name='behemoth trophy'},
{id=7399, buy=0, sell=10000, name='dragon lord trophy'},
{id=10518, buy=1000, sell=0, name='demon backpack'},
},
}
}
local items, data = {}
for i = 1, #grizzlyAdamsConfig.ranks.huntsMan_rank do
data = grizzlyAdamsConfig.ranks.huntsMan_rank[i]
items[data.id] = {id = data.id, buy = data.buy, sell = data.sell, name = ItemType(data.id):getName():lower()}
end
for i = 1, #grizzlyAdamsConfig.ranks.bigGameHunter_rank do
data = grizzlyAdamsConfig.ranks.bigGameHunter_rank[i]
items[data.id] = {id = data.id, buy = data.buy, sell = data.sell, name = ItemType(data.id):getName():lower()}
end
for i = 1, #grizzlyAdamsConfig.ranks.trophyHunter_rank do
data = grizzlyAdamsConfig.ranks.trophyHunter_rank[i]
items[data.id] = {id = data.id, buy = data.buy, sell = data.sell, name = ItemType(data.id):getName():lower()}
end
local function greetCallback(cid)
local player = Player(cid)
if player:getStorageValue(JOIN_STOR) == -1 then
npcHandler:setMessage(MESSAGE_GREET, 'Welcome |PLAYERNAME|. Would you like to join the \'Paw and Fur - Hunting Elite\'?')
else
npcHandler:setMessage(MESSAGE_GREET, 'Welcome back old chap. What brings you here this time?')
end
return true
end
local function getTradeItems(t)
local list, obj = {}
for i = 1, #t do
obj = t[i]
list[obj.id] = {id = obj.id, buy = obj.buy, sell = obj.sell, name = ItemType(obj.id):getName():lower()}
end
return list
end
local function joinTables(old, new)
for k, v in pairs(new) do
old[k] = v
end
return old
end
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then return false end
local player = Player(cid)
if msgcontains('trade', msg) then
local tradeItems = {}
if player:getPawAndFurRank() >= 2 then
tradeItems = grizzlyAdamsConfig.ranks.huntsMan_rank
if player:getPawAndFurRank() == 4 then
tradeItems = joinTables(tradeItems, grizzlyAdamsConfig.ranks.bigGameHunter_rank)
elseif player:getPawAndFurRank() == 5 or player:getPawAndFurRank() == 6 then
tradeItems = joinTables(tradeItems, grizzlyAdamsConfig.ranks.bigGameHunter_rank)
tradeItems = joinTables(tradeItems, grizzlyAdamsConfig.ranks.trophyHunter_rank)
end
openShopWindow(cid, tradeItems, onBuy, onSell)
return npcHandler:say('It\'s my offer.', cid)
else
return npcHandler:say('You don\'t have any rank.', cid)
end
elseif (msgcontains('join', msg) or msgcontains('yes', msg))
and npcHandler.topic[cid] == 0
and player:getStorageValue(JOIN_STOR) ~= 1 then
player:setStorageValue(JOIN_STOR, 1)
npcHandler:say('Great!, now you can start tasks.', cid) --I'm not sure if this is as real tibia. I let this piece of code because it was in the original file.
elseif isInArray({'tasks', 'task', 'mission'}, msg:lower()) then
local can = player:getTasks()
if player:getStorageValue(JOIN_STOR) == -1 then
return npcHandler:say('You\'ll have to {join}, to get any {tasks}.',cid)
end
if #can > 0 then
local text = ''
local sep = ', '
table.sort(can, function(a, b) return a < b end)
local t = 0
local id
for i = 1, #can do
id = can[i]
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
npcHandler:say('The current task' .. (#can > 1 and 's' or '') .. ' that you can choose ' .. (#can > 1 and 'are' or 'is') .. ' ' .. text, cid)
npcHandler.topic[cid] = 0
else
npcHandler:say('I don\'t have any task for you right now.', cid)
end
elseif msg ~= '' and player:canStartTask(msg) then
if #player:getStartedTasks() >= tasksByPlayer then
npcHandler:say('Sorry, but you already started ' .. tasksByPlayer .. ' tasks. You can check their {status} or {cancel} a task.', cid)
return true
end