• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Sistema] Task Diarias (tfs 0.3.6)

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1[Sistema] Task Diarias (tfs 0.3.6) Empty [Sistema] Task Diarias (tfs 0.3.6) Sáb Abr 28, 2018 1:11 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    `Daily Missions`, escrito para 0.3.6pl1.

    NPC SCRIPT:

    Código:
    local daily1 = { --1-30
    {["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
    {["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75}
    }
    local daily2 = { --31-70
    {["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 67},
    {["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 68}
    }
    local daily3 = { --71-100
    {["name"] = "Stranger", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 75},
    {["name"] = "Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 73}
    }
    local daily4 = { --101-150
    {["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 85},
    {["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 65}
    }
    local daily5 = { --151-200
    {["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 73},
    {["name"] = "Nukenin", ["storage"] = 27, ["count"] = 50, ["exp"] = 1500000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 77}
    }
    local daily6 = { --201-250
    {["name"] = "Nukenin", ["storage"] = 30, ["count"] = 70, ["exp"] = 2000000, ["item"] = 2160, ["icount"] = 6, ["chance"] = 71},
    {["name"] = "Akatsuki Memember", ["storage"] = 31, ["count"] = 40, ["exp"] = 3000000, ["item"] = 2160, ["icount"] = 6, ["chance"] = 73}
    }
    local daily7 = { --251-300
    {["name"] = "Akatsuki Memember", ["storage"] = 34, ["count"] = 70, ["exp"] = 6000000, ["item"] = 2160, ["icount"] = 10, ["chance"] = 65},
    {["name"] = "Samurai Master", ["storage"] = 35, ["count"] = 60, ["exp"] = 4000000, ["item"] = 2160, ["icount"] = 12, ["chance"] = 66}
    }
    local daily8 = { --301-350
    {["name"] = "Rikudou Patch", ["storage"] = 38, ["count"] = 70, ["exp"] = 8000000, ["item"] = 2160, ["icount"] = 14, ["chance"] = 73},
    {["name"] = "Black Samurai [King]", ["storage"] = 39, ["count"] = 30, ["exp"] = 7000000, ["item"] = 2160, ["icount"] = 15, ["chance"] = 77}
    }
    local daily11 = { --351-400
    {["name"] = "Rikudou Patch", ["storage"] = 61, ["count"] = 70, ["exp"] = 8000000, ["item"] = 2160, ["icount"] = 14, ["chance"] = 73},
    {["name"] = "Black Samurai [King]", ["storage"] = 62, ["count"] = 50, ["exp"] = 8500000, ["item"] = 2160, ["icount"] = 16, ["chance"] = 70}
    }
    local daily9 = { --401-500
    {["name"] = "Black Samurai [King]", ["storage"] = 41, ["count"] = 50, ["exp"] = 9000000, ["item"] = 2160, ["icount"] = 16, ["chance"] = 71},
    {["name"] = "Black Samurai [King]", ["storage"] = 42, ["count"] = 70, ["exp"] = 11000000, ["item"] = 2160, ["icount"] = 18, ["chance"] = 73}
    }
    local daily10 = { --500+
    {["name"] = "Heaven Guardian", ["storage"] = 46, ["count"] = 50, ["exp"] = 13000000, ["item"] = 2160, ["icount"] = 25, ["chance"] = 90},
    {["name"] = "Heaven Guardian", ["storage"] = 47, ["count"] = 70, ["exp"] = 15000000, ["item"] = 2160, ["icount"] = 27, ["chance"] = 76},
    {["name"] = "Bug", ["storage"] = 52, ["count"] = 100, ["exp"] = 10000000, ["item"] = 1691, ["icount"] = 1, ["chance"] = 100}
    }
     
    local keywordHandler = KeywordHandler:new()
    local npcHandler = NpcHandler:new(keywordHandler)
    NpcSystem.parseParameters(npcHandler)
    local talkState = {}
    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 creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
            return false
        end
        local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
     
    --Branie Daily
        if(msgcontains(msg, 'mission') or msgcontains(msg, 'daily')) then
        if getPlayerStorageValue(cid,2423) <= 1 then
            if getPlayerLevel(cid) <= 30 then
                rand = math.random(1, #daily1)
                for i = 1, #daily1 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily1[i].count .. ' ' .. daily1[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily1[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            elseif getPlayerLevel(cid) > 30 and getPlayerLevel(cid) <= 70 then
                rand = math.random(1, #daily2)
                for i = 1, #daily2 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily2[i].count .. ' ' .. daily2[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily2[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            elseif getPlayerLevel(cid) > 70 and getPlayerLevel(cid) <= 100 then
                rand = math.random(1, #daily3)
                for i = 1, #daily3 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily3[i].count .. ' ' .. daily3[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily3[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            elseif getPlayerLevel(cid) > 100 and getPlayerLevel(cid) <= 150 then
                rand = math.random(1, #daily4)
                for i = 1, #daily4 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily4[i].count .. ' ' .. daily4[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily4[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            elseif getPlayerLevel(cid) > 150 and getPlayerLevel(cid) <= 200 then
                rand = math.random(1, #daily5)
                for i = 1, #daily5 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily5[i].count .. ' ' .. daily5[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily5[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            elseif getPlayerLevel(cid) > 200 and getPlayerLevel(cid) <= 250 then
                rand = math.random(1, #daily6)
                for i = 1, #daily6 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily6[i].count .. ' ' .. daily6[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily6[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            elseif getPlayerLevel(cid) > 250 and getPlayerLevel(cid) <= 300 then
                rand = math.random(1, #daily7)
                for i = 1, #daily7 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily7[i].count .. ' ' .. daily7[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily7[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            elseif getPlayerLevel(cid) > 300 and getPlayerLevel(cid) <= 350 then
                rand = math.random(1, #daily8)
                for i = 1, #daily8 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily8[i].count .. ' ' .. daily8[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily8[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            elseif getPlayerLevel(cid) > 350 and getPlayerLevel(cid) <= 400 then
                rand = math.random(1, #daily11)
                for i = 1, #daily11 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily11[i].count .. ' ' .. daily11[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily11[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            elseif getPlayerLevel(cid) > 400 and getPlayerLevel(cid) <= 500 then
                rand = math.random(1, #daily9)
                for i = 1, #daily9 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily9[i].count .. ' ' .. daily9[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily9[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            elseif getPlayerLevel(cid) > 500 then
                rand = math.random(1, #daily10)
                for i = 1, #daily10 do
                    if rand == i then
                        selfSay('Your mission today is to kill ' .. daily10[i].count .. 'x ' .. daily10[i].name .. '\'s. Back when you end.', cid)
                        setPlayerStorageValue(cid,2423,daily10[i].storage)
                        talkState[talkUser] = 0
                     
                    end
                end
            end
     
        end
        if getPlayerStorageValue(cid,2423) == 100 then
                selfSay('You have complete today mission! Back tomorrow!', cid)
                talkState[talkUser] = 0
        end
     
     
     
     
        --Oddanie Daily Questa
     
            for i = 1, #daily1 do
                if getPlayerStorageValue(cid,2423) == daily1[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily1[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily1[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily1[i].chance then
                        doPlayerAddItem(cid,daily1[i].item,daily1[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily1[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
            for i = 1, #daily2 do
                if getPlayerStorageValue(cid,2423) == daily2[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily2[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily2[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily2[i].chance then
                        doPlayerAddItem(cid,daily2[i].item,daily2[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily2[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
            for i = 1, #daily3 do
                if getPlayerStorageValue(cid,2423) == daily3[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily3[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily3[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily3[i].chance then
                        doPlayerAddItem(cid,daily3[i].item,daily3[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily3[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
            for i = 1, #daily4 do
                if getPlayerStorageValue(cid,2423) == daily4[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily4[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily4[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily4[i].chance then
                        doPlayerAddItem(cid,daily4[i].item,daily4[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily4[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
            for i = 1, #daily5 do
                if getPlayerStorageValue(cid,2423) == daily5[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily5[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily5[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily5[i].chance then
                        doPlayerAddItem(cid,daily5[i].item,daily5[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily5[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
            for i = 1, #daily6 do
                if getPlayerStorageValue(cid,2423) == daily6[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily6[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily6[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily6[i].chance then
                        doPlayerAddItem(cid,daily6[i].item,daily6[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily6[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
            for i = 1, #daily7 do
                if getPlayerStorageValue(cid,2423) == daily7[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily7[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily7[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily7[i].chance then
                        doPlayerAddItem(cid,daily7[i].item,daily7[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily7[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
            for i = 1, #daily8 do
                if getPlayerStorageValue(cid,2423) == daily8[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily8[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily8[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily8[i].chance then
                        doPlayerAddItem(cid,daily8[i].item,daily8[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily8[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
            for i = 1, #daily9 do
                if getPlayerStorageValue(cid,2423) == daily9[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily9[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily9[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily9[i].chance then
                        doPlayerAddItem(cid,daily9[i].item,daily9[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily9[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
            for i = 1, #daily10 do
                if getPlayerStorageValue(cid,2423) == daily10[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily10[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily10[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily10[i].chance then
                        doPlayerAddItem(cid,daily10[i].item,daily10[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily10[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
            for i = 1, #daily11 do
                if getPlayerStorageValue(cid,2423) == daily11[i].storage then
                    if getPlayerStorageValue(cid,2425) >= daily11[i].count then
                    selfSay('Exelent! You done today mission.', cid)
                    doPlayerAddExp(cid,daily11[i].exp)
                    setPlayerStorageValue(cid,2423,100)
                    if math.random(1,100) <= daily11[i].chance then
                        doPlayerAddItem(cid,daily11[i].item,daily11[i].icount)
                    end
                    talkState[talkUser] = 0
                    else
                    selfSay('You have dont killed enought ' .. daily11[i].name .. '\'s.', cid)
                    talkState[talkUser] = 0
                    end
                end
            end
        end
     
        return true
    end
     
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())


    creaturescripts.xml

    Código:
    <event type="kill" name="dailycounter" script="dailycounter.lua"/>

    login.lua

    Código:
    registerCreatureEvent(cid, "dailycounter")

    dailycounter.lua


    Código:
    local config = {
    {["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
    {["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75},
    {["name"] = "Bandit", ["storage"] = 7, ["count"] = 30, ["exp"] = 25000, ["item"] = 2152, ["icount"] = 30, ["chance"] = 90},
    {["name"] = "Elite Bandit", ["storage"] = 7, ["count"] = 30, ["exp"] = 25000, ["item"] = 2152, ["icount"] = 30, ["chance"] = 90},
    {["name"] = "Fat Ninja", ["storage"] = 8, ["count"] = 30, ["exp"] = 26000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 90},
    {["name"] = "Onbaa", ["storage"] = 9, ["count"] = 30, ["exp"] = 30000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 90},
    {["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
    {["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
    {["name"] = "Cursed Skeleton", ["storage"] = 12, ["count"] = 30, ["exp"] = 130000, ["item"] = 2152, ["icount"] = 60, ["chance"] = 70},
    {["name"] = "Vampire", ["storage"] = 13, ["count"] = 30, ["exp"] = 170000, ["item"] = 2152, ["icount"] = 70, ["chance"] = 70},
    {["name"] = "Cyborg", ["storage"] = 14, ["count"] = 30, ["exp"] = 90000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
    {["name"] = "Elite Cyborg", ["storage"] = 14, ["count"] = 30, ["exp"] = 90000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
    {["name"] = "Young Kyokushin", ["storage"] = 15, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
    {["name"] = "Kyokushin", ["storage"] = 15, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
    {["name"] = "Monk", ["storage"] = 16, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
    {["name"] = "Elite Monk", ["storage"] = 16, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
    {["name"] = "Stranger", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    {["name"] = "Young Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    {["name"] = "Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    {["name"] = "Sound Shinobi", ["storage"] = 19, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    {["name"] = "Stranger", ["storage"] = 20, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    {["name"] = "Zombie", ["storage"] = 21, ["count"] = 30, ["exp"] = 370000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
    {["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 70},
    {["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 70},
    {["name"] = "Ice Monster", ["storage"] = 24, ["count"] = 40, ["exp"] = 750000, ["item"] = 2160, ["icount"] = 3, ["chance"] = 70},
    {["name"] = "Elite Samurai", ["storage"] = 25, ["count"] = 40, ["exp"] = 1000000, ["item"] = 2160, ["icount"] = 4, ["chance"] = 75},
    {["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 70}
    }
    function onKill(cid, target, lastHit)
    if lastHit == true then
        if(isPlayer(target) ~= TRUE) then
     
            local master = getCreatureMaster(target)
            if(master and master ~= target) then return TRUE end
     
         
            for i = 1, #config do
                if getCreatureName(target):lower() == config[i].name:lower() then
                    if getPlayerStorageValue(cid, 2423) == config[i].storage then
                        setPlayerStorageValue(cid, 2425, getPlayerStorageValue(cid, 2425) + 1)
                        if config[i].name == "Black Fowler" then
                            if getPlayerStorageValue(cid, 2425) < config[i].count then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed Fowler [" .. getPlayerStorageValue(cid, 2425) .. " / " .. config[i].count.."]")
                            elseif getPlayerStorageValue(cid, 2425) == config[i].count then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed last Fowler, go back to NPC and report.")
                            end
                        else
                            if getPlayerStorageValue(cid, 2425) < config[i].count then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 2425) .. " / " .. config[i].count.."]")
                            elseif getPlayerStorageValue(cid, 2425) == config[i].count then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed last " .. config[i].name .. ", go back to NPC and report.")
                            end
                        end
                    end
                end
            end
        end
     
        return TRUE
    end
    end

    talkaction for check current mission status:

    Código:
    local config = {
    {["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
    {["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75},
    {["name"] = "Bandit", ["storage"] = 7, ["count"] = 30, ["exp"] = 25000, ["item"] = 2152, ["icount"] = 30, ["chance"] = 92},
    {["name"] = "Fat Ninja", ["storage"] = 8, ["count"] = 30, ["exp"] = 26000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 89},
    {["name"] = "Onbaa", ["storage"] = 9, ["count"] = 30, ["exp"] = 30000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 91},
    {["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 67},
    {["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 68},
    {["name"] = "Cursed Skeleton", ["storage"] = 12, ["count"] = 30, ["exp"] = 130000, ["item"] = 2152, ["icount"] = 60, ["chance"] = 71},
    {["name"] = "Vampire", ["storage"] = 13, ["count"] = 30, ["exp"] = 170000, ["item"] = 2152, ["icount"] = 70, ["chance"] = 75},
    {["name"] = "Cyborg", ["storage"] = 14, ["count"] = 30, ["exp"] = 90000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 76},
    {["name"] = "Kyokushin", ["storage"] = 15, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 78},
    {["name"] = "Monk", ["storage"] = 16, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 79},
    {["name"] = "Stranger", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 75},
    {["name"] = "Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 73},
    {["name"] = "Sound Shinobi", ["storage"] = 19, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 71},
    {["name"] = "Stranger", ["storage"] = 20, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 77},
    {["name"] = "Zombie", ["storage"] = 21, ["count"] = 30, ["exp"] = 370000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 78},
    {["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 85},
    {["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 65},
    {["name"] = "Ice Monster", ["storage"] = 24, ["count"] = 40, ["exp"] = 750000, ["item"] = 2160, ["icount"] = 3, ["chance"] = 68},
    {["name"] = "Elite Samurai", ["storage"] = 25, ["count"] = 40, ["exp"] = 1000000, ["item"] = 2160, ["icount"] = 4, ["chance"] = 74},
    {["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 73}
     
    }
     
     
    function onSay(cid, words, param)
     
    local pos = getPlayerPosition(cid)
     
    if getPlayerStorageValue(cid,2423) <= 1 then
        doPlayerSendTextMessage(cid, 20,"You doesnt started any mission today.")
    end
     
     
        for i = 1, #config do
            if getPlayerStorageValue(cid,2423) == config[i].storage then
                    if getPlayerStorageValue(cid,2425) < config[i].count then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Mission]: You have killed [" .. getPlayerStorageValue(cid, 2425) .. " / " .. config[i].count.."] " .. config[i].name .. "\'s.")
                        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.")
                    else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Mission]: You have killed enough " .. config[i].name .. "\'s, go back to NPC.")
                    end
            end
        end
    if getPlayerStorageValue(cid,2423) == 100 then
        doPlayerSendTextMessage(cid, 20,"You have done a mission today")
    end
        return 1
    end

    globalevents.xml


    Código:
    <globalevent name="daily" time="23:59" event="script" value="daily.lua"/>

    daliy.lua

    Código:
    function onTimer()
        db.executeQuery('INSERT IGNORE INTO `player_storage` SELECT `id`, 2423, 1 FROM `players` WHERE `online` = 0 ON DUPLICATE KEY UPDATE `value` = 1')
        db.executeQuery('INSERT IGNORE INTO `player_storage` SELECT `id`, 2425, 1 FROM `players` WHERE `online` = 0 ON DUPLICATE KEY UPDATE `value` = 0')
        local a = getPlayersOnline()
        for b = 1, #a do
            doCreatureSetStorage(a[b], 2423, 1)
            doCreatureSetStorage(a[b], 2425, 0)
        end
        return true
    end

    Simplemente restablecerá a todos los días a las 23:59. (Si el servidor no funcionó en la medianoche, ¡no se reiniciará diariamente!)



    Cómo configurar config
    En cada día, tienes un número, por ejemplo, de 1 a 30, que dice que los jugadores con el nivel 1 al 30 pueden recibir esos monstruos como una misión diaria,
    entonces tiene:

    Código:
    {["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},

    Nombre = nombre del monstruo
    storage = mantiene su misión, para cada día debe ser diferente (exactamente es solo un valor de almacenamiento (2423))
    contar = cantidad de monstruos que debes derrotar
    exp = la cantidad de experiencia que el jugador recibe
    item = ID del artículo que el jugador puede recibir
    icount = conteo de ese elemento
    posibilidad = una oportunidad de recibir el artículo

    Y simplemente ponga la misma configuración en cada script, y funcionará.


    creditos: Greetz, Erexo.



    [Sistema] Task Diarias (tfs 0.3.6) YNU5B25
    2 participantes
    http://www.tibiaface.com

    2[Sistema] Task Diarias (tfs 0.3.6) Empty no me funciona Mar Mayo 18, 2021 2:34 pm

    Nemesis811

    Nemesis811
    Miembro
    Miembro
    no se por que no me funciona cuando voy a matar el lobo el lobo se le desaparece la vida y queda vivo y no lo puedo atacar ni terminar de matar

    2 participantes

    3[Sistema] Task Diarias (tfs 0.3.6) Empty Re: [Sistema] Task Diarias (tfs 0.3.6) Mar Mayo 18, 2021 2:41 pm

    Nemesis811

    Nemesis811
    Miembro
    Miembro
    [Warning - Event::loadScript] Event onTime not found (data/globalevents/scripts/daily.lua)




    me sale eso en la consola

    2 participantes

    4[Sistema] Task Diarias (tfs 0.3.6) Empty Re: [Sistema] Task Diarias (tfs 0.3.6) Mar Mayo 18, 2021 5:41 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Nemesis811 escribió:[Warning - EventScript] Event onTime not found (data/globalevents/scripts/daily.lua)




    me sale eso en la consola

    el tema es que en algunos tfs em onTime varia en consolas como decir en algunos es onTimer o
    viceversa


    quiero decir que en este caso esta asi

    Código:
    function onTimer()

    y tu tiene que cambiar a

    Código:
    function onTime()



    [Sistema] Task Diarias (tfs 0.3.6) YNU5B25
    2 participantes
    http://www.tibiaface.com

    5[Sistema] Task Diarias (tfs 0.3.6) Empty Re: [Sistema] Task Diarias (tfs 0.3.6) Mar Mayo 18, 2021 7:12 pm

    Nemesis811

    Nemesis811
    Miembro
    Miembro
    mmmm asi si gracias maya



    10:52 [Mission]: You have killed [-1 / 50] Wolf's.
    10:52 Reward: 2000 experience points and 75% chance to recive 20x platinum coin's.

    eso me sale cuando pido status de mission y ya no me sale el error en la consola pero voy a matar las creaturas y no se mueren pero cuando quito esto de login.lua 
    [list=linenums]
    [*][list=linenums]
    registerCreatureEvent(cid, "dailycounter") apenas quito esto si se mueren no entiendo ayuda.....[/list]

    [/list]

    2 participantes

    Contenido patrocinado


    2 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).