I tried to set up a Task NPC and it just didn't work.
I think the problem is somewhere in counting the rotworms.
I talked to the NPC and asked for mission and said yes a couple times, that all worked.
But, the script is not counting how many rotworms I killed, so after I killed 50 and went back to NPC, it's telling me that I need to kill more.
So, my best guess is that the counting creaturescript is not working.
firstq.lua
If you need the thread of this script, it's here: http://otland.net/f82/1-task-npc-rare-129453/
I think the problem is somewhere in counting the rotworms.
I talked to the NPC and asked for mission and said yes a couple times, that all worked.
But, the script is not counting how many rotworms I killed, so after I killed 50 and went back to NPC, it's telling me that I need to kill more.
So, my best guess is that the counting creaturescript is not working.
firstq.lua
LUA:
local monsters = {
--name = storage
["rotworm"] = 55667,
["carrion worm"] = 55667,
["rotworm queen"] = 55667
}
taskmonsterstrv = 55667 -- Monster Storagevalue
taskmonsters = "rotworms" --- Monsters name (many)
Npc = "Richard" --- The npc name, to return to
queststrv = 808605 --- Quest storagevalue
kill = 50 --- How many you need to kill
killi = "50" --- Becouse the npc can't say 50, it needs to say "50".
function onKill(cid, target)
local monster = monsters[getCreatureName(target):lower()]
if(isPlayer(target) == FALSE and monster and getPlayerStorageValue(cid, queststrv) == 2) then
if getPlayerStorageValue(cid, monster) < kill then
local killedMonsters = getPlayerStorageValue(cid, monster)
if(killedMonsters == -1) then
killedMonsters = 1
end
setPlayerStorageValue(cid, monster, killedMonsters + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed ".. getPlayerStorageValue(cid, taskmonsterstrv) .." of ".. killi .." ".. taskmonsters ..". [".. getPlayerStorageValue(cid, taskmonsterstrv) .."/".. killi .."]")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed enough ".. taskmonsters ..". Return back to ".. Npc .." for more info.")
setPlayerStorageValue(cid, queststrv, 3)
end
end
return TRUE
end
If you need the thread of this script, it's here: http://otland.net/f82/1-task-npc-rare-129453/