• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

NPC Grizzly Adams (Killing in the name of... Quest) All tasks, more real-tibia

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
8
Reaction score
2,980
Location
Netherlands
Try to change "if(not npcHandler:isFocused(cid)) then" to
Code:
if npcHandler.focus ~= cid then
 

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
8
Reaction score
2,980
Location
Netherlands
Change doPlayerSetStorageValue to setPlayerStorageValue or add this in global.lua
Code:
doPlayerSetStorageValue = setPlayerStorageValue
 

radioayowa

New Member
Joined
Feb 19, 2013
Messages
11
Best answers
0
Reaction score
0
Now I do not have any errors in the console, but if you enter the Gryzzly adams he would write off some of me still ... I do not know what may be a case

 

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
8
Reaction score
2,980
Location
Netherlands
Try to remove , cid or try with npcHandler:say (also without cid).
 

radioayowa

New Member
Joined
Feb 19, 2013
Messages
11
Best answers
0
Reaction score
0
My script now look like this maybe this script is not working with Avesta 7.6 v4 :(

local rankStorage = 32150
local choose = {}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local voc = {}

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

function creatureSayCallback(cid, type, msg)

if npcHandler.focus ~= cid then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
if msgcontains(msg, "task") then
selfSay("There you can see the following tasks, please tell me the number of the task that you want to do.", cid)
local text = "Number - Name"
for i = 1, table.maxn(tasks) do
text = text .. "\n" .. i .. " - " .. tasks.raceName .. (getCreatureStorage(cid, tasks.questStarted) == 2 and " [Done]" or "")
end
doShowTextDialog(cid, 5956, text)

elseif tasks[tonumber(msg)] then
msg = tonumber(msg)
if getCreatureStorage(cid, tasks[msg].questStarted) == 1 then
selfSay("You are already making this task.", cid)
talkState[talkUser] = 0
return true
end
if getCreatureStorage(cid, tasks[msg].questStarted) == 2 then
selfSay("You already finished this task.", cid)
talkState[talkUser] = 0
return true
end
if tasks[msg].level and getPlayerLevel(cid) < tasks[msg].level then
selfSay("You need level " .. tasks[msg].level .. " or higher to make this task.", cid)
talkState[talkUser] = 0
return true
end
for k, v in pairs(tasks) do
if getCreatureStorage(cid, v.questStarted) == 1 and tasks[msg] ~= k then
selfSay("You are already making a task.", cid)
talkState[talkUser] = 0
return true
end
end
selfSay("Are you sure that do you want to start the task number " .. msg .. "?. In this task you will need to defeat " .. tasks[msg].killsRequired .. " " .. tasks[msg].raceName .. ".", cid)
choose[cid] = msg
talkState[talkUser] = 1
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
doCreatureSetStorage(cid, tasks[choose[cid]].questStarted, 1)
selfSay("You have started the task number " .. choose[cid] .. ", remember... in this task you will need to defeat " .. tasks[choose[cid]].killsRequired .. " " .. tasks[choose[cid]].raceName .. ". Good luck!", cid)
talkState[talkUser] = 0

elseif msgcontains(msg, "report") then
for k, v in pairs(tasks) do
if getCreatureStorage(cid, v.questStarted) == 1 then
if getCreatureStorage(cid, v.questStorage) >= v.killsRequired then
for i = 1, table.maxn(v.rewards) do
if(v.rewards.enable) then
if isInArray({"boss", "teleport", 1}, v.rewards.type) then
doTeleportThing(cid, v.rewards.values)
elseif isInArray({"exp", "experience", 2}, v.rewards.type) then
doPlayerAddExperience(cid, v.rewards.values)
elseif isInArray({"item", 3}, v.rewards.type) then
doPlayerAddItem(cid, v.rewards.values[1], v.rewards.values[2])
elseif isInArray({"money", 4}, v.rewards.type) then
doPlayerAddMoney(cid, v.rewards.values)
elseif isInArray({"storage", "stor", 5}, v.rewards.type) then
doCreatureSetStorage(cid, v.rewards.values[1], v.rewards.values[2])
elseif isInArray({"points", "rank", 2}, v.rewards.type) then
doCreatureSetStorage(cid, rankStorage, getCreatureStorage(cid, rankStorage) + v.rewards.values)
else
print("[Warning - Error::Killing in the name of::Tasks config] Bad reward type: " .. v.rewards.type .. ", reward could not be loaded.")
end
end
end
local rank = getCreatureStorage(cid, rankStorage)
selfSay("Great!... you have finished the task number " .. k .. "" .. (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, v.questStarted, 2)
break
else
if getCreatureStorage(cid, v.questStorage) < 0 then
doCreatureSetStorage(cid, v.questStorage, 0)
end
selfSay("Current " .. getCreatureStorage(cid, v.questStorage) .. " " .. v.raceName .. " killed, you need to kill " .. v.killsRequired .. ".", cid)
break
end
end
end
end
return true
end
getCreatureStorage = getPlayerStorageValue
doCreatureSetStorage = setPlayerStorageValue
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
8
Reaction score
2,980
Location
Netherlands
I'm not familiar with Avesta, but old client servers don't use cid in the npc textmessages, since it's not in an npc channel, so you can try to remove that or change selfSay to npcHandler:say (also without cid).
 

radioayowa

New Member
Joined
Feb 19, 2013
Messages
11
Best answers
0
Reaction score
0
The progress of all kind of work, but I have another error in the console:


and when i kill some trolls he tell me :
22:08 Grizzly Adams: Current 0 Trolls killed, you need to kill 100.
 

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
8
Reaction score
2,980
Location
Netherlands
If you don't get errors you probable added it incorrect or you're missing the function isSummon.
 

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
8
Reaction score
2,980
Location
Netherlands
From Mystic Spirit
Code:
function isSummon(cid)
   return (isCreature(cid) == TRUE and (getCreatureMaster(cid) ~= cid)) and TRUE or FALSE
end
Add it to your Lua lib file, global.lua or function.lua (you can also add it in the script itself btw).
 

Stellow

C++/C#/PHP/LUA
Joined
Oct 23, 2008
Messages
1,061
Best answers
0
Reaction score
168
Location
Germany
It still not counting, I am using OTHIRE
 
Last edited:

Stellow

C++/C#/PHP/LUA
Joined
Oct 23, 2008
Messages
1,061
Best answers
0
Reaction score
168
Location
Germany
It still not counting, I am using OTHIRE
I try to print the outputs to see the error, I think it the creaturescript is not even loading. I had it set on login file and stuff, ideas?
 

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,611
Best answers
9
Reaction score
244
Location
Chile
data/npc/scripts/KillingInTheNameOf.lua:6: function arguments expected near ':'
please i got this error


NpcSystem.parseParameters(npcHandler)
local talkState = {}

file 6 >>function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHa
 
Last edited:

Heatblade12

Member
Joined
Aug 12, 2013
Messages
24
Best answers
0
Reaction score
6
just thought i would ask, i tried for a while, and before i start posting my code, and demanding help, may i ask,

does this work with TFS 1.2?
 
Top