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

Tasks help

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,812
Solutions
6
Reaction score
822
my tasks.lua as a talkaction
Code:
function onSay(cid, words, param) 
 
    function pairsByKeys (t, f) 
      local a = {} 
      for n in pairs(t) do table.insert(a, n) end 
      table.sort(a, f) 
      local i = 0 
      local iter = function () 
        i = i + 1 
        if a[i] == nil then return nil 
        else return a[i], t[a[i]] 
        end 
      end 
      return iter 
    end 
 
local m = { 
["troll"] = {storage = 91001,count = 100}, 
["frost giant"] = {storage = 91002,count = 100},  
["zombie"] = {storage = 91003,count = 150}, 
["paradise hacker"] = {storage = 91004,count = 85}, 
["acolyte of the cult"] = {storage = 91005,count = 85}, 
["penguin"] = {storage = 91006,count = 150}, 
["evil eye"] = {storage = 91007,count = 5}, 
["exodius"] = {storage = 91008,count = 7}, 
["amirs bodyguard"] = {storage = 91009,count = 3}, 
["amirs bodyguard"] = {storage = 91010,count = 5}, 
["paradise master"] = {storage = 91011,count = 2}, 
["paradise master"] = {storage = 91012,count = 5}, 
["amirs bodyguard"] = {storage = 91013,count = 10}, 
["paradise master"] = {storage = 91014,count = 10}, 
["penguin"] = {storage = 91015,count = 250}, 
["zombie"] = {storage = 91016,count = 250}, 
["deadly demon"] = {storage = 91017,count = 35}, 
["deadly demon"] = {storage = 91018,count = 60}, 
["rotworm"] = {storage = 91019,count = 100}, 
["chicken"] = {storage = 91020,count = 6}, 
["bat"] = {storage = 91021,count = 1}, 
["training monk"] = {storage = 91022,count = 2}, 
["paradise master"] = {storage = 91023,count = 25} 
} 
 
local str = "" 
str = str .. "Task Completed :\n\n" 
for k, v in pairsByKeys(m) do 
local contagem = getPlayerStorageValue(cid, v.storage) 
if(contagem == -1) then  
contagem = 1  
end  
str = str..k.." = ["..((contagem)-1).."/"..v.count.."]\n" 
end 
str = str .. ""  
return doShowTextDialog(cid, 8983, str)  
end
when u say !task
u cant see 2 paradise master or 2 amirs bodyguard

when i do !task
Code:
ask Completed :

acolyte of the cult = [0/85]
amirs bodyguard = [0/10]
bat = [0/1]
chicken = [0/6]
deadly demon = [0/60]
evil eye = [0/5]
exodius = [0/7]
frost giant = [0/100]
paradise hacker = [0/85]
paradise master = [0/25]
penguin = [0/250]
rotworm = [0/100]
training monk = [0/2]
troll = [0/100]
zombie = [0/250]
there should be like 4 paradise master with diff. [0/X]

can someone fix it?
im using 0.3.6pl1 rep++

and here the npc
.lua file
Code:
local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 
 
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end 
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end 
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end 
function onThink() npcHandler:onThink() end 
 
function MonsterCount(cid, message, keywords, parameters, node) 
        if(not npcHandler:isFocused(cid)) then 
                return false 
        end 
local contagem = getPlayerStorageValue(cid, parameters.storage) 
if(contagem == -1) then  
contagem = 1  
end  
      if getPlayerStorageValue(cid, parameters.x) <= 0 then 
           if (((contagem)-1) >= parameters.count) then 
                                       doPlayerAddExp(cid, parameters.exp) 
                               for k,v in pairs(parameters.reward) do  
                    doPlayerAddItem(cid, v.item, v.count or 1)  
                end 
              setPlayerStorageValue(cid, parameters.x, 1) 
            npcHandler:say('Thank you, This is your reward!', cid)   
        else 
                npcHandler:say('Sorry,but you still only killed '..((contagem)-1)..' monsters!', cid) 
                npcHandler:resetNpc() 
        end 
        else 
        npcHandler:say('You can only receive the reward once!', cid) 
        npcHandler:resetNpc() 
        end 
        return TRUE 
end 
function Completed(cid, message, keywords, parameters, node) 
        if(not npcHandler:isFocused(cid)) then 
                return false 
        end  
      if getPlayerStorageValue(cid, parameters.x) <= 0 then 
      for i = 21001,21039 do 
           if getPlayerStorageValue(cid,i) <= 0 then 
           return npcHandler:say('Sorry,but you didnt complete all the tasks yet!', cid) 
           end 
           end                     doPlayerAddExp(cid, parameters.exp) 
                               for k,v in pairs(parameters.reward) do  
                    doPlayerAddItem(cid, v.item, v.count or 1)  
                end 
              setPlayerStorageValue(cid, parameters.x, 1) 
                 b = getGlobalStorageValue(63004) 
                  if b == -1 then 
                    b = 1 
                       end 
                         if b < 11 then 
                            setGlobalStorageValue(63004,b+1) 
                            npcHandler:say('you recivied some Premium Tokens', cid) 
                              doBroadcastMessage('[Task Mission Complete] '..getCreatureName(cid)..' was the '..b..'° to finish the task!.') 
                                 doPlayerAddItem(cid, 9020,25)  
                     doItemSetAttribute(doPlayerAddItem(cid, 7369), "name", "A warrior who completed all the tasks") 
                 end 
            npcHandler:say('Congbatz, You completed the 10 Tasks!', cid) 
            npcHandler:resetNpc()  
        else 
        npcHandler:say('You can only receive the reward once!', cid) 
        npcHandler:resetNpc() 
        end 
        return TRUE 
end 
 
 
keywordHandler:addKeyword({'task'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I need you to complete those missions {first part},{second part} and {third part}, you can see {all missions} or if you need {help} to know the amount of monsters you/ve killed!'}) 
keywordHandler:addKeyword({'all missions'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Wow! You/re a great hunter!,you really {completed} all the missions?'}) 
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To see how many monsters you/ve killed just use the command {!task}'}) 
keywordHandler:addKeyword({'first part'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'first part: {troll},{frost giant},{zombie},{paradise hacker},{acolyte of the cult},{acolyte of the cult},{penguin},{evil eye},{exodius},{amirs bodyguard} and {amirs bodyguard}!'}) 
keywordHandler:addKeyword({'second part'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'second part: {paradise master},{paradise master},{amirs bodyguard},{paradise master},{penguin}'}) 
keywordHandler:addKeyword({'third part'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'third part: {deadly demon},{deadly demon},{rotworm},{chicken},{bat},{training monk},{paradise master} and {green djinn}'}) 
local node1 = keywordHandler:addKeyword({'troll'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 100 trolls? {yes}'}) 
node1:addChildKeyword({'yes'}, MonsterCount, {x = 21001,storage = 91001,count = 100,reward = {{item = 9020, count = 5}},exp = 1000}) 
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node2 = keywordHandler:addKeyword({'frost giant'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 100 frost giants? {yes}'}) 
node2:addChildKeyword({'yes'}, MonsterCount, {x = 21002, storage = 91002,count = 100,reward = {{item = 9020, count = 5}},exp = 2000}) 
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node3 = keywordHandler:addKeyword({'zombie'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 150 zombies? {yes}'}) 
node3:addChildKeyword({'yes'}, MonsterCount, {x = 21003, storage = 91003,count = 150,reward = {{item = 9020, count = 5}},exp = 4000}) 
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node4 = keywordHandler:addKeyword({'paradise hacker'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 85 paradise hackers? {yes}'}) 
node4:addChildKeyword({'yes'}, MonsterCount, {x = 21004, storage = 91004,count = 85,reward = {{item = 9020, count = 5}},exp = 6000}) 
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node5 = keywordHandler:addKeyword({'acolyte of the cult'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 85 acolyte of the cults? {yes}'}) 
node5:addChildKeyword({'yes'}, MonsterCount, {x = 21005, storage = 91005,count = 85,reward = {{item = 9020, count = 5}},exp = 10000}) 
node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node6 = keywordHandler:addKeyword({'penguin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 150 penguins? {yes}'}) 
node6:addChildKeyword({'yes'}, MonsterCount, {x = 21006, storage = 91006,count = 150,reward = {{item = 9020, count = 5}},exp = 15000}) 
node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node7 = keywordHandler:addKeyword({'evil eye'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 5 evil eye? {yes}'}) 
node7:addChildKeyword({'yes'}, MonsterCount, {x = 21007, storage = 91007,count = 5,reward = {{item = 9020, count = 6}},exp = 20000}) 
node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node8 = keywordHandler:addKeyword({'exodius'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 7 exodius? {yes}'}) 
node8:addChildKeyword({'yes'}, MonsterCount, {x = 21008, storage = 91008,count = 7,reward = {{item = 9020, count = 6}},exp = 25000}) 
node8:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node9 = keywordHandler:addKeyword({'amirs bodyguard'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 3 of amirs bodyguard? {yes}'}) 
node9:addChildKeyword({'yes'}, MonsterCount, {x = 21009, storage = 91009,count = 3,reward = {{item = 9020, count = 7}},exp = 30000}) 
node9:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node10 = keywordHandler:addKeyword({'amirs bodyguard'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 5 of amirs bodyguard? {yes}'}) 
node10:addChildKeyword({'yes'}, MonsterCount, {x = 21010, storage = 91010,count = 5,reward = {{item = 9020, count = 7}},exp = 35000}) 
node10:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node11 = keywordHandler:addKeyword({'paradise master'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 2 of paradise master? {yes}'}) 
node11:addChildKeyword({'yes'}, MonsterCount, {x = 21011,storage = 91011,count = 2,reward = {{item = 9020, count = 8}},exp = 40000}) 
node11:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node12 = keywordHandler:addKeyword({'paradise master'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 5 of paradise master {yes}'}) 
node12:addChildKeyword({'yes'}, MonsterCount, {x = 21022, storage = 91012,count = 5,reward = {{item = 9020, count = 8}},exp = 50000}) 
node12:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node13 = keywordHandler:addKeyword({'amirs bodyguard'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 10 of amirs bodyguard? {yes}'}) 
node13:addChildKeyword({'yes'}, MonsterCount, {x = 21013, storage = 91013,count = 10,reward = {{item = 9020, count = 10}},exp = 60000}) 
node13:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node14 = keywordHandler:addKeyword({'paradise master'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 10 of paradise master? {yes}'}) 
node14:addChildKeyword({'yes'}, MonsterCount, {x = 21014, storage = 91014,count = 10,reward = {{item = 9020, count = 10}},exp = 65000}) 
node14:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node15 = keywordHandler:addKeyword({'penguin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Did you kill all the 250 penguins? {yes}'}) 
node15:addChildKeyword({'yes'}, MonsterCount, {x = 21015, storage = 91015,count = 250,reward = {{item = 9020, count = 12}},exp = 151321}) 
node15:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node16 = keywordHandler:addKeyword({'zombies'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Did you kill all the 250 zombies? {yes}'}) 
node16:addChildKeyword({'yes'}, MonsterCount, {x = 21016, storage = 91016,count = 250,reward = {{item = 9020, count = 12}},exp = 150000}) 
node16:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node17 = keywordHandler:addKeyword({'deadly demon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Did you find the 35 deadly demon and killed them? {yes}'}) 
node17:addChildKeyword({'yes'}, MonsterCount, {x = 21017, storage = 91017,count = 35,reward = {{item = 9020, count = 15}},exp = 200000}) 
node17:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node18 = keywordHandler:addKeyword({'deadly demon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Good, You/ve learned, you killed 60 deadly demons? {yes}'}) 
node18:addChildKeyword({'yes'}, MonsterCount, {x = 21018, storage = 91018,count = 60,reward = {{item = 9020, count = 20}},exp = 300000}) 
node18:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node19 = keywordHandler:addKeyword({'rotworm'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You thought it was easy to kill 100 rotworms? {yes}'}) 
node19:addChildKeyword({'yes'}, MonsterCount, {x = 21019, storage = 91019,count = 72,reward = {{item = 9020, count = 10}},exp = 500000}) 
node19:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node20 = keywordHandler:addKeyword({'chicken'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You found 6 chickens to kill? {yes}'}) 
node20:addChildKeyword({'yes'}, MonsterCount, {x = 21020, storage = 91020,count = 6,reward = {{item = 9020, count = 10}},exp = 500000}) 
node20:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node21 = keywordHandler:addKeyword({'bat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You killed my only 1 bat? {yes}'}) 
node21:addChildKeyword({'yes'}, MonsterCount, {x = 21021, storage = 91021,count = 1,reward = {{item = 9020, count = 6}},exp = 150000}) 
node21:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node22 = keywordHandler:addKeyword({'training monk'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 2 training monks? {yes}'}) 
node22:addChildKeyword({'yes'}, MonsterCount, {x = 21022, storage = 91022,count = 2,reward = {{item = 9020, count = 10}},exp = 0}) 
node22:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node23 = keywordHandler:addKeyword({'paradise master'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You already killed 25 paradise master? {yes}'}) 
node23:addChildKeyword({'yes'}, MonsterCount, {x = 21023, storage = 91023,count = 25,reward = {{item = 9020, count = 15}},exp = 198574}) 
node23:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
local node24 = keywordHandler:addKeyword({'completed'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I have to give you some more TOKENS! You already killed all the monster? {yes}'}) 
node24:addChildKeyword({'yes'}, Completed, {x = 21040,reward = {{item = 9020, count = 50}},exp = 54042300}) 
node24:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) 
 
npcHandler:addModule(FocusModule:new())

and the creaturescript
i want it to be like this
u say hi, etc.. and u say first part
then he give u mission after mission, not u chose the mission u want, after u done the first, u talk again etc. and u say first part again, and he give u the sec mission etc.. same with part 2 and 3, when u done all missions in all parts u say u done all and u get the prize


and the creaturescript if u need
Code:
function onKill(cid, target)  
 
local m = { 
["troll"] = 91001, 
["frost giant"] = 91002,  
["zombie"] = 91003, 
["paradise hacker"] = 91004, 
["acolyte of the cult"] = 91005, 
["penguin"] = 91006, 
["evil eye"] = 91007, 
["exodius"] = 91008, 
["amirs bodyguard"] = 91009, 
["amirs bodyguard"] = 91010, 
["paradise master"] = 91011, 
["paradise master"] = 91012, 
["amirs bodyguard"] = 91013, 
["paradise master"] = 91014, 
["penguin"] = 91015, 
["zombie"] = 91016, 
["deadly demon"] = 91017, 
["deadly demon"] = 91018, 
["rotworm"] = 91019, 
["chicken"] = 91020, 
["bat"] = 91021, 
["training monk"] = 91022, 
["amirs bodyguard"] = 91023,
["paradise master"] = 91024
}  
   
if(isMonster(target) == TRUE) then  
local n = getCreatureName(target)  
local name_monster = m[string.lower(n)]  
if(name_monster) then  
local contagem = getPlayerStorageValue(cid, name_monster)  
if(contagem == -1) then  
contagem = 1  
end  
setPlayerStorageValue(cid, name_monster, contagem+1)   
end  
end  
return TRUE  
end
 
Last edited:
Back
Top