Ir para conteúdo
  • Cadastre-se

revscripts [TFS 1.3] Task System + Daily Task System and Rank Look System.


Posts Recomendados

O Task System para TFS 0.4 8.6 original foi criado pela Vodkart e adaptado para TFS 1.x por Erro 502. Ele possuía alguns códigos muito ruins e erros de otimização. Então, eu peguei ambos, analisei tudo corretamente e corrigi. Agora está funcionando para todos os TFS; não é mais necessário adicioná-lo ao global.lua, basta colocá-lo diretamente na pasta 'lib' e tudo funcionará bem. Aproveite e teste o Task System.

 

 

  • Revscripts.

Basta adicioná-lo aos dados/scripts.

local taskSystemEvent = CreatureEvent("taskSystem")

function taskSystemEvent.onKill(creature, target)
    if creature:isPlayer() and target:isMonster() then
        local party = creature:getParty()
        local members = {}

        if party then
            members = party:getMembers()
            table.insert(members, party:getLeader())
        else
            members = {creature}
        end

        for _, member in pairs(members) do
            local creaturePos = member:getPosition()
            local killedMobPos = target:getPosition()
            local tile = Tile(creaturePos)

            if not tile:hasFlag(TILESTATE_PROTECTIONZONE) and killedMobPos:getDistance(creaturePos) < 25 then
                local taskSystem = _G.taskSystem
                local dailyTasks = _G.dailyTasks

                local task = taskSystem[member:getTaskMission()]
                local daily = dailyTasks[member:getDailyTaskMission()]

                if task and isInArray(task.monsters_list, target:getName()) then
                    local currentCount = member:getStorageValue(taskSystem_storages[3])
                    if currentCount < task.count then
                        member:setStorageValue(taskSystem_storages[3], currentCount + 1)
                        member:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "[Task System] Defeated: [" .. (currentCount + 1) .. "/" .. task.count .. "] monsters for the task: " .. task.name .. ".")
                        if currentCount + 1 >= task.count then
                            member:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "[Task System] Congratulations! You completed the task: " .. task.name .. ", return to the NPC to claim your reward.")
                        end
                    end
                end

                if daily and isInArray(daily.monsters_list, target:getName()) then
                    if os.time() >= 0 then
                        local dailyCount = member:getStorageValue(taskSystem_storages[5])
                        if dailyCount < daily.count then
                            member:setStorageValue(taskSystem_storages[5], dailyCount + 1)
                            member:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "[Daily Task System] Defeated: [" .. (dailyCount + 1) .. "/" .. daily.count .. "] monsters for the daily task: " .. daily.name .. ".")
                            if dailyCount + 1 >= daily.count then
                                member:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "[Daily Task System] Congratulations! You completed the daily task: " .. daily.name .. ", return to the NPC to claim your reward.")
                            end
                        end
                    else
                        member:sendCancelMessage("Sorry, but you didn't finish the Daily Task in time! Please return to the NPC to start a new Daily Task.")
                    end
                end
            end
        end
    end
    return true
end

taskSystemEvent:register()



local creatureEvent = CreatureEvent("taskLogin")

function creatureEvent.onLogin(player)
    player:registerEvent("taskSystem")
    return true
end

creatureEvent:register()

local talkAction = TalkAction("!task", "/task")

function talkAction.onSay(player, words, param)
    param = param:lower()
    local taskSystem = _G.taskSystem

    if isInArray({"counter", "contador"}, param) then
        player:setStorageValue(taskSystem_storages[8], player:getStorageValue(taskSystem_storages[8]) <= 0 and 1 or 0)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "[Task System] The counter has been " .. (player:getStorageValue(taskSystem_storages[8]) <= 0 and "activated" or "deactivated") .. ".")
        return true
    elseif isInArray({"daily", "diaria"}, param) then
        local dailyTasks = _G.dailyTasks
        local daily = player:getDailyTaskMission()
        if not dailyTasks[daily] or player:getStorageValue(taskSystem_storages[7]) <= 0 then
            player:sendCancelMessage("Sorry, you are not on any Daily Task.")
            return true
        elseif player:getStorageValue(taskSystem_storages[6]) - os.time() <= 0 and player:getStorageValue(taskSystem_storages[5]) < dailyTasks[daily].count then
            player:showTextDialog("Sorry, but you didn't finish the Daily Task in time! Please return to the NPC to start a new Daily Task.")
            return true
        end
        local taskInfo = "[->] CURRENT DAILY TASK INFO [<-]\n\nName: " .. dailyTasks[daily].name .. "\nProgress: [" .. (player:getStorageValue(taskSystem_storages[5]) < 0 and 0 or player:getStorageValue(taskSystem_storages[5])) .. "/" .. dailyTasks[daily].count .. "]\nDeadline: " .. os.date("%d %B %Y %X", player:getStorageValue(taskSystem_storages[6])) .. "\nMonsters to Hunt: " .. getMonsterFromList(dailyTasks[daily].monsters_list) .. "\n\n[->] CURRENT TASK REWARDS [<-]\n\nMoney: " .. (dailyTasks[daily].money > 0 and dailyTasks[daily].money or 0) .. "\nExperience: " .. (dailyTasks[daily].exp > 0 and dailyTasks[daily].exp or 0) .. "\nTask Points: " .. dailyTasks[daily].points .. "\nItems: " .. (#dailyTasks[daily].reward > 0 and getItemsFromList(dailyTasks[daily].reward) or "No reward items") .. "."
        return player:showTextDialog(1953, taskInfo)
    end

    local task = player:getTaskMission()
    if not taskSystem[task] or player:getStorageValue(taskSystem[task].start) <= 0 then
        player:sendCancelMessage("You are not on any task.")
        return true
    end

    local taskInfo = "-> CURRENT TASK [" .. task .. "/" .. #taskSystem .. "] <-\n\nTask Name: " .. taskSystem[task].name .. "\nTask Level: " .. taskSystem[task].level .. "\nTask Progress: [" .. (player:getStorageValue(taskSystem_storages[3]) < 0 and 0 or player:getStorageValue(taskSystem_storages[3])) .. "/" .. taskSystem[task].count .. "]\nMonster To Hunt: " .. getMonsterFromList(taskSystem[task].monsters_list) .. ".\nItems for Delivery: " .. (#taskSystem[task].items > 0 and getItemsFromList(taskSystem[task].items) or "None") .. ".\n\n[->] CURRENT TASK REWARDS [<-]\n\nReward Money: " .. (taskSystem[task].money > 0 and taskSystem[task].money or 0) .. "\nReward Experience: " .. (taskSystem[task].exp > 0 and taskSystem[task].exp or 0) .. "\nReward Points: " .. taskSystem[task].points .. "\nReward Items: " .. (#taskSystem[task].reward > 0 and getItemsFromList(taskSystem[task].reward) or "No reward items") .. "."
    return player:showTextDialog(1953, taskInfo)
end

talkAction:separator(" ")
talkAction:register()

local ec = EventCallback

ec.onLook = function(self, thing, position, distance, description)
    if thing:isPlayer() then
        local playerRank = thing:getRankTask() or "Private"
        return ("%s Rank task: [%s]"):format(description, playerRank)
    end

    return description
end

ec:register(66)

 

Após isso, adicione-o ao arquivo data/lib/lib.lua e inclua.

-- Task system + Daily Task System
dofile('data/lib/Task_system.lua')

e lib Task_system.lua

taskSystem = {
    [1] = {name = "Rat", start = 176201, monsters_list = {"Rat"}, level = 1, count = 10, points = 2, items = {}, reward = {{2674, 5}}, exp = 100, money = 10},
    [2] = {name = "Cave Rats Spotted!", start = 176201, monsters_list = {"Cave Rat"}, level = 3, count = 5, points = 0, items = {}, reward = {{2580, 1}}, exp = 150, money = 15},
    [3] = {name = "Trouble in the Old Forest", start = 176201, monsters_list = {"Rat"}, level = 8, count = 10, points = 5, items = {}, reward = {{2160, 30}}, exp = 250, money = 50},

}

dailyTasks = {
    [1] = {name = "Daily Rat" ,monsters_list = {"Rat"}, count = 10, points = 3, reward = {{2674, 5}}, exp = 100, money = 10},
    [2] = {name = "Daily Cave Rat" ,monsters_list = {"Cave Rat"}, count = 50, points = 3, reward = {{2173, 1}}, exp = 130, money = 20},
}
                   -- task, points, count, daily task, daily count, daily time , daily start, contador
taskSystem_storages = {176601, 176602, 176603, 176604, 176605, 176606, 176607, 176608}

function Player:getTaskMission()
    return self:getStorageValue(taskSystem_storages[1]) < 0 and 1 or self:getStorageValue(taskSystem_storages[1])
end

function Player:getDailyTaskMission()
    return self:getStorageValue(taskSystem_storages[4]) < 0 and 1 or self:getStorageValue(taskSystem_storages[4])
end

function Player:getTaskPoints()
    return self:getStorageValue(taskSystem_storages[2]) < 0 and 0 or self:getStorageValue(taskSystem_storages[2])
end

function Player:randomDailyTask()
    local t = {
        [{6, 49}] = {1, 3},
        [{50, 79}] = {1, 3},
        [{80, 129}] = {1, 3},
        [{130, math.huge}] = {1, 3}
    }
    for a, b in pairs(t) do
        if self:getLevel() >= a[1] and self:getLevel() <= a[2] then
            return math.random(b[1], b[2])
        end
    end
    return 0
end

function Player:getRankTask()
    local ranks = {
        [{1, 20}] = "Huntsman",
        [{21, 50}] = "Ranger",
        [{51, 100}] = "Big Game Hunter",
        [{101, 200}] = "Trophy Hunter",
        [{201, math.huge}] = "Elite Hunter"
    }

    local defaultRank = "Private"

    for v, r in pairs(ranks) do
        if self:getTaskPoints() >= v[1] and self:getTaskPoints() <= v[2] then
            return r
        end
    end

    return defaultRank
end

function getItemsFromList(items)
    local str = ''
    if #items > 0 then
        for i = 1, #items do
            local itemID = items[i][1]
            local itemName = ItemType(itemID):getName()
            if itemName then
                str = str .. items[i][2] .. ' ' .. itemName
            else
                str = str .. items[i][2] .. ' ' .. "Item ID: " .. itemID
            end
            if i ~= #items then str = str .. ', ' end
        end
    end
    return str
end


function Player:doRemoveItemsFromList(items)
    local count = 0
    if #items > 0 then
        for i = 1, #items do
            if self:getItemCount(items[i][1]) >= items[i][2] then
                count = count + 1
            end
        end
    end
    if count == #items then
        for i = 1, #items do
            self:removeItem(items[i][1], items[i][2])
        end
    else
        return false
    end
    return true
end

function getMonsterFromList(monster)
    local str = ''
    if #monster > 0 then
        for i = 1, #monster do
            str = str .. monster[i]
            if i ~= #monster then str = str .. ', ' end
        end
    end
    return str
end

function Player:giveRewardsTask(items)
    local backpack = self:addItem(1999, 1)
    for _, i_i in ipairs(items) do
        local item, amount = i_i[1], i_i[2]
        if ItemType(item):isStackable() or amount == 1 then
            backpack:addItem(item, amount)
        else
            for i = 1, amount do
                backpack:addItem(item, 1)
            end
        end
    end
end

O último é o NPC... basta adicionar o seu NPC no arquivo dados\npc\scripts\taskdaily.lua.

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 player = Player(cid)
    local talkUser, msg, str, rst = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower(), "", ""
    local task, daily, hours = player:getTaskMission(), player:getDailyTaskMission(), 24

    if isInArray({"task", "tasks", "missao", "mission"}, msg) then
        if taskSystem[task] then
            if player:getStorageValue(taskSystem[task].start) <= 0 then
                if player:getLevel() >= taskSystem[task].level then
                    player:setStorageValue(taskSystem[task].start, 1)
                    npcHandler:say("[Task System] Congratulations, you are now participating in the Task of "..taskSystem[task].name.." and shall kill "..taskSystem[task].count.." from this list: "..getMonsterFromList(taskSystem[task].monsters_list)..". "..(#taskSystem[task].items > 0 and "Oh and please bring me "..getItemsFromList(taskSystem[task].items).." for me." or "").."" , cid)
                else
                    npcHandler:say("Sorry, but you need to reach level "..taskSystem[task].level.." to be able to participate in the Task of "..taskSystem[task].name.."!", cid)
                end
            else
                npcHandler:say("Sorry, but you are currently on the task "..taskSystem[task].name..". You may {reward} if it's already over.", cid)
            end
        else
            npcHandler:say("Sorry, but for now I don't have any more tasks for you!", cid)
        end
    elseif isInArray({"diaria", "daily", "dayli", "diario"}, msg) then
        if player:getStorageValue(taskSystem_storages[6]) - os.time() > 0 then
            npcHandler:say("Sorry, you must wait until "..os.date("%d %B %Y %X ", player:getStorageValue(taskSystem_storages[6])).." to start a new daily task!", cid)
            return true
        elseif dailyTasks[daily] and player:getStorageValue(taskSystem_storages[5]) >= dailyTasks[daily].count then
            npcHandler:say("Sorry, do you have task for {reward}!", cid)
            return true
        end
        local r = player:randomDailyTask()
        if r == 0 then
            npcHandler:say("Sorry, but you don't have the level to complete any daily tasks.", cid)
            return true
        end
        player:setStorageValue(taskSystem_storages[4], r)
        player:setStorageValue(taskSystem_storages[6], os.time() + hours * 3600)
        player:setStorageValue(taskSystem_storages[7], 1)
        player:setStorageValue(taskSystem_storages[5], 0)
        local dtask = dailyTasks[r]
        npcHandler:say("[Daily Task System] Congratulations, you are now participating in the Daily Task of "..dtask.name.." and shall kill "..dtask.count.." monsters from this list: "..getMonsterFromList(dtask.monsters_list).." up until "..os.date("%d %B %Y %X ", player:getStorageValue(taskSystem_storages[6]))..". Good luck!" , cid)
    elseif isInArray({"receber", "reward", "recompensa", "report", "reportar", "entregar", "entrega"}, msg) then
        local v, k = taskSystem[task], dailyTasks[daily]
        if v then -- Original Task
            if player:getStorageValue(v.start) > 0 then
                if player:getStorageValue(taskSystem_storages[3]) >= v.count then
                    if #v.items > 0 and not doRemoveItemsFromList(cid, v.items) then
                        npcHandler:say("Sorry, but you also need to deliver the items on this list: "..getItemsFromList(v.items), cid)
                        return true
                    end

                    if v.exp > 0 then
                        player:addExperience(v.exp)
                        str = str.." "..v.exp.." experience"
                    end
                    if v.points > 0 then
                        player:setStorageValue(taskSystem_storages[2], (player:getTaskPoints() + v.points))
                        str = str.." + "..v.points.." task points"
                    end
                    if v.money > 0 then
                        player:addMoney(v.money)
                        str = str.." "..v.money.." gold coins"
                    end
                    if table.maxn(v.reward) > 0 then
                        player:giveRewardsTask(v.reward)
                        str = str.." "..getItemsFromList(v.reward)
                    end
                    npcHandler:say("Thank you for your help! Rewards: "..(str == "" and "none" or str).." for completing the task of "..v.name, cid)
                    player:setStorageValue(taskSystem_storages[3], 0)
                    player:setStorageValue(taskSystem_storages[1], (task + 1))
                else
                    npcHandler:say("Sorry, but you haven't finished your task "..v.name.." yet. I need you to kill more "..(player:getStorageValue(taskSystem_storages[3]) < 0 and v.count or -(player:getStorageValue(taskSystem_storages[3]) - v.count)).." of these terrible monsters!", cid)
                end
            else
            npcHandler:say("I'm sorry, but you have already completed a daily task today, and therefore, you cannot undertake another one. Please return tomorrow, and we can discuss it further. If you're interested, I can offer you another regular task. Simply say 'task' to express your interest.", cid)
            end
        end

        if k then -- Daily Task
            if player:getStorageValue(taskSystem_storages[7]) > 0 then
                if player:getStorageValue(taskSystem_storages[5]) >= k.count then
                    if k.exp > 0 then
                        player:addExperience(k.exp)
                        rst = rst.." "..k.exp.." experience"
                    end
                    if k.points > 0 then
                        player:setStorageValue(taskSystem_storages[2], (player:getTaskPoints() + k.points))
                        rst = rst.." + "..k.points.." task points"
                    end
                    if k.money > 0 then
                        player:addMoney(k.money)
                        rst = rst.." "..k.money.." gold coins"
                    end
                    if table.maxn(k.reward) > 0 then
                        player:giveRewardsTask(k.reward)
                        rst = rst.." "..getItemsFromList(k.reward)
                    end
                    npcHandler:say("Thank you for your help! Rewards: "..(rst == "" and "none" or rst).." for completing the daily task of "..k.name, cid)
                    player:setStorageValue(taskSystem_storages[4], 0)
                    player:setStorageValue(taskSystem_storages[5], 0)
                    player:setStorageValue(taskSystem_storages[7], 0)
                else
                    npcHandler:say("Sorry, but you haven't finished your daily task "..k.name.." yet. I need you to kill more "..(player:getStorageValue(taskSystem_storages[5]) < 0 and k.count or -(player:getStorageValue(taskSystem_storages[5]) - k.count)).." of these monsters!", cid)
                end   
            end
        end
    elseif msg == "no" then
        npcHandler:say("Alright then.", cid)
        talkState[talkUser] = 0
        npcHandler:releaseFocus(cid)
    end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Em relação ao XML do NPC... você já sabe como fazer, basta adicionar o nome quando quiser e testar, é simples :)

Editado por Mateus Robeerto (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
Postado (editado)

Os scripts já foram corrigidos e atualizados. O que fiz? Além disso, adicionei duas verificações para evitar abusos por parte de terceiros.

 

 local creaturePos = member:getPosition()
            local killedMobPos = target:getPosition()
            local tile = Tile(creaturePos)

            if not tile:hasFlag(TILESTATE_PROTECTIONZONE) and killedMobPos:getDistance(creaturePos) < 25 then

 

Também corrigi outro NPC que, antes, não respondia quando se dizia 'hi' e 'reward'. Agora ele responde normalmente.!!

 

 

 

OBS: Para quem quer diminuir ou aumentar esse SQM, basta procurar essa linha e ajustá-la conforme desejado :)

killedMobPos:getDistance(creaturePos) < 25 then

 

Editado por Mateus Robeerto (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Anderson Sacani
      Venho publicar uma alteração que eu e minha equipe fizemos no script já existente do Canary.
      O arquivo do script se chama quest_system1.lua.
      Fizemos essa alteração, porque o sistema original não entregava chave com actionid ao jogador. A chave vinha com o código 0000, ou seja, não abria nenhuma porta.
      A alteração que fizemos foi justamente para arrumar esse bug, por tanto, agora quando o quest ter uma chave com actionid dentro do baú, o jogador receberá essa mesma chave com o actionid definido.
       
      local specialQuests = { -- {x = 32752, y = 32343, z = 14} [52167] = Storage.DreamersChallenge.Reward, -- {x = 32806, y = 32230, z = 11} [52003] = Storage.PitsOfInferno.WeaponReward, -- {x = 32311, y = 32211, z = 8} [51400] = Storage.ThievesGuild.Reward, [51324] = Storage.WrathoftheEmperor.mainReward, -- {x = 32232, y = 31066, z = 7} [51715] = Storage.SvargrondArena.RewardGreenhorn, -- {x = 32232, y = 31059, z = 7} [51716] = Storage.SvargrondArena.RewardScrapper, -- {x = 32232, y = 31052, z = 7} [51717] = Storage.SvargrondArena.RewardWarlord } local questsExperience = { [3101] = 1 -- dummy values } local questLog = { [8213] = Storage.HiddenCityOfBeregar.DefaultStart } local tutorialIds = { [50080] = 5, [50082] = 6, [50084] = 10, [50086] = 11 } local hotaQuest = { 50950, 50951, 50952, 50953, 50954, 50955 } local questSystem1 = Action() function questSystem1.onUse(player, item, fromPosition, target, toPosition, isHotkey) local storage = specialQuests[item.actionid] if not storage then storage = item.uid if storage > 65535 then return false end end if storage == 23644 or storage == 24632 or storage == 14338 then player:setStorageValue(Storage.SvargrondArena.PitDoor, -1) end if player:getStorageValue(storage) > 0 and player:getAccountType() < ACCOUNT_TYPE_GOD then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The ' .. ItemType(item.itemid):getName() .. ' is empty.') return true end local function copyContainer(originalContainer, newContainer) for i = 0, originalContainer:getSize() - 1 do local originalItem = originalContainer:getItem(i) local newItem = Game.createItem(originalItem.itemid, originalItem.type) newItem:setActionId(originalItem:getActionId()) newItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, originalItem:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)) if originalItem:isContainer() then copyContainer(Container(originalItem.uid), Container(newItem.uid)) end newContainer:addItemEx(newItem) end end local items, reward = {} local size = item:isContainer() and item:getSize() or 0 if size == 0 then local actionId = item:getActionId() reward = Game.createItem(item.itemid, item.type) reward:setActionId(actionId) reward:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, item:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)) else local container = Container(item.uid) for i = 0, container:getSize() - 1 do local originalItem = container:getItem(i) local newItem = Game.createItem(originalItem.itemid, originalItem.type) newItem:setActionId(originalItem:getActionId()) newItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, originalItem:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)) if originalItem:isContainer() then copyContainer(Container(originalItem.uid), Container(newItem.uid)) end items[#items + 1] = newItem end if size == 1 then reward = items[1] end end local result = '' if reward then local ret = ItemType(reward.itemid) if ret:isRune() then result = ret:getArticle() .. ' ' .. ret:getName() .. ' (' .. reward.type .. ' charges)' elseif ret:isStackable() and reward:getCount() > 1 then result = reward:getCount() .. ' ' .. ret:getPluralName() elseif ret:getArticle() ~= '' then result = ret:getArticle() .. ' ' .. ret:getName() else result = ret:getName() end else if size > 20 then reward = Game.createItem(item.itemid, 1) elseif size > 8 then reward = Game.createItem(2854, 1) else reward = Game.createItem(2853, 1) end for i = 1, size do local tmp = items[i] if reward:addItemEx(tmp) ~= RETURNVALUE_NOERROR then Spdlog.warn("[questSystem1.onUse] - Could not add quest reward to container") end end local ret = ItemType(reward.itemid) result = ret:getArticle() .. ' ' .. ret:getName() end if player:addItemEx(reward) ~= RETURNVALUE_NOERROR then local weight = reward:getWeight() if player:getFreeCapacity() < weight then player:sendCancelMessage(string.format('You have found %s weighing %.2f oz. You have no capacity.', result, (weight / 100))) else player:sendCancelMessage('You have found ' .. result .. ', but you have no room to take it.') end return true end if questsExperience[storage] then player:addExperience(questsExperience[storage], true) end if questLog[storage] then player:setStorageValue(questLog[storage], 1) end if tutorialIds[storage] then player:sendTutorial(tutorialIds[storage]) if item.uid == 50080 then player:setStorageValue(Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage, 3) end end if isInArray(hotaQuest, item.uid) then if player:getStorageValue(Storage.TheAncientTombs.DefaultStart) ~= 1 then player:setStorageValue(Storage.TheAncientTombs.DefaultStart, 1) end end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. result .. '.') player:setStorageValue(storage, 1) return true end for index, value in pairs(specialQuests) do questSystem1:aid(index) end questSystem1:aid(2000) questSystem1:register()  
    • Por Anderson Sacani
      Bom dia!
      Estava de bobeira agora pela manhã e resolvi brincar um pouco.
      Criei um script de SD no qual se for noite, ela retornará um valor X de dano, e, se for dia, ela retornará um valor Y de dano.
      Estou compartilhando esse script para vocês terem como base e usarem até mesmo em outros:
       
      local config = { damageDay = { min = 0.70, max = 0.75 }, damageNight = { min = 0.95, max = 1 }, hourStartDay = 6, hourEndDay = 18 } local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) function onGetFormulaValues(player, level, maglevel) local min, max = ((level / 5) + (maglevel * 4.605)), ((level / 5) + (maglevel * 7.395)) local hour = tonumber(os.date("%H", os.time())) -- Obtém a hora atual -- Define o valor do dano com base na hora do dia if hour >= config.hourStartDay and hour < config.hourEndDay then -- Dia min = min * config.damageDay.min max = max * config.damageDay.max else -- Noite min = min * config.damageNight.min max = max * config.damageNight.max end return -min, -max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") local rune = Spell("rune") function rune.onCastSpell(creature, var, isHotkey) return combat:execute(creature, var) end rune:group("attack") rune:name("sudden death rune") rune:runeId(3155) rune:allowFarUse(true) rune:charges(3) rune:level(45) rune:magicLevel(15) rune:cooldown(2 * 1000) rune:groupCooldown(2 * 1000) rune:needTarget(true) rune:isBlocking(true) -- True = Solid / False = Creature rune:register()  
    • Por amoxicilina
      Olá Kings, venho aqui trazer uma TalkAction pra você comprar premium account, sei que pode ser algo meio inútil por existir a store.
      Então vamos script:
       
       
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo