NPC Mission

OP
Limos

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,017
Reaction score
2,952
Location
Netherlands
Make sure the startvalue also matches with the one in the NPC script.
 

Activity

Member
Joined
Apr 7, 2016
Messages
182
Reaction score
21
local config = {
['rat'] = {amount = 20, storage = 21900, startstorage = 45551, startvalue = 1},
['rotworm'] = {amount = 26, storage = 21901, startstorage = 45551, startvalue = 1},
['dragon lord'] = {amount = 25, storage = 21902, startstorage = 45551, startvalue = 1}
}
function onKill(cid, target)
local monster = config[getCreatureName(target):lower()]
if isPlayer(target) or not monster or isSummon(target) then
return true
end

if (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount and getPlayerStorageValue(cid, monster.startstorage) >= monster.startvalue then
setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Task message: '..(getPlayerStorageValue(cid, monster.storage)+1)..' of '..monster.amount..' '..getCreatureName(target)..'s killed.')
end
if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and completed the '..getCreatureName(target)..'s mission.')
setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
end
return true
end
@StreamSide
 
OP
Limos

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,017
Reaction score
2,952
Location
Netherlands
Change 4 in the missions table in the NPC to 2, the dragon lord startvalue should be 2 then.
And you probable have to change the isSummon function to this (for 0.4 versions where getCreatureMaster returns nil).
Code:
function isSummon(cid)
      return getCreatureMaster(cid) ~= nil
end
 

Activity

Member
Joined
Apr 7, 2016
Messages
182
Reaction score
21
Change 4 in the missions table in the NPC to 2, the dragon lord startvalue should be 2 then.
And you probable have to change the isSummon function to this (for 0.4 versions where getCreatureMaster returns nil).
Code:
function isSummon(cid)
      return getCreatureMaster(cid) ~= nil
end
Change it at creatureevents or in 050-functions?
 

Activity

Member
Joined
Apr 7, 2016
Messages
182
Reaction score
21
@Limos Its working perfectly but its only once mission per character, i tried to change the time to another day but still same msg that i've done the quests, is it possible to do it everyday? Exhaustion time.
 

Activity

Member
Joined
Apr 7, 2016
Messages
182
Reaction score
21
You can do it like this, it's a different NPC script and different server version, but the idea is the same, reset all the storages after 24 hours.
https://otland.net/threads/tfs-1-2-daily-reset-task-npc-is-not-resetting-storage.241428/#post-2339668
Actually, i already read it and i couldn't understand anything :D cuz it is another tfs so i can't understand anything.
EDIT: @Limos I tried with this exhaustion time, it is working good if i do missions with char didn't done missions before its working good, until now there isn't problem in next day i msg the npc with the same player and i find it working good with the exhaustion but i can take the reward without killing the monsters like Hi, mission, yes, REWARD without killing any monster.
http://pastebin.com/RaCDnxt3
thanks in advance :).
 
Last edited:

Activity

Member
Joined
Apr 7, 2016
Messages
182
Reaction score
21
Bump ^ may someone check out, what is the problem ,please?
 
Top