CreatureEvent Epic daily missions [tasks] mod

Discussion in 'GlobalEvents, Spells & CreatureEvents' started by Erexo, Mar 28, 2013.

  1. Erexo

    Erexo Kage

    Joined:
    Mar 27, 2010
    Messages:
    567
    Likes Received:
    34
    Best Answers:
    0
    Hello,
    i would like to present my new script, `Daily Missions`, written for 0.3.6pl1.

    HOW IT WORKS:
    Each day player can ask NPC for a mission, then he will get task for random monster (based on player lv), when he complete the task (kill enough monsters), then he can back to that NPC and finish it, recive expedience and x% chance for an item.

    NPC SCRIPT:
    Code (Lua):
    1. local daily1 = { --1-30
    2. {["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
    3. {["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75}
    4. }
    5. local daily2 = { --31-70
    6. {["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 67},
    7. {["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 68}
    8. }
    9. local daily3 = { --71-100
    10. {["name"] = "Stranger", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 75},
    11. {["name"] = "Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 73}
    12. }
    13. local daily4 = { --101-150
    14. {["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 85},
    15. {["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 65}
    16. }
    17. local daily5 = { --151-200
    18. {["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 73},
    19. {["name"] = "Nukenin", ["storage"] = 27, ["count"] = 50, ["exp"] = 1500000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 77}
    20. }
    21. local daily6 = { --201-250
    22. {["name"] = "Nukenin", ["storage"] = 30, ["count"] = 70, ["exp"] = 2000000, ["item"] = 2160, ["icount"] = 6, ["chance"] = 71},
    23. {["name"] = "Akatsuki Memember", ["storage"] = 31, ["count"] = 40, ["exp"] = 3000000, ["item"] = 2160, ["icount"] = 6, ["chance"] = 73}
    24. }
    25. local daily7 = { --251-300
    26. {["name"] = "Akatsuki Memember", ["storage"] = 34, ["count"] = 70, ["exp"] = 6000000, ["item"] = 2160, ["icount"] = 10, ["chance"] = 65},
    27. {["name"] = "Samurai Master", ["storage"] = 35, ["count"] = 60, ["exp"] = 4000000, ["item"] = 2160, ["icount"] = 12, ["chance"] = 66}
    28. }
    29. local daily8 = { --301-350
    30. {["name"] = "Rikudou Patch", ["storage"] = 38, ["count"] = 70, ["exp"] = 8000000, ["item"] = 2160, ["icount"] = 14, ["chance"] = 73},
    31. {["name"] = "Black Samurai [King]", ["storage"] = 39, ["count"] = 30, ["exp"] = 7000000, ["item"] = 2160, ["icount"] = 15, ["chance"] = 77}
    32. }
    33. local daily11 = { --351-400
    34. {["name"] = "Rikudou Patch", ["storage"] = 61, ["count"] = 70, ["exp"] = 8000000, ["item"] = 2160, ["icount"] = 14, ["chance"] = 73},
    35. {["name"] = "Black Samurai [King]", ["storage"] = 62, ["count"] = 50, ["exp"] = 8500000, ["item"] = 2160, ["icount"] = 16, ["chance"] = 70}
    36. }
    37. local daily9 = { --401-500
    38. {["name"] = "Black Samurai [King]", ["storage"] = 41, ["count"] = 50, ["exp"] = 9000000, ["item"] = 2160, ["icount"] = 16, ["chance"] = 71},
    39. {["name"] = "Black Samurai [King]", ["storage"] = 42, ["count"] = 70, ["exp"] = 11000000, ["item"] = 2160, ["icount"] = 18, ["chance"] = 73}
    40. }
    41. local daily10 = { --500+
    42. {["name"] = "Heaven Guardian", ["storage"] = 46, ["count"] = 50, ["exp"] = 13000000, ["item"] = 2160, ["icount"] = 25, ["chance"] = 90},
    43. {["name"] = "Heaven Guardian", ["storage"] = 47, ["count"] = 70, ["exp"] = 15000000, ["item"] = 2160, ["icount"] = 27, ["chance"] = 76},
    44. {["name"] = "Bug", ["storage"] = 52, ["count"] = 100, ["exp"] = 10000000, ["item"] = 1691, ["icount"] = 1, ["chance"] = 100}
    45. }
    46.  
    47. local keywordHandler = KeywordHandler:new()
    48. local npcHandler = NpcHandler:new(keywordHandler)
    49. NpcSystem.parseParameters(npcHandler)
    50. local talkState = {}
    51. function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid)            end
    52. function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid)         end
    53. function onCreatureSay(cid, type, msg)          npcHandler:onCreatureSay(cid, type, msg)        end
    54. function onThink()                  npcHandler:onThink()                    end
    55.  
    56. function creatureSayCallback(cid, type, msg)
    57.     if(not npcHandler:isFocused(cid)) then
    58.         return false
    59.     end
    60.     local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    61.  
    62. --Branie Daily
    63.     if(msgcontains(msg, 'mission') or msgcontains(msg, 'daily')) then
    64.     if getPlayerStorageValue(cid,2423) <= 1 then
    65.         if getPlayerLevel(cid) <= 30 then
    66.             rand = math.random(1, #daily1)
    67.             for i = 1, #daily1 do
    68.                 if rand == i then
    69.                     selfSay('Your mission today is to kill ' .. daily1[i].count .. ' ' .. daily1[i].name .. '\'s. Back when you end.', cid)
    70.                     setPlayerStorageValue(cid,2423,daily1[i].storage)
    71.                     talkState[talkUser] = 0
    72.                    
    73.                 end
    74.             end
    75.         elseif getPlayerLevel(cid) > 30 and getPlayerLevel(cid) <= 70 then
    76.             rand = math.random(1, #daily2)
    77.             for i = 1, #daily2 do
    78.                 if rand == i then
    79.                     selfSay('Your mission today is to kill ' .. daily2[i].count .. ' ' .. daily2[i].name .. '\'s. Back when you end.', cid)
    80.                     setPlayerStorageValue(cid,2423,daily2[i].storage)
    81.                     talkState[talkUser] = 0
    82.                    
    83.                 end
    84.             end
    85.         elseif getPlayerLevel(cid) > 70 and getPlayerLevel(cid) <= 100 then
    86.             rand = math.random(1, #daily3)
    87.             for i = 1, #daily3 do
    88.                 if rand == i then
    89.                     selfSay('Your mission today is to kill ' .. daily3[i].count .. ' ' .. daily3[i].name .. '\'s. Back when you end.', cid)
    90.                     setPlayerStorageValue(cid,2423,daily3[i].storage)
    91.                     talkState[talkUser] = 0
    92.                    
    93.                 end
    94.             end
    95.         elseif getPlayerLevel(cid) > 100 and getPlayerLevel(cid) <= 150 then
    96.             rand = math.random(1, #daily4)
    97.             for i = 1, #daily4 do
    98.                 if rand == i then
    99.                     selfSay('Your mission today is to kill ' .. daily4[i].count .. ' ' .. daily4[i].name .. '\'s. Back when you end.', cid)
    100.                     setPlayerStorageValue(cid,2423,daily4[i].storage)
    101.                     talkState[talkUser] = 0
    102.                    
    103.                 end
    104.             end
    105.         elseif getPlayerLevel(cid) > 150 and getPlayerLevel(cid) <= 200 then
    106.             rand = math.random(1, #daily5)
    107.             for i = 1, #daily5 do
    108.                 if rand == i then
    109.                     selfSay('Your mission today is to kill ' .. daily5[i].count .. ' ' .. daily5[i].name .. '\'s. Back when you end.', cid)
    110.                     setPlayerStorageValue(cid,2423,daily5[i].storage)
    111.                     talkState[talkUser] = 0
    112.                    
    113.                 end
    114.             end
    115.         elseif getPlayerLevel(cid) > 200 and getPlayerLevel(cid) <= 250 then
    116.             rand = math.random(1, #daily6)
    117.             for i = 1, #daily6 do
    118.                 if rand == i then
    119.                     selfSay('Your mission today is to kill ' .. daily6[i].count .. ' ' .. daily6[i].name .. '\'s. Back when you end.', cid)
    120.                     setPlayerStorageValue(cid,2423,daily6[i].storage)
    121.                     talkState[talkUser] = 0
    122.                    
    123.                 end
    124.             end
    125.         elseif getPlayerLevel(cid) > 250 and getPlayerLevel(cid) <= 300 then
    126.             rand = math.random(1, #daily7)
    127.             for i = 1, #daily7 do
    128.                 if rand == i then
    129.                     selfSay('Your mission today is to kill ' .. daily7[i].count .. ' ' .. daily7[i].name .. '\'s. Back when you end.', cid)
    130.                     setPlayerStorageValue(cid,2423,daily7[i].storage)
    131.                     talkState[talkUser] = 0
    132.                    
    133.                 end
    134.             end
    135.         elseif getPlayerLevel(cid) > 300 and getPlayerLevel(cid) <= 350 then
    136.             rand = math.random(1, #daily8)
    137.             for i = 1, #daily8 do
    138.                 if rand == i then
    139.                     selfSay('Your mission today is to kill ' .. daily8[i].count .. ' ' .. daily8[i].name .. '\'s. Back when you end.', cid)
    140.                     setPlayerStorageValue(cid,2423,daily8[i].storage)
    141.                     talkState[talkUser] = 0
    142.                    
    143.                 end
    144.             end
    145.         elseif getPlayerLevel(cid) > 350 and getPlayerLevel(cid) <= 400 then
    146.             rand = math.random(1, #daily11)
    147.             for i = 1, #daily11 do
    148.                 if rand == i then
    149.                     selfSay('Your mission today is to kill ' .. daily11[i].count .. ' ' .. daily11[i].name .. '\'s. Back when you end.', cid)
    150.                     setPlayerStorageValue(cid,2423,daily11[i].storage)
    151.                     talkState[talkUser] = 0
    152.                    
    153.                 end
    154.             end
    155.         elseif getPlayerLevel(cid) > 400 and getPlayerLevel(cid) <= 500 then
    156.             rand = math.random(1, #daily9)
    157.             for i = 1, #daily9 do
    158.                 if rand == i then
    159.                     selfSay('Your mission today is to kill ' .. daily9[i].count .. ' ' .. daily9[i].name .. '\'s. Back when you end.', cid)
    160.                     setPlayerStorageValue(cid,2423,daily9[i].storage)
    161.                     talkState[talkUser] = 0
    162.                    
    163.                 end
    164.             end
    165.         elseif getPlayerLevel(cid) > 500 then
    166.             rand = math.random(1, #daily10)
    167.             for i = 1, #daily10 do
    168.                 if rand == i then
    169.                     selfSay('Your mission today is to kill ' .. daily10[i].count .. 'x ' .. daily10[i].name .. '\'s. Back when you end.', cid)
    170.                     setPlayerStorageValue(cid,2423,daily10[i].storage)
    171.                     talkState[talkUser] = 0
    172.                    
    173.                 end
    174.             end
    175.         end
    176.  
    177.     end
    178.     if getPlayerStorageValue(cid,2423) == 100 then
    179.             selfSay('You have complete today mission! Back tomorrow!', cid)
    180.             talkState[talkUser] = 0
    181.     end
    182.    
    183.    
    184.    
    185.    
    186.     --Oddanie Daily Questa
    187.  
    188.         for i = 1, #daily1 do
    189.             if getPlayerStorageValue(cid,2423) == daily1[i].storage then
    190.                 if getPlayerStorageValue(cid,2425) >= daily1[i].count then
    191.                 selfSay('Exelent! You done today mission.', cid)
    192.                 doPlayerAddExp(cid,daily1[i].exp)
    193.                 setPlayerStorageValue(cid,2423,100)
    194.                 if math.random(1,100) <= daily1[i].chance then
    195.                     doPlayerAddItem(cid,daily1[i].item,daily1[i].icount)
    196.                 end
    197.                 talkState[talkUser] = 0
    198.                 else
    199.                 selfSay('You have dont killed enought ' .. daily1[i].name .. '\'s.', cid)
    200.                 talkState[talkUser] = 0
    201.                 end
    202.             end
    203.         end
    204.         for i = 1, #daily2 do
    205.             if getPlayerStorageValue(cid,2423) == daily2[i].storage then
    206.                 if getPlayerStorageValue(cid,2425) >= daily2[i].count then
    207.                 selfSay('Exelent! You done today mission.', cid)
    208.                 doPlayerAddExp(cid,daily2[i].exp)
    209.                 setPlayerStorageValue(cid,2423,100)
    210.                 if math.random(1,100) <= daily2[i].chance then
    211.                     doPlayerAddItem(cid,daily2[i].item,daily2[i].icount)
    212.                 end
    213.                 talkState[talkUser] = 0
    214.                 else
    215.                 selfSay('You have dont killed enought ' .. daily2[i].name .. '\'s.', cid)
    216.                 talkState[talkUser] = 0
    217.                 end
    218.             end
    219.         end
    220.         for i = 1, #daily3 do
    221.             if getPlayerStorageValue(cid,2423) == daily3[i].storage then
    222.                 if getPlayerStorageValue(cid,2425) >= daily3[i].count then
    223.                 selfSay('Exelent! You done today mission.', cid)
    224.                 doPlayerAddExp(cid,daily3[i].exp)
    225.                 setPlayerStorageValue(cid,2423,100)
    226.                 if math.random(1,100) <= daily3[i].chance then
    227.                     doPlayerAddItem(cid,daily3[i].item,daily3[i].icount)
    228.                 end
    229.                 talkState[talkUser] = 0
    230.                 else
    231.                 selfSay('You have dont killed enought ' .. daily3[i].name .. '\'s.', cid)
    232.                 talkState[talkUser] = 0
    233.                 end
    234.             end
    235.         end
    236.         for i = 1, #daily4 do
    237.             if getPlayerStorageValue(cid,2423) == daily4[i].storage then
    238.                 if getPlayerStorageValue(cid,2425) >= daily4[i].count then
    239.                 selfSay('Exelent! You done today mission.', cid)
    240.                 doPlayerAddExp(cid,daily4[i].exp)
    241.                 setPlayerStorageValue(cid,2423,100)
    242.                 if math.random(1,100) <= daily4[i].chance then
    243.                     doPlayerAddItem(cid,daily4[i].item,daily4[i].icount)
    244.                 end
    245.                 talkState[talkUser] = 0
    246.                 else
    247.                 selfSay('You have dont killed enought ' .. daily4[i].name .. '\'s.', cid)
    248.                 talkState[talkUser] = 0
    249.                 end
    250.             end
    251.         end
    252.         for i = 1, #daily5 do
    253.             if getPlayerStorageValue(cid,2423) == daily5[i].storage then
    254.                 if getPlayerStorageValue(cid,2425) >= daily5[i].count then
    255.                 selfSay('Exelent! You done today mission.', cid)
    256.                 doPlayerAddExp(cid,daily5[i].exp)
    257.                 setPlayerStorageValue(cid,2423,100)
    258.                 if math.random(1,100) <= daily5[i].chance then
    259.                     doPlayerAddItem(cid,daily5[i].item,daily5[i].icount)
    260.                 end
    261.                 talkState[talkUser] = 0
    262.                 else
    263.                 selfSay('You have dont killed enought ' .. daily5[i].name .. '\'s.', cid)
    264.                 talkState[talkUser] = 0
    265.                 end
    266.             end
    267.         end
    268.         for i = 1, #daily6 do
    269.             if getPlayerStorageValue(cid,2423) == daily6[i].storage then
    270.                 if getPlayerStorageValue(cid,2425) >= daily6[i].count then 
    271.                 selfSay('Exelent! You done today mission.', cid)
    272.                 doPlayerAddExp(cid,daily6[i].exp)
    273.                 setPlayerStorageValue(cid,2423,100)
    274.                 if math.random(1,100) <= daily6[i].chance then
    275.                     doPlayerAddItem(cid,daily6[i].item,daily6[i].icount)
    276.                 end
    277.                 talkState[talkUser] = 0
    278.                 else
    279.                 selfSay('You have dont killed enought ' .. daily6[i].name .. '\'s.', cid)
    280.                 talkState[talkUser] = 0
    281.                 end
    282.             end
    283.         end
    284.         for i = 1, #daily7 do
    285.             if getPlayerStorageValue(cid,2423) == daily7[i].storage then
    286.                 if getPlayerStorageValue(cid,2425) >= daily7[i].count then
    287.                 selfSay('Exelent! You done today mission.', cid)
    288.                 doPlayerAddExp(cid,daily7[i].exp)
    289.                 setPlayerStorageValue(cid,2423,100)
    290.                 if math.random(1,100) <= daily7[i].chance then
    291.                     doPlayerAddItem(cid,daily7[i].item,daily7[i].icount)
    292.                 end
    293.                 talkState[talkUser] = 0
    294.                 else
    295.                 selfSay('You have dont killed enought ' .. daily7[i].name .. '\'s.', cid)
    296.                 talkState[talkUser] = 0
    297.                 end
    298.             end
    299.         end
    300.         for i = 1, #daily8 do
    301.             if getPlayerStorageValue(cid,2423) == daily8[i].storage then
    302.                 if getPlayerStorageValue(cid,2425) >= daily8[i].count then
    303.                 selfSay('Exelent! You done today mission.', cid)
    304.                 doPlayerAddExp(cid,daily8[i].exp)
    305.                 setPlayerStorageValue(cid,2423,100)
    306.                 if math.random(1,100) <= daily8[i].chance then
    307.                     doPlayerAddItem(cid,daily8[i].item,daily8[i].icount)
    308.                 end
    309.                 talkState[talkUser] = 0
    310.                 else
    311.                 selfSay('You have dont killed enought ' .. daily8[i].name .. '\'s.', cid)
    312.                 talkState[talkUser] = 0
    313.                 end
    314.             end
    315.         end
    316.         for i = 1, #daily9 do
    317.             if getPlayerStorageValue(cid,2423) == daily9[i].storage then
    318.                 if getPlayerStorageValue(cid,2425) >= daily9[i].count then
    319.                 selfSay('Exelent! You done today mission.', cid)
    320.                 doPlayerAddExp(cid,daily9[i].exp)
    321.                 setPlayerStorageValue(cid,2423,100)
    322.                 if math.random(1,100) <= daily9[i].chance then
    323.                     doPlayerAddItem(cid,daily9[i].item,daily9[i].icount)
    324.                 end
    325.                 talkState[talkUser] = 0
    326.                 else
    327.                 selfSay('You have dont killed enought ' .. daily9[i].name .. '\'s.', cid)
    328.                 talkState[talkUser] = 0
    329.                 end
    330.             end
    331.         end
    332.         for i = 1, #daily10 do
    333.             if getPlayerStorageValue(cid,2423) == daily10[i].storage then
    334.                 if getPlayerStorageValue(cid,2425) >= daily10[i].count then
    335.                 selfSay('Exelent! You done today mission.', cid)
    336.                 doPlayerAddExp(cid,daily10[i].exp)
    337.                 setPlayerStorageValue(cid,2423,100)
    338.                 if math.random(1,100) <= daily10[i].chance then
    339.                     doPlayerAddItem(cid,daily10[i].item,daily10[i].icount)
    340.                 end
    341.                 talkState[talkUser] = 0
    342.                 else
    343.                 selfSay('You have dont killed enought ' .. daily10[i].name .. '\'s.', cid)
    344.                 talkState[talkUser] = 0
    345.                 end
    346.             end
    347.         end
    348.         for i = 1, #daily11 do
    349.             if getPlayerStorageValue(cid,2423) == daily11[i].storage then
    350.                 if getPlayerStorageValue(cid,2425) >= daily11[i].count then
    351.                 selfSay('Exelent! You done today mission.', cid)
    352.                 doPlayerAddExp(cid,daily11[i].exp)
    353.                 setPlayerStorageValue(cid,2423,100)
    354.                 if math.random(1,100) <= daily11[i].chance then
    355.                     doPlayerAddItem(cid,daily11[i].item,daily11[i].icount)
    356.                 end
    357.                 talkState[talkUser] = 0
    358.                 else
    359.                 selfSay('You have dont killed enought ' .. daily11[i].name .. '\'s.', cid)
    360.                 talkState[talkUser] = 0
    361.                 end
    362.             end
    363.         end
    364.     end
    365.  
    366.     return true
    367. end
    368.  
    369. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    370. npcHandler:addModule(FocusModule:new())
    (Example will be below)

    creaturescripts.xml
    Code (XML):
    1.  
    2.     <event type="kill" name="dailycounter" script="dailycounter.lua"/>
    3.  
    login.lua
    Code (Lua):
    1. registerCreatureEvent(cid, "dailycounter")
    dailycounter.lua
    Code (Lua):
    1. local config = {
    2. {["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
    3. {["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75},
    4. {["name"] = "Bandit", ["storage"] = 7, ["count"] = 30, ["exp"] = 25000, ["item"] = 2152, ["icount"] = 30, ["chance"] = 90},
    5. {["name"] = "Elite Bandit", ["storage"] = 7, ["count"] = 30, ["exp"] = 25000, ["item"] = 2152, ["icount"] = 30, ["chance"] = 90},
    6. {["name"] = "Fat Ninja", ["storage"] = 8, ["count"] = 30, ["exp"] = 26000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 90},
    7. {["name"] = "Onbaa", ["storage"] = 9, ["count"] = 30, ["exp"] = 30000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 90},
    8. {["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
    9. {["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
    10. {["name"] = "Cursed Skeleton", ["storage"] = 12, ["count"] = 30, ["exp"] = 130000, ["item"] = 2152, ["icount"] = 60, ["chance"] = 70},
    11. {["name"] = "Vampire", ["storage"] = 13, ["count"] = 30, ["exp"] = 170000, ["item"] = 2152, ["icount"] = 70, ["chance"] = 70},
    12. {["name"] = "Cyborg", ["storage"] = 14, ["count"] = 30, ["exp"] = 90000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
    13. {["name"] = "Elite Cyborg", ["storage"] = 14, ["count"] = 30, ["exp"] = 90000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
    14. {["name"] = "Young Kyokushin", ["storage"] = 15, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
    15. {["name"] = "Kyokushin", ["storage"] = 15, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
    16. {["name"] = "Monk", ["storage"] = 16, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
    17. {["name"] = "Elite Monk", ["storage"] = 16, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
    18. {["name"] = "Stranger", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    19. {["name"] = "Young Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    20. {["name"] = "Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    21. {["name"] = "Sound Shinobi", ["storage"] = 19, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    22. {["name"] = "Stranger", ["storage"] = 20, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    23. {["name"] = "Zombie", ["storage"] = 21, ["count"] = 30, ["exp"] = 370000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    24. {["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 70},
    25. {["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 70},
    26. {["name"] = "Ice Monster", ["storage"] = 24, ["count"] = 40, ["exp"] = 750000, ["item"] = 2160, ["icount"] = 3, ["chance"] = 70},
    27. {["name"] = "Elite Samurai", ["storage"] = 25, ["count"] = 40, ["exp"] = 1000000, ["item"] = 2160, ["icount"] = 4, ["chance"] = 75},
    28. {["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 70}
    29. }
    30. function onKill(cid, target, lastHit)
    31. if lastHit == true then
    32.     if(isPlayer(target) ~= TRUE) then
    33.  
    34.         local master = getCreatureMaster(target)
    35.         if(master and master ~= target) then return TRUE end
    36.  
    37.        
    38.         for i = 1, #config do
    39.             if getCreatureName(target):lower() == config[i].name:lower() then
    40.                 if getPlayerStorageValue(cid, 2423) == config[i].storage then
    41.                     setPlayerStorageValue(cid, 2425, getPlayerStorageValue(cid, 2425) + 1)
    42.                     if config[i].name == "Black Fowler" then
    43.                         if getPlayerStorageValue(cid, 2425) < config[i].count then
    44.                             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed Fowler [" .. getPlayerStorageValue(cid, 2425) .. " / " .. config[i].count.."]")
    45.                         elseif getPlayerStorageValue(cid, 2425) == config[i].count then
    46.                             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed last Fowler, go back to NPC and report.")
    47.                         end
    48.                     else
    49.                         if getPlayerStorageValue(cid, 2425) < config[i].count then
    50.                             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 2425) .. " / " .. config[i].count.."]")
    51.                         elseif getPlayerStorageValue(cid, 2425) == config[i].count then
    52.                             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed last " .. config[i].name .. ", go back to NPC and report.")
    53.                         end
    54.                     end
    55.                 end
    56.             end
    57.         end
    58.     end
    59.  
    60.     return TRUE
    61. end
    62. end
    talkaction for check current mission status:
    Code (Lua):
    1. local config = {
    2. {["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
    3. {["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75},
    4. {["name"] = "Bandit", ["storage"] = 7, ["count"] = 30, ["exp"] = 25000, ["item"] = 2152, ["icount"] = 30, ["chance"] = 92},
    5. {["name"] = "Fat Ninja", ["storage"] = 8, ["count"] = 30, ["exp"] = 26000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 89},
    6. {["name"] = "Onbaa", ["storage"] = 9, ["count"] = 30, ["exp"] = 30000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 91},
    7. {["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 67},
    8. {["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 68},
    9. {["name"] = "Cursed Skeleton", ["storage"] = 12, ["count"] = 30, ["exp"] = 130000, ["item"] = 2152, ["icount"] = 60, ["chance"] = 71},
    10. {["name"] = "Vampire", ["storage"] = 13, ["count"] = 30, ["exp"] = 170000, ["item"] = 2152, ["icount"] = 70, ["chance"] = 75},
    11. {["name"] = "Cyborg", ["storage"] = 14, ["count"] = 30, ["exp"] = 90000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 76},
    12. {["name"] = "Kyokushin", ["storage"] = 15, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 78},
    13. {["name"] = "Monk", ["storage"] = 16, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 79},
    14. {["name"] = "Stranger", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 75},
    15. {["name"] = "Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 73},
    16. {["name"] = "Sound Shinobi", ["storage"] = 19, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 71},
    17. {["name"] = "Stranger", ["storage"] = 20, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 77},
    18. {["name"] = "Zombie", ["storage"] = 21, ["count"] = 30, ["exp"] = 370000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 78},
    19. {["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 85},
    20. {["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 65},
    21. {["name"] = "Ice Monster", ["storage"] = 24, ["count"] = 40, ["exp"] = 750000, ["item"] = 2160, ["icount"] = 3, ["chance"] = 68},
    22. {["name"] = "Elite Samurai", ["storage"] = 25, ["count"] = 40, ["exp"] = 1000000, ["item"] = 2160, ["icount"] = 4, ["chance"] = 74},
    23. {["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 73}
    24.  
    25. }
    26.  
    27.  
    28. function onSay(cid, words, param)
    29.  
    30. local pos = getPlayerPosition(cid)
    31.  
    32. if getPlayerStorageValue(cid,2423) <= 1 then
    33.     doPlayerSendTextMessage(cid, 20,"You doesnt started any mission today.")
    34. end
    35.  
    36.  
    37.     for i = 1, #config do
    38.         if getPlayerStorageValue(cid,2423) == config[i].storage then
    39.                 if getPlayerStorageValue(cid,2425) < config[i].count then
    40.                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Mission]: You have killed [" .. getPlayerStorageValue(cid, 2425) .. " / " .. config[i].count.."] " .. config[i].name .. "\'s.")
    41.                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Reward: " .. config[i].exp .. " experience points and " .. config[i].chance .. "% chance to recive " .. config[i].icount .. "x " .. getItemNameById(config[i].item) .. "\'s.")
    42.                 else
    43.                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Mission]: You have killed enough " .. config[i].name .. "\'s, go back to NPC.")
    44.                 end
    45.         end
    46.     end
    47. if getPlayerStorageValue(cid,2423) == 100 then
    48.     doPlayerSendTextMessage(cid, 20,"You have done a mission today")
    49. end
    50.     return 1
    51. end
    globalevents.xml
    Code (XML):
    1. <globalevent name="daily" time="23:59" event="script" value="daily.lua"/>
    daliy.lua
    Code (Lua):
    1. function onTimer()
    2.     db.executeQuery('INSERT IGNORE INTO `player_storage` SELECT `id`, 2423, 1 FROM `players` WHERE `online` = 0 ON DUPLICATE KEY UPDATE `value` = 1')
    3.     db.executeQuery('INSERT IGNORE INTO `player_storage` SELECT `id`, 2425, 1 FROM `players` WHERE `online` = 0 ON DUPLICATE KEY UPDATE `value` = 0')
    4.     local a = getPlayersOnline()
    5.     for b = 1, #a do
    6.         doCreatureSetStorage(a[b], 2423, 1)
    7.         doCreatureSetStorage(a[b], 2425, 0)
    8.     end
    9.     return true
    10. end
    It will just simply reset everyone daily at 23:59. (If server didnt work on midnight, daily will not be restarted!)



    How to set config
    In each daily u have a numbers, EX: 1-30, that says players with level 1 to 30 can recive those monsters as a daily mission,
    then you have:
    Code (Lua):
    1. {["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
    Name = monster name
    storage = keeps your mission, for every daily must be diffrent (exactly its just a Value of storage (2423))
    count = number of monsters that you must defeat
    exp = how much experience player recive
    item = ID of item that player can recive
    icount = count of that item
    chance = a chance to recive item

    And just put same config to every script, and it will works.

    Hope someone enjoy my script, i work very hard on this one, ive made it to myself so sorry for mess.

    Greetz,
    Erexo.
     
    Last edited: Apr 1, 2013
    otavio101 and qaushinio like this.
  2. azzkaban

    azzkaban Monster Maker

    Joined:
    Feb 23, 2010
    Messages:
    1,089
    Likes Received:
    177
    Best Answers:
    0
    Thank you. Not have quest log?
     
  3. Erexo

    Erexo Kage

    Joined:
    Mar 27, 2010
    Messages:
    567
    Likes Received:
    34
    Best Answers:
    0
    Nope, in my opition quest log sucks [i just cannot configure it, so ive saying its sucks]
    Thats why ive made mission talkaction.
     
  4. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,541
    Likes Received:
    492
    Best Answers:
    0
    you can add another parameter for the level also the script would be a lot shorter
     
  5. Erexo

    Erexo Kage

    Joined:
    Mar 27, 2010
    Messages:
    567
    Likes Received:
    34
    Best Answers:
    0
    I made this script for personal usage, so i dont need to make it shorter. Anyways I've decided to share it with you guys :)
     
  6. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,541
    Likes Received:
    492
    Best Answers:
    0
    Thats isn't a good answer, personally, if i'm doing my homework (telling something) I will do it as best I can because I want a good qualification no?
    Well, I'm trying to say that, it can be a lot shorter and I will do that (ofc credits to you and to Colandus for fix my error)

    Good job anyways :)
     
  7. Erexo

    Erexo Kage

    Joined:
    Mar 27, 2010
    Messages:
    567
    Likes Received:
    34
    Best Answers:
    0
    Your example isnt too good, I'm doing my homework for a teacher, who wanna check my skills, but i can draw whatever i fucking want at last pages of my book becouse noone will ever check this.
    Also here, i can do complicated and long as f*ck scripts, becouse its only for me, less job, same results, so I dont see the point to make it shorter. (or if you wanna learn something, then you can do complicated scripts).
    Nope, i dont wanna to make it shorter, its mine script.

    PS:
    Code (Lua):
    1. local config = {
    2. minlv/maxlv,
    3. }
    4. local valTable = {}
    5. local check = 1
    6. for i=1, #config do
    7.     if getPlayerLevel(cid) >= config[i].minlv and getPlayerLevel(cid) <= config[i].maxlv then
    8.         table.insert(valTable,check,config[i])
    9.         check = check + 1
    10.     end
    11. end
    12. local rand = (#valTable)
    13.  
    14. for i=1, #valTable do
    15.     if rand == i then
    16.         --Script here
    17.         break
    18.     end
    19. end
    Just for you
     
  8. Summ

    Summ (\/)(;,,;)(\/) Y not? Staff Member Global Moderator

    Joined:
    Oct 15, 2008
    Messages:
    4,142
    Likes Received:
    1,021
    Best Answers:
    2
    Nice release, though I can't see it like that :p

    Code (Lua):
    1. local config = {
    2.     [{1, 30}] = {
    3.         {["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
    4.         {["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75}
    5.     },
    6.    
    7.     [{31, 70}] = {
    8.         {["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 67},
    9.         {["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 68}
    10.     },
    11.  
    12.     [{71, 100}] = {
    13.         {["name"] = "Stranger", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 75},
    14.         {["name"] = "Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 73}
    15.     },
    16.    
    17.     [{101, 150}] = {
    18.         {["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 85},
    19.         {["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 65}
    20.     },
    21.    
    22.     [{151, 200}] = {
    23.         {["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 73},
    24.         {["name"] = "Nukenin", ["storage"] = 27, ["count"] = 50, ["exp"] = 1500000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 77}
    25.     },
    26.    
    27.     [{201, 250}] = {
    28.         {["name"] = "Nukenin", ["storage"] = 30, ["count"] = 70, ["exp"] = 2000000, ["item"] = 2160, ["icount"] = 6, ["chance"] = 71},
    29.         {["name"] = "Akatsuki Memember", ["storage"] = 31, ["count"] = 40, ["exp"] = 3000000, ["item"] = 2160, ["icount"] = 6, ["chance"] = 73}
    30.     },
    31.    
    32.     [{251, 300}] = {
    33.         {["name"] = "Akatsuki Memember", ["storage"] = 34, ["count"] = 70, ["exp"] = 6000000, ["item"] = 2160, ["icount"] = 10, ["chance"] = 65},
    34.         {["name"] = "Samurai Master", ["storage"] = 35, ["count"] = 60, ["exp"] = 4000000, ["item"] = 2160, ["icount"] = 12, ["chance"] = 66}
    35.     },
    36.    
    37.     [{301, 350}] = {
    38.         {["name"] = "Rikudou Patch", ["storage"] = 38, ["count"] = 70, ["exp"] = 8000000, ["item"] = 2160, ["icount"] = 14, ["chance"] = 73},
    39.         {["name"] = "Black Samurai [King]", ["storage"] = 39, ["count"] = 30, ["exp"] = 7000000, ["item"] = 2160, ["icount"] = 15, ["chance"] = 77}
    40.     },
    41.    
    42.     [{351, 400}] = {
    43.         {["name"] = "Rikudou Patch", ["storage"] = 61, ["count"] = 70, ["exp"] = 8000000, ["item"] = 2160, ["icount"] = 14, ["chance"] = 73},
    44.         {["name"] = "Black Samurai [King]", ["storage"] = 62, ["count"] = 50, ["exp"] = 8500000, ["item"] = 2160, ["icount"] = 16, ["chance"] = 70}
    45.     },
    46.    
    47.     [{401, 500}] = {
    48.         {["name"] = "Black Samurai [King]", ["storage"] = 41, ["count"] = 50, ["exp"] = 9000000, ["item"] = 2160, ["icount"] = 16, ["chance"] = 71},
    49.         {["name"] = "Black Samurai [King]", ["storage"] = 42, ["count"] = 70, ["exp"] = 11000000, ["item"] = 2160, ["icount"] = 18, ["chance"] = 73}
    50.     },
    51.  
    52.     [{501, math.huge}] = {
    53.        {["name"] = "Heaven Guardian", ["storage"] = 46, ["count"] = 50, ["exp"] = 13000000, ["item"] = 2160, ["icount"] = 25, ["chance"] = 90},
    54.        {["name"] = "Heaven Guardian", ["storage"] = 47, ["count"] = 70, ["exp"] = 15000000, ["item"] = 2160, ["icount"] = 27, ["chance"] = 76},
    55.        {["name"] = "Bug", ["storage"] = 52, ["count"] = 100, ["exp"] = 10000000, ["item"] = 1691, ["icount"] = 1, ["chance"] = 100}
    56.     }    
    57. }
    58.  
    59.  
    60. local keywordHandler = KeywordHandler:new()
    61. local npcHandler = NpcHandler:new(keywordHandler)
    62. NpcSystem.parseParameters(npcHandler)
    63. local talkState = {}
    64. function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid) end
    65. function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid) end
    66. function onCreatureSay(cid, type, msg)          npcHandler:onCreatureSay(cid, type, msg) end
    67. function onThink()                  npcHandler:onThink() end
    68.  
    69. function creatureSayCallback(cid, type, msg)
    70.     if(not npcHandler:isFocused(cid)) then
    71.         return false
    72.     end
    73.     local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    74.  
    75.     if(msgcontains(msg, 'mission') or msgcontains(msg, 'daily')) then
    76.         if getPlayerStorageValue(cid,2423) <= 1 then
    77.             local lv = getPlayerLevel(cid)
    78.             for level, tasks in pairs(config) do
    79.                 if lv >= level[1] and lv < level[2] then
    80.                     local randomTask = tasks[math.random(#tasks)]
    81.                     selfSay('Your mission today is to kill ' .. randomTask.count .. ' ' .. randomTask.name .. '\'s. Back when you end.', cid)
    82.                     setPlayerStorageValue(cid, 2423, randomTask.storage)
    83.                     break
    84.                 end
    85.             end    
    86.         elseif getPlayerStorageValue(cid,2423) == 100 then
    87.                 selfSay('You have complete today mission! Come back tomorrow!', cid)
    88.                 return true
    89.         else
    90.             local taskID = getPlayerStorageValue(cid, 2423)
    91.             local killed = getPlayerStorageValue(cid, 2425)
    92.             for level, tasks in pairs(config) do
    93.                 for k, t in pairs(tasks) do
    94.                     if t.storage == taskID then
    95.                         if killed >= t.count then
    96.                             selfSay('Exelent! You done today mission.', cid)
    97.                             doPlayerAddExp(cid, t.exp)
    98.                             setPlayerStorageValue(cid, 2423, 100)
    99.                             if math.random(100) <= t.chance then
    100.                                 doPlayerAddItem(cid, t.item, t.icount)
    101.                             end
    102.                         else
    103.                             selfSay('You did not kill enough ' .. t.name .. '\'s yet.', cid)
    104.                         end
    105.                         return true
    106.                     end
    107.                 end
    108.             end    
    109.         end
    110.     end
    111.  
    112.     return true
    113. end
    114.  
    115. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    116. npcHandler:addModule(FocusModule:new())
    117.  
    I don't think it is less work. It is even more work to do it with 100 if-blocks etc.
     
    Last edited: Mar 29, 2013
  9. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,541
    Likes Received:
    492
    Best Answers:
    0
    also creaturescript:
    Code (Lua):
    1.  
    2. local config = {
    3. ["name in lowercase (thanks teckman)"] = { storage = same storage at npc file, count = same count}
    4. }
    5.  
    6. function onKill(cid, target, lastHit)
    7.     local creature, task, kills = config[getCreatureName(target):lower()], getPlayerStorageValue(cid, 2423), getPlayerStorageValue(cid, 2425)
    8.     local function isSummon(cid)
    9.         return getCreatureMaster(cid) ~= cid or false
    10.     end
    11.     if creature and lastHit then
    12.         if isPlayer(target) or isSummon(target) then return true end
    13.         if task == creature.storage then
    14.             setPlayerStorageValue(cid, 2425, kills + 1)
    15.             if kills < creature.count then
    16.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed " .. getCreatureName(target) .. " [" .. kills .. "/" .. creature.count.."]")
    17.             elseif kills == creature.count then
    18.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed last " .. getCreatureName(target) .. ", go back to NPC and report.")
    19.             end
    20.         end
    21.     end
    22.     return true
    23. end
    24.  
     
    Last edited: Mar 30, 2013
  10. Erexo

    Erexo Kage

    Joined:
    Mar 27, 2010
    Messages:
    567
    Likes Received:
    34
    Best Answers:
    0
    Hate u guys,
    why short creaturescripts!?
     
  11. Printer

    Printer if Printer then print("LUA") end Premium User

    Joined:
    Dec 27, 2009
    Messages:
    5,573
    Likes Received:
    1,844
    Best Answers:
    2
    /\

    Its nothing negative, shorter more read able :) Anyway!
    Great job, looks good :)
     
  12. Ancore

    Ancore Member

    Joined:
    Jul 6, 2012
    Messages:
    206
    Likes Received:
    1
    Best Answers:
    0
    14:41 Asadfa [60]: daily task
    14:41 Tasker: You have dont killed enought Black Knight's.

    And I have already killed like 20 black knights...

    14:43 [Mission]: You have killed [-1 / 60] Black Knights.
    14:43 Reward: 350000 experience points and 73% chance to recive 1x crystal coin's.


    Maybe it is because I deleted the (cid, "dailycounter") in:

    Because of this error:
     
  13. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,541
    Likes Received:
    492
    Best Answers:
    0
    use this npc:
    Code (Lua):
    1.  
    2. local config = {
    3.     [{1, 30}] = {
    4.         {["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
    5.         {["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75}
    6.     },
    7.  
    8.     [{31, 70}] = {
    9.         {["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 67},
    10.         {["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 68}
    11.     },
    12.  
    13.     [{71, 100}] = {
    14.         {["name"] = "Cave Rat", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 75},
    15.         {["name"] = "Rat",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 73}
    16.     },
    17.  
    18.     [{101, 150}] = {
    19.         {["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 85},
    20.         {["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 65}
    21.     },
    22.  
    23.     [{151, 200}] = {
    24.         {["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 73},
    25.         {["name"] = "Nukenin", ["storage"] = 27, ["count"] = 50, ["exp"] = 1500000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 77}
    26.     },
    27.  
    28.     [{201, 250}] = {
    29.         {["name"] = "Nukenin", ["storage"] = 30, ["count"] = 70, ["exp"] = 2000000, ["item"] = 2160, ["icount"] = 6, ["chance"] = 71},
    30.         {["name"] = "Akatsuki Memember", ["storage"] = 31, ["count"] = 40, ["exp"] = 3000000, ["item"] = 2160, ["icount"] = 6, ["chance"] = 73}
    31.     },
    32.  
    33.     [{251, 300}] = {
    34.         {["name"] = "Akatsuki Memember", ["storage"] = 34, ["count"] = 70, ["exp"] = 6000000, ["item"] = 2160, ["icount"] = 10, ["chance"] = 65},
    35.         {["name"] = "Samurai Master", ["storage"] = 35, ["count"] = 60, ["exp"] = 4000000, ["item"] = 2160, ["icount"] = 12, ["chance"] = 66}
    36.     },
    37.  
    38.     [{301, 350}] = {
    39.         {["name"] = "Rikudou Patch", ["storage"] = 38, ["count"] = 70, ["exp"] = 8000000, ["item"] = 2160, ["icount"] = 14, ["chance"] = 73},
    40.         {["name"] = "Black Samurai [King]", ["storage"] = 39, ["count"] = 30, ["exp"] = 7000000, ["item"] = 2160, ["icount"] = 15, ["chance"] = 77}
    41.     },
    42.  
    43.     [{351, 400}] = {
    44.         {["name"] = "Rikudou Patch", ["storage"] = 61, ["count"] = 70, ["exp"] = 8000000, ["item"] = 2160, ["icount"] = 14, ["chance"] = 73},
    45.         {["name"] = "Black Samurai [King]", ["storage"] = 62, ["count"] = 50, ["exp"] = 8500000, ["item"] = 2160, ["icount"] = 16, ["chance"] = 70}
    46.     },
    47.  
    48.     [{401, 500}] = {
    49.         {["name"] = "Black Samurai [King]", ["storage"] = 41, ["count"] = 50, ["exp"] = 9000000, ["item"] = 2160, ["icount"] = 16, ["chance"] = 71},
    50.         {["name"] = "Black Samurai [King]", ["storage"] = 42, ["count"] = 70, ["exp"] = 11000000, ["item"] = 2160, ["icount"] = 18, ["chance"] = 73}
    51.     },
    52.  
    53.     [{501, 600}] = {
    54.        {["name"] = "Heaven Guardian", ["storage"] = 46, ["count"] = 50, ["exp"] = 13000000, ["item"] = 2160, ["icount"] = 25, ["chance"] = 90},
    55.        {["name"] = "Heaven Guardian", ["storage"] = 47, ["count"] = 70, ["exp"] = 15000000, ["item"] = 2160, ["icount"] = 27, ["chance"] = 76},
    56.        {["name"] = "Bug", ["storage"] = 52, ["count"] = 100, ["exp"] = 10000000, ["item"] = 1691, ["icount"] = 1, ["chance"] = 100}
    57.     }    
    58. }
    59.  
    60.  
    61. local keywordHandler = KeywordHandler:new()
    62. local npcHandler = NpcHandler:new(keywordHandler)
    63. NpcSystem.parseParameters(npcHandler)
    64. local talkState = {}
    65. function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid) end
    66. function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid) end
    67. function onCreatureSay(cid, type, msg)          npcHandler:onCreatureSay(cid, type, msg) end
    68. function onThink()                  npcHandler:onThink() end
    69.  
    70. function creatureSayCallback(cid, type, msg)
    71.     if(not npcHandler:isFocused(cid)) then
    72.         return false
    73.     end
    74.     local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    75.  
    76.     if(msgcontains(msg, 'mission') or msgcontains(msg, 'daily')) then
    77.         if getPlayerStorageValue(cid, 2423) <= 1 then
    78.             local lv = getPlayerLevel(cid)
    79.             for level, tasks in pairs(config) do
    80.                 if lv >= level[1] and lv <= level[2] then
    81.                     local randomTask = tasks[math.random(#tasks)]
    82.                     selfSay('Your mission today is to kill ' .. randomTask.count .. ' ' .. randomTask.name .. '\'s. Back when you end.', cid)
    83.                     setPlayerStorageValue(cid, 2423, randomTask.storage)
    84.                     break
    85.                 end
    86.             end    
    87.         elseif getPlayerStorageValue(cid,2423) == 100 then
    88.                 selfSay('You have complete today mission! Come back tomorrow!', cid)
    89.                 return true
    90.         else
    91.             local taskID = getPlayerStorageValue(cid, 2423)
    92.             local killed = getPlayerStorageValue(cid, 2425)
    93.             for level, tasks in pairs(config) do
    94.                 for k, t in pairs(tasks) do
    95.                     if t.storage == taskID then
    96.                         if killed >= t.count then
    97.                             selfSay('Exelent! You done today mission.', cid)
    98.                             doPlayerAddExp(cid, t.exp)
    99.                             setPlayerStorageValue(cid, 2423, 100)
    100.                             if math.random(100) <= t.chance then
    101.                                 doPlayerAddItem(cid, t.item, t.icount)
    102.                             end
    103.                         else
    104.                 local function getKills(cid) return killed > 0 and killed or 0 end
    105.                             selfSay('You did not kill enough ' .. t.name .. '\'s yet, you have killed ' .. getKills(cid) ..'/' .. t.count .. ' ' .. t.name .. '\'s', cid)
    106.                         end
    107.                         return true
    108.                     end
    109.                 end
    110.             end    
    111.         end
    112.     end
    113.  
    114.     return true
    115. end
    116.  
    117. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    118. npcHandler:addModule(FocusModule:new())
    119.  
     
  14. Ancore

    Ancore Member

    Joined:
    Jul 6, 2012
    Messages:
    206
    Likes Received:
    1
    Best Answers:
    0
    15:19 Loot of a wolf: nothing.
    15:19 A wolf loses 12 hitpoints due to your attack.
    15:19 A wolf loses 13 hitpoints due to your attack.
    15:19 You gained 135 experience points.
    15:19 Loot of a wolf: meat.
    15:20 Sasuke [8]: daily task
    15:20 Tasker: You did not kill enough Wolf's yet, you have killed 0/2 Wolf's
     
  15. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,541
    Likes Received:
    492
    Best Answers:
    0
  16. Erexo

    Erexo Kage

    Joined:
    Mar 27, 2010
    Messages:
    567
    Likes Received:
    34
    Best Answers:
    0
    fuck that, im out
     
  17. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,541
    Likes Received:
    492
    Best Answers:
    0
    what is wrong with you?
     
  18. leileililasian

    leileililasian New Member

    Joined:
    Sep 27, 2009
    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Where would i put the login.lua at?>>>registerCreatureEvent(cid, "dailycounter")
     
  19. Nubaza

    Nubaza LUA Scripter

    Joined:
    Jun 5, 2011
    Messages:
    293
    Likes Received:
    8
    Best Answers:
    0
    consecutive error:
    [03/01/2014 04:12:16] [Error - Npc interface]
    [03/01/2014 04:12:16] (Unknown script file)
    [03/01/2014 04:12:16] Description:
    [03/01/2014 04:12:16] attempt to call a nil value
    [03/01/2014 04:12:16] stack traceback:

    [03/01/2014 04:12:17] [Error - Npc interface]
    [03/01/2014 04:12:17] (Unknown script file)
    [03/01/2014 04:12:17] Description:
    [03/01/2014 04:12:17] attempt to call a nil value
    [03/01/2014 04:12:17] stack traceback:

    [03/01/2014 04:12:17] [Error - Npc interface]
    [03/01/2014 04:12:17] (Unknown script file)
    [03/01/2014 04:12:17] Description:
    [03/01/2014 04:12:17] attempt to call a nil value
    [03/01/2014 04:12:17] stack traceback:

    [03/01/2014 04:12:18] [Error - Npc interface]
    [03/01/2014 04:12:18] (Unknown script file)
    [03/01/2014 04:12:18] Description:
    [03/01/2014 04:12:18] attempt to call a nil value
    [03/01/2014 04:12:18] stack traceback:

    Help please
     
  20. Nubaza

    Nubaza LUA Scripter

    Joined:
    Jun 5, 2011
    Messages:
    293
    Likes Received:
    8
    Best Answers:
    0
    Fixed reemplazing

    local keywordHandler = KeywordHandler:new()
    local npcHandler = NpcHandler:new(keywordHandler)
    NpcSystem.parseParameters(npcHandler)
    local talkState = {}
    function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
    function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
    function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
    function onThink() npcHandler:eek:nThink() end
    function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
    end

    function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid


    BY THAT


    local keywordHandler = KeywordHandler:new()
    local npcHandler = NpcHandler:new(keywordHandler)
    NpcSystem.parseParameters(npcHandler)
    local talkState = {}
    function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
    function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
    function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
    function onThink() npcHandler:eek:nThink() end
    function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid


    LOL
     

Share This Page

Loading...