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

[TFS 1.0] Task system not counting kills | instruments won't play in inventory

EvoSoft

Is Da Mapper
Joined
Mar 10, 2010
Messages
693
Reaction score
5
Location
Northen part of Sweden
Title says it all - tell me which scripts you need from Killing in the name of.. quest and I'll post 'em.

Instruments script:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- TODO: Different music effect for different instruments.
fromPosition:sendMagicEffect(CONST_ME_SOUND_BLUE)

return true
end
 
Post the script that should count kills and also errors and how you added it etc.
here ya go
Code:
function onKill(cid, target, lastHit)
   local targetCreature = Creature(target)
   if targetCreature:isPlayer() or targetCreature:getMaster() then
     return true
   end

   local player, targetName = Player(cid), targetCreature:getName():lower()
   for _, taskId in ipairs(player:getStartedTasks()) do
     if isInArray(tasks[taskId].creatures, targetName) then
       local killAmount = player:getStorageValue(KILLSSTORAGE_BASE + taskId)
       if killAmount < tasks[taskId].killsRequired then
         player:setStorageValue(KILLSSTORAGE_BASE + taskId, killAmount + 1)
       end
     end
   end
   return true
end
 
You can add prints in the script to see where the problem is.
Code:
print("test1")
Code:
print("test2")
Etc.
Add them under function onKill and under if statements and the for loop.
Then look in your console which messages you get and which not, the line above the message you don't get, there is the problem.
If you don't get the message under function onKill, it means the script isn't added correct.
 
it doesnt print no error any other suggestion?
You can add prints in the script to see where the problem is.
Code:
print("test1")
Code:
print("test2")
Etc.
Add them under function onKill and under if statements and the for loop.
Then look in your console which messages you get and which not, the line above the message you don't get, there is the problem.
If you don't get the message under function onKill, it means the script isn't added correct.
 
If you don't get the print message you added under function onKill in your console, this means the script isn't added correct, so post how you added it.
 
You can add prints in the script to see where the problem is.
Code:
print("test1")
Code:
print("test2")
Etc.
Add them under function onKill and under if statements and the for loop.
Then look in your console which messages you get and which not, the line above the message you don't get, there is the problem.
If you don't get the message under function onKill, it means the script isn't added correct.
If you don't get the print message you added under function onKill in your console, this means the script isn't added correct, so post how you added it.

okay i just retested it i put script like this
Code:
function onKill(cid, target, lastHit)
   local targetCreature = Creature(target)
   if targetCreature:isPlayer() or targetCreature:getMaster() then
     return true
   end
print("test1")
   local player, targetName = Player(cid), targetCreature:getName():lower()
   for _, taskId in ipairs(player:getStartedTasks()) do
     if isInArray(tasks[taskId].creatures, targetName) then
       local killAmount = player:getStorageValue(KILLSSTORAGE_BASE + taskId)
       if killAmount < tasks[taskId].killsRequired then
         player:setStorageValue(KILLSSTORAGE_BASE + taskId, killAmount + 1)
       end
     end
   end
   return true
end
print("test2")

it shows test 1 but not test 2
 
That's because it's outside function onKill, so that won't be loaded when you kill something, add them after if statements.
For example under this line
Code:
if killAmount < tasks[taskId].killsRequired then
If you get the print from there, it means the script is working properly with the tables and all, so then it's a problem from an other script that makes it look like it's not counting them.
 
That's becaus it's outside function onKill, so that won't be loaded when you kill something, add them after if statements.
For example under this line
Code:
if killAmount < tasks[taskId].killsRequired then
If you get the print from there, it means the script is working properly with the tables and all, then then it's a problem from an other script that makes t look like it's not counting them.
would you have any idea what script it may be>
 
I mean, why do think that? What happens that makes you think it's not counting the kills? So which script is making it look like it's not counting them?
 
I mean, why do think that? What happens that makes you think it's not counting the kills? So which script is making it look like it's not counting them?

it will not updated my quest log and when i ask grizzly my status he says ive killed none of them
 
Back
Top