• 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!

Solved [TFS 1.0] killingInTheNameOfQuest

Sentinel3

New Member
Joined
Oct 16, 2014
Messages
180
Reaction score
0
Hi everyone,

I've got a problem when players want to start the tasks of Grizzly Adams NPC.

Using: Lastest version of TFS 1.0

The problem is when players try to start the task and monsters killed doesn't count in task.

/data/creaturescripts/scripts/killing in the name of quest/killingInTheNameOfQuestKills.lua
HTML:
dofile('data/lib/killingInTheNameOfQuest.lua')

function onKill(cid, target, lastHit)
    local started = getPlayerStartedTasks(cid)
    if isPlayer(target) or isSummon(target) then return true end
    if started and #started > 0 then
        for _, id in ipairs(started) do
            if isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
                if getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
                    setPlayerStorageValue(cid, KILLSSTORAGE_BASE + id, getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) + 1)
                end
            end
        end
    end
    return true
end
/data/lib/killingInTheNameOfQuestKills.lua
http://pastebin.com/BuNf1AJ3
 
Last edited:
Are you sure that the storage value was changed when killing monsters? You can check this in the database (phpmyadmin) for your player id, and the storage id 65000 + (task id)

Ignazio
 
For example my character, I tested the quest too.
Sinnombre_zps79465561.png
 
Good, now we've established that the kills aren't accounted for. Let's make some prints to identify the error.

Code:
dofile('data/lib/killingInTheNameOfQuest.lua')

function onKill(cid, target, lastHit)
local started = getPlayerStartedTasks(cid)
print("A: " .. #started)
if isPlayer(target) or isSummon(target) then return true end
if started and #started > 0 then
for _, id in ipairs(started) do
print("B: " .. id)
print("C: " .. getCreatureName(target):lower())
if isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
if getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
setPlayerStorageValue(cid, KILLSSTORAGE_BASE + id, getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) + 1)
end
end
end
end
return true
end

Try to temporarily replace your code with this, kill a monster that you should and give me a picture of what the console spits out.

Ignazio
 
Creaturescripts.xml
HTML:
    <!-- Killing In The Name Of Quest -->
    <event type="kill" name="killingInTheNameOfQuestKills" script="killing in the name of quest/killingInTheNameOfQuestKills.lua"/>
 
I wonder if it is even read, the file. Is the file really in that folder? You should consider not have whitespaces in folder names. In any case, try to replace the script with this and reload creaturescripts, just for checking.

Code:
dofile('data/lib/killingInTheNameOfQuest.lua')

function onKill(cid, target, lastHit)
local started = getPlayerStartedTasks(cid)
print("A: " .. #started)
if isPlayer(target) or isSummon(target) then return true end
if started and #started > 0 then
for _, id in ipairs(started) do
print("B: " .. id)
print("C: " .. getCreatureName(target):lower())
iffffffffffffffff isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
if getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
setPlayerStorageValue(cid, KILLSSTORAGE_BASE + id, getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) + 1)
end
end
end
end
return true
end
 
Did you forget this line:
Code:
registerCreatureEvent(cid, "killingInTheNameOfQuestKills")
in your data/creaturescripts/scripts/login.lua ?
If it is not there then add it and try again please
 
Back
Top