RevScript [TFS 1.3] Task System + Points + Rankings

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Hola a todos,

Antes que nada, exactamente créditos no tengo para este script, son partes que hé ido cogiendo por aqui por alla hasta conseguir a montar este script para el sistema Ancestral Task Con Puntos / Ranking , para Hellgrave v6.0.
Script TFS 1.3 revscript

Este script Comporta:

  • Un Npc que da Tasks ( diarias y normales ), al completarlas, da Puntos , puntos de ranking ( subir nivel ), reward.
  • Los puntos pueden ser utilizados para dar Acceso a un lugar, ejemplo, entrar en un spawn retirar 1 punto, o acceso a un boss, etc.
  • Permite ver encima de cada jugar , su ranking al darle click encima.
Cada script, ustedes lo modifican como gusten, nombre , archivo al cual va link, looktype, textos, monstruos , puntos...

Empezaremos con el NPC, crearemos un NPC en data/npc lo llamáis como gustáis y pondremos:


Código Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Lord The Rifter" script="ancestral_tasker.lua" walkinterval="1100" speed="120" walkradius="5" floorchange="0">
<health now="150" max="150"/>
<look type="1633"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. I'm in charge of delivering Ancestral's Missions to the players. Would you like to do a {normal} task, {daily} task, {receive} your reward from a task or {abandon} a task ? You can also see the {normal ancestral task list} and the {daily ancestral task list}."/>
<parameter key="message_farewell" value="See you later." />
        <parameter key="message_walkaway" value="See you later." />
        </parameters>
</npc>

Despues en data/npc/scripts agregaremos esto en un archivo lua con el mismo nombre que hemos indicado en el script anterior:

Código Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end

npcHandler:addModule(FocusModule:new())

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
local player = Player(cid)
local msg = msg:lower()
------------------------------------------------------------------
if npcHandler.topic[cid] == 0 and msg == 'normal' then
    npcHandler:say("Great. Which monster task would you like to do ? Write the name of the task.", cid)
    npcHandler.topic[cid] = 1
elseif npcHandler.topic[cid] == 1 then
    if player:getStorageValue(task_sto_time) < os.time() then
        if player:getStorageValue(task_storage) == -1 then
            for mon, l in ipairs(task_monsters) do
                if msg == l.name then
                    npcHandler:say("Okay, you're now doing the {"..l.name:gsub("^%l", string.upper).."} task,  you need to kill "..l.amount.." of them. Come back when you finish!", cid)
                    player:setStorageValue(task_storage, mon)
                    player:setStorageValue(l.storage, 0)
                    npcHandler.topic[cid] = 0
                    break
                elseif mon == #task_monsters then
                    npcHandler:say("Sorry but we don't have this task. Please check the {normal ancestral task list} or the {daily ancestral task list}", cid)
                    npcHandler.topic[cid] = 0
                end
            end
        else
            npcHandler:say("You're already doing a task. You can only do one at a time. Say {!ancestral} to see information about your current task.", cid)
            npcHandler.topic[cid] = 0
        end
    else
        npcHandler:say("I'm not allowed to give you any task because you have abandoned the previous one. Wait for the "..task_time.." hours of punishment to end.", cid)
        npcHandler.topic[cid] = 0
    end
elseif npcHandler.topic[cid] == 0 and msg == 'daily' then
    if player:getStorageValue(time_daySto) < os.time() then
        npcHandler:say("Remember, it is of great importance that the daily tasks are done. Now tell me, which monster task would you like to do? Write the name of the task.", cid)
        npcHandler.topic[cid] = 2
    else
        npcHandler:say('You have completed a daily task today, expect to spend as 24 hours to do it again. You can do {normal} task and check the list here: {normal ancestral tasks list}.', cid)
        npcHandler.topic[cid] = 0
    end
elseif npcHandler.topic[cid] == 2 then
    if player:getStorageValue(task_sto_time) < os.time() then
        if player:getStorageValue(taskd_storage) == -1 then
            for mon, l in ipairs(task_daily) do
                if msg == l.name then
                    npcHandler:say("Very well, you're now doing the daily {"..l.name:gsub("^%l", string.upper).."} task, you need to kill "..l.amount.." of them. Come back when you finish!", cid)
                    player:setStorageValue(taskd_storage, mon)
                    player:setStorageValue(l.storage, 0)
                    npcHandler.topic[cid] = 0
                    break
                elseif mon == #task_daily then
                    npcHandler:say("Sorry we don't have this daily task. Please check the list {daily ancestral task list}.", cid)
                    npcHandler.topic[cid] = 0
                end
            end
        else
            npcHandler:say("You're already doing a daily task. You can only do one per day. Say {!ancestral} to see information about your current task.", cid)
            npcHandler.topic[cid] = 0
        end
    else
        npcHandler:say("I'm not allowed to give you any task because you have abandoned the previous one. Wait for the "..task_time.." hours of punishment to end.", cid)
        npcHandler.topic[cid] = 0
    end
elseif msg == 'receive' then
    if npcHandler.topic[cid] == 0 then
        npcHandler:say("What kind of task did you finish, {normal} or {daily} ?", cid)
        npcHandler.topic[cid] = 3
    end
elseif npcHandler.topic[cid] == 3 then
    if msgcontains(msg, 'normal') then
    local ret_t = getTaskInfos(player)
        if ret_t then
            if player:getStorageValue(ret_t.storage) == ret_t.amount then
                local pt1 = ret_t.pointsTask[1]
                local pt2 = ret_t.pointsTask[2]
                local txt = 'Thanks for finishing the task, your rewards are: '..(pt1 > 1 and pt1..' ancestral points' or pt1 <= 1 and pt1..' ancestral point')..' and '..(pt2 > 1 and pt2..' ancestral rank points' or pt2 <= 1 and pt2..' ancestral rank point')..', '
                if #getItemsFromTable(ret_t.items) > 0 then
                    txt = txt..'in addition: '..getItemsFromTable(ret_t.items)..', '
                for g = 1, #ret_t.items do
                    player:addItem(ret_t.items[g].id, ret_t.items[g].count)
                end
                end

                local exp = ret_t.exp
                if exp > 0 then
                    txt = txt..'I will also give you '..exp..' experience, '
                    player:addExperience(exp)
                end

                taskPoints_add(player, pt1)
                taskRank_add(player, pt2)
                player:setStorageValue(ret_t.storage, -1)
                player:setStorageValue(task_storage, -1)
                npcHandler:say(txt..'thanks again and see you again!', cid)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say('You have not finished your current task yet. You will receive it when you finish.', cid)
                npcHandler.topic[cid] = 0
            end
        else
            npcHandler:say("You aren't doing any tasks. Please check the list {normal ancestral task list} or {daily ancestral task list} in order to start a task and ask me for a {normal} or {daily} ancestral task.", cid)
            npcHandler.topic[cid] = 0
        end
    elseif npcHandler.topic[cid] == 3 and msg == 'daily' then
        if player:getStorageValue(time_daySto)-os.time() <= 0 then
        local ret_td = getTaskDailyInfo(player)
            if ret_td then
                if getTaskDailyInfo(player) then
                    if player:getStorageValue(getTaskDailyInfo(player).storage) == getTaskDailyInfo(player).amount then
                    local pt1 = getTaskDailyInfo(player).pointsTask[1]
                    local pt2 = getTaskDailyInfo(player).pointsTask[2]
                    local txt = 'Thanks for finishing the task, your rewards are: '..(pt1 > 1 and pt1..' ancestral points' or pt1 <= 1 and pt1..' ancestral point')..' e '..(pt2 > 1 and pt2..' ancestral rank points' or pt2 <= 1 and pt2..' ancestral rank point')..', '
                        if #getTaskDailyInfo(player).items > 0 then
                            txt = txt..'in addition: '..getItemsFromTable(getTaskDailyInfo(player).items)..', '
                        for g = 1, #getTaskDailyInfo(player).items do
                            player:addItem(getTaskDailyInfo(player).items[g].id, getTaskDailyInfo(player).items[g].count)
                        end
                        end
                        local exp = getTaskDailyInfo(player).exp
                        if exp > 0 then
                            txt = txt..'I will also give you '..exp..' experience, '
                            player:addExperience(exp)
                        end
                        npcHandler:say(txt..' thanks again and see you again!', cid)
                        taskPoints_add(player, pt1)
                        taskRank_add(player, pt2)
                        player:setStorageValue(getTaskDailyInfo(player).storage, -1)
                        player:setStorageValue(taskd_storage, -1)
                        player:setStorageValue(time_daySto, 1*60*60*24+os.time())
                        npcHandler.topic[cid] = 0
                    else
                        npcHandler:say('You have not finished your current task yet. You will receive it when you finish.', cid)
                        npcHandler.topic[cid] = 0
                    end
                else
                    npcHandler:say("You aren't doing any tasks. Please check the list {normal ancestral task list} or {daily ancestral task list} in order to start a task and ask me for a {normal} or {daily} ancestral task.", cid)
                    npcHandler.topic[cid] = 0
                end
            end
        else
            npcHandler:say("You've done a daily task, wait 24 hours to do another one again, you can do a {normal} ancestral task, check {normal ancestral task list} if needed.", cid)
            npcHandler.topic[cid] = 0
        end
    end

elseif msg == 'abandon' then
    if npcHandler.topic[cid] == 0 then
        npcHandler:say("What kind of task do you want to quit, {normal} or {daily}?", cid)
        npcHandler.topic[cid] = 4
    end
elseif npcHandler.topic[cid] == 4 and msgcontains(msg, 'normal') then
    local ret_t = getTaskInfos(player)
    if ret_t then
        npcHandler:say('Unfortunate this situation, had faith that you would bring me this task done, but I was wrong. As punishment will be '..task_time..' hours without being able to do again a task.', cid)
        player:setStorageValue(task_sto_time, os.time()+task_time*60*60)
        player:setStorageValue(ret_t.storage, -1)
        player:setStorageValue(task_storage, -1)
        npcHandler.topic[cid] = 0
    else
        npcHandler:say("You're not doing any task to be able to abandon it.", cid)
        npcHandler.topic[cid] = 0
    end
elseif npcHandler.topic[cid] == 4 and msg == 'daily' then
    local ret_td = getTaskDailyInfo(player)
    if ret_td then
        npcHandler:say('Unfortunate this situation, had faith that you would bring me this task done, but I was wrong. As punishment will be '..task_time..' hours without being able to do again a task.', cid)
        player:setStorageValue(task_sto_time, os.time()+task_time*60*60)
        player:setStorageValue(ret_td.storage, -1)
        player:setStorageValue(taskd_storage, -1)
        npcHandler.topic[cid] = 0
    else
        npcHandler:say("You're not doing any daily tasks to be able to abandon it.", cid)
        npcHandler.topic[cid] = 0
    end
elseif msg == "normal ancestral task list" then
    local text = "          Normal Ancestral Tasks               \n\n"
        for _, d in pairs(task_monsters) do
            text = text .."Task Name: ["..d.name.."]\nMonsters: "..d.monsters..".\n- Amount: ["..(player:getStorageValue(d.storage) + 1).."/"..d.amount.."]\n- Reward: "..(#d.items > 1 and getItemsFromTable(d.items).."" or "\n").."\n"..d.exp.." experience \n\n"
        end

        player:showTextDialog(33319, "" .. text)
        npcHandler:say("Here is the list of normal ancestral tasks.", cid)
elseif msg == "daily ancestral task list" then
    local text = "          Daily Ancestral Tasks               \n\n"
        for _, d in pairs(task_daily) do
            text = text .."Task Name: ["..d.name.."]\nMonsters: "..d.monsters..".\n- Amount: ["..(player:getStorageValue(d.storage) + 1).."/"..d.amount.."]\n- Reward: "..(#d.items > 1 and getItemsFromTable(d.items).."" or "\n").."\n"..d.exp.." experience \n\n"
        end

        player:showTextDialog(33319, "" .. text)
        npcHandler:say("Here is the daily ancestral tasks list.", cid)
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

Iremos en data/lib abriremos el lib.lua y agregaremos:
Código Lua:
dofile('data/lib/custom/task.lua')

Nos iremos en data/lib/custom y crearemos un archivo lib llamado task.lua pondremos esto:
No olviden modificar,

Name = Nombre de texto que le diremos al NPC de la task
Mons_List = Nombre de monstruos, separados por comas
Storage = Siempre distinta y no utilizada por ninguna otra
Amount = Cantidad de monstruos que matar
Exp = Cantidad de experiencia
PointsTask = La primera cifra es la cantidad de puntos ( que podran ser retirados usando otro script onStepIn, onUse u de otra forma )
La segunda cifra es la cantidad de puntos para subir en ranking ( veran mas abajo )
Items = Items reward

Las storages, las pueden dejar como estan, en teoria ninguna de esas es utilizada.

Local rank_task = Aqui vienen los rangos, y delante del nombre la cantidad de puntos necessarios para este rango, 1, 25, serian entonces el rango Rookie hasta 25 puntos.


Código Lua:
task_monsters = {
    [1] = {name = "raging demons", mons_list = {"demon"}, storage = 400029, amount = 300, exp = 20000000, pointsTask = {1, 2}, items = {{id = 2472, count = 1},{id = 2470, count = 1}, {id = 7393, count = 1}, {id = 2160, count = 10} }, monsters = "Kill Demons around the world."},
    [2] = {name = "fire dragons", mons_list = {"dragon", "dragon lord"}, storage = 400030, amount = 450, exp = 8500000, pointsTask = {1, 2}, items = {{id = 7399, count = 1}, {id = 7402, count = 1}, {id = 2160, count = 4 }}, monsters = "Kill Dragons and Dragon lords around the world."},
    [3] = {name = "silence mountain", mons_list = {"frazzlemaw", "silencer"}, storage = 400033, amount = 300, exp = 15000000, pointsTask = {1, 2}, items = {{id = 22396, count = 1}, {id = 2160, count = 10}, {id = 18429, count = 10}, {id = 18421, count = 10}}, monsters = "Kill Frazzlemaws and Silencers."},
    [4] = {name = "fear valley", mons_list = {"retching Horror", "choking Fear"}, storage = 400034, amount = 500, exp = 25000000, pointsTask = {2, 3}, items = {{id = 22396, count = 2}, {id = 21308, count = 1}, {id = 10073, count = 1}, {id = 10075, count = 1}, {id = 10096, count = 1}}, monsters = "Kill Retching Horrors and Choking Fear."},
    [5] = {name = "poison combo", mons_list = {"hydra", "serpent spawn"}, storage = 400035, amount = 500, exp = 15000000, pointsTask = {1, 2}, items = {{id = 24807, count = 3}, {id = 33983, count = 3}, {id = 13582, count = 1}, {id = 13569, count = 1}, {id = 13165, count = 1}, {id = 13166, count = 1}}, monsters = "Kill Hydras and Serpent Spawn."},
    [6] = {name = "cobras", mons_list = {"cobra assassin", "cobra scout", "cobra vizier"}, storage = 400038, amount = 500, exp = 35000000, pointsTask = {2, 3}, items = {{id = 42081, count = 1}}, monsters = "Kill Cobras on Cobra Bastion."},
    [7] = {name = "falcons", mons_list = {"falcon knight", "falcon paladin"}, storage = 400039, amount = 500, exp = 35000000, pointsTask = {2, 3}, items = {{id = 25312, count = 1}}, monsters = "Kill Falcons on Falcon Bastion."},
    [8] = {name = "reapers", mons_list = {"grim reaper"}, storage = 400040, amount = 300, exp = 16500000, pointsTask = {1, 2}, items = {{id = 41995, count = 60}, {id = 41944, count = 5}}, monsters = "Kill Grim Reapers."},
    [9] = {name = "catacombs", mons_list = {"demon", "dark torturer", "juggernaut", "hellhound", "destroyer", "hellspawn"}, storage = 400041, amount = 750, exp = 50000000, pointsTask = {2, 4}, items = {{id = 12671, count = 1}, {id = 13560, count = 3}}, monsters = "Kill Demons, Hellhounds, Juggernaut, Destroyers, Hellspawn and Dark Torturers."},
    [10] = {name = "wyrms", mons_list = {"wyrm", "elder wyrm"}, storage = 400042, amount = 400, exp = 9500000, pointsTask = {1, 2}, items = {{id = 2160, count = 5},{id = 4867, count = 5}, {id = 4855, count = 5}, {id = 14336, count = 3}}, monsters = "Kill Demons, Hellhounds, Juggernaut, Destroyers, Hellspawn and Dark Torturers."},
    [11] = {name = "slugs task", mons_list = {"fallen shaman [1]", "tyrant slug [1]", "small slug [1]"},  storage = 400000, amount = 300, exp = 6500000, pointsTask = {0, 1}, items = {{id = 42027, count = 1}, {id = 7705, count = 10}, {id = 5089, count =  10}, {id = 7736, count = 10}, {id = 7844, count = 10}}, monsters = "Fallen Shaman [1], Tyrant Slug [1] and Small Slug [1]"},
    [12] = {name = "plants task", mons_list = {"atlantis manta [1]", "carnivor plant [1]", "deathrattle [1]"}, storage = 400001, amount = 300, exp = 6500000, pointsTask = {0, 1}, items = {{id = 42027, count = 1}, {id = 4854, count = 10}, {id = 7846, count = 10}, {id = 4851, count = 10}, {id = 4853, count = 10}}, monsters = "Atlantis Manta [1], Carnivor Plant [1] and Deathrattle [1]"},
    [13] = {name = "trolls task", mons_list = {"demon hunter [1]", "giant troll [1]"}, storage = 400002, amount = 300, exp = 8825000, pointsTask = {0, 1}, items = {{id = 42027, count = 1}, {id = 4872, count = 10}, {id = 4858, count = 10}, {id = 42051, count = 5}}, monsters = "Demon Hunter [1] and Giant Troll [1]"},
    [14] = {name = "fallens task", mons_list = {"eastern shaman [1]", "fallen rhino [1]"}, storage = 400003, amount = 300, exp = 8825000, pointsTask = {0, 1}, items = {{id = 42027, count = 1}, {id = 6105, count = 10},  {id = 6556, count = 10}, {id = 7245, count = 10}, {id = 7243, count = 10}}, monsters = "Eastern Shaman [1] and Fallen Rhino [1]"},
    [15] = {name = "sacreds task", mons_list = {"sacred hydra [2]", "sacred three [2]", "tyrant three [2]"}, storage = 400004, amount = 300, exp = 11775000, pointsTask = {0, 1}, items = {{id = 42027, count = 1}, {id = 8707, count = 10},  {id = 8701, count = 10}, {id = 10100, count = 10}, {id = 2630, count = 10}}, monsters = "Sacred Hydra [2], Sacred Three [2], Tyrant Three [2]"},
    [16] = {name = "on fire task", mons_list = {"demon hunter [2]", "evil hydra [2]", "inferno hydra [2]"}, storage = 400005, amount = 300, exp = 14275000, pointsTask = {0, 1}, items = {{id = 42027, count = 2}, {id = 13130, count = 75}, {id = 12803, count = 50}, {id = 36039, count = 15}}, monsters = "Demon Hunter [2], Evil Hydra [2] and Inferno Hydra [2]"},
    [17] = {name = "warcaller task", mons_list = {"slime of terror [2]", "warcaller [2]"}, storage = 400006, amount = 300, exp = 17775000, pointsTask = {0, 1}, items = {{id = 42027, count = 2}, {id = 12804, count = 35}, {id = 12805, count = 20}, {id = 36041, count = 10}}, monsters = "Slime of Terror [2] and Warcaller [2]"},
    [18] = {name = "enraged task", mons_list = {"enraged rat [2]", "shamed tree [2]", "venom tyrant [2]"}, storage = 400007, amount = 300, exp = 17775000, pointsTask = {0, 1}, items = {{id = 42027, count = 2}, {id = 36038, count = 20}, {id = 36040, count = 10}}, monsters = "Enraged Rat [2], Shamed Tree [2], Venom Tyrant [2]"},
    [19] = {name = "kings task", mons_list = {"damned soul [**]", "king skeleton [**]", "oculus rift [**]"}, storage = 400008, amount = 500, exp = 100000000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 39178, count = 10}, {id = 39179, count = 10}, {id = 13560, count = 3},  {id = 7861, count = 20}, {id = 7869, count = 20}}, monsters = "Damned Soul [**], King Skeleton [**] and Oculus Rift [**]"},
    [20] = {name = "dismembered task", mons_list = {"disemboweled [**]", "shaper of flesh [**]", "unspeakable terror [**]"}, storage = 400009, amount = 500, exp = 100000000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 21308, count = 1}, {id = 42054, count = 2}, {id = 13560, count = 3}, {id = 7877, count = 20}, {id = 7745, count = 20}}, monsters = "Disemboweled [**], Shaper of Flesh [**] and Unspeakable Terror [**]"},
    [21] = {name = "malfeasance task", mons_list = {"lurkbringer [**]", "malfeasance [**]", "mangler [**]"}, storage = 400010, amount = 500, exp = 100000000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 42103, count = 10}, {id = 42104, count = 5}, {id = 42105, count = 1}, {id = 13560, count = 3}, {id = 7753, count = 20}, {id = 7869, count = 20}}, monsters = "Lurkbringer [**], Malfeasance [**] and Mangler [**]"},
    [22] = {name = "wormboiler task", mons_list = {"dark elder [***]", "wormboiler [***]"}, storage = 400011, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 41670, count = 5}, {id = 33973, count = 5}, {id = 36936, count = 1}}, monsters = "Dark Elder [***] and Wormboiler [***]"},
    [23] = {name = "evils task", mons_list = {"evil beholder [***]", "evil demon [***]"}, storage = 400012, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 37419, count = 3}, {id = 33975, count = 3}, {id = 36936, count = 1}}, monsters = "Evil Beholder [***] and Evil Demon [***]"},
    [24] = {name = "gores task", mons_list = {"goreshot [***]", "zarhym [***]"}, storage = 400013, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 34822, count = 1}, {id = 32446, count = 10}, {id = 42075, count = 20}, {id = 36936, count = 1}}, monsters = "Goreshot [***] and Zarhym [***]"},
    [25] = {name = "scourge task", mons_list = {"scourge of azazel [***]", "tyrant spider [***]"}, storage = 400014, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 42074, count = 5}, {id = 42106, count = 5}, {id = 32757, count = 5}, {id = 36936, count = 1}}, monsters = "Scourge of Azazel [***] and Tyrant Spider [***]"},
    [26] = {name = "elder dragons task", mons_list = {"elder dragon lord [***]", "elder dragon [***]"}, storage = 400015, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 41945, count = 1}, {id = 36936, count = 1}}, monsters = "Elder Dragon Lord [***] and Elder Dragon [***]"},
    [27] = {name = "soul task", mons_list = {"rust crawler [***]", "soul skull [***]"}, storage = 400016, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 33983, count = 10}, {id = 24807, count = 5}, {id = 21309, count = 2}, {id = 36936, count = 1}}, monsters = "Rust Crawler [***], Soul Skull [***]"},
    [28] = {name = "black task", mons_list = {"black dragon [***]", "stone juggernaut [***]"}, storage = 400017, amount = 600, exp = 270000000, pointsTask = {2, 4}, items = {{id = 42027, count = 2}, {id = 25312, count = 2}, {id = 25316, count = 1}, {id = 36936, count = 1}}, monsters = "Black Dragon [***] and Stone Juggernaut [***]"},
    [29] = {name = "normal arkeron", mons_list = {"arcangel [****]", "cephalopod [****]", "divine angel [****]", "lokness [****]", "otzi [****]", "raven spider [****]", "solar guardian [****]"}, storage = 400018, amount = 1000, exp = 650000000, pointsTask = {5, 8}, items = {{id = 42027, count = 5}, {id = 24275, count = 5}, {id = 13565, count = 5}, {id = 36989, count = 3}, {id = 18559, count = 5}}, monsters = "All normal monsters on Arkeron \n  ( not Mutateds, not Amalgam, not Anomaly) with 4 Stars."},
    [30] = {name = "mutated arkeron", mons_list = {"mutated angry draptor [****]", "mutated draptor [****]", "mutated ghost [****]", "mutated lurkbringer lancer [****]", "mutated lurkbringer necromancer [****]", "mutated lurkbringer warrior [****]", "mutated lurkbringer [****]", "mutated scourge draptor [****]", "mutated stone golem [****]", "mutated wailing widow [****]"}, storage = 400019, amount = 1000, exp = 800000000, pointsTask = {5, 8}, items = {{id = 25315, count = 1}, {id = 24275, count = 5}, {id = 13565, count = 5}, {id = 25939, count = 3}, {id = 25936, count = 5}, {id = 18559, count = 5}}, monsters = "All mutateds monsters from Arkeron with 4 Stars."},
    [31] = {name = "amalgam arkeron", mons_list = {"behemoth amalgam [****]", "demon amalgam [****]", "despair tree amalgam [****]", "dragon amalgam [****]", "emeraude dragon amalgam [****]", "ghost hell amalgam [****]", "grim reaper amalgam [****]", "hellfire fighter amalgam [****]", "hydra amalgam [****]", "obsidian dragon amalgam [****]", "sapphir dragon amalgam [****]", "stone golem amalgam [****]", "tyrant tree amalgam [****]", "vampire viscount amalgam [****]", "winter wolf amalgam [****]", "yeti amalgam [****]"}, storage = 400020, amount = 1000, exp = 950000000, pointsTask = {5, 8}, items = {{id = 42027, count = 5}, {id = 24275, count = 5}, {id = 13565, count = 5}, {id = 37006, count = 10}, {id = 37007, count = 6}, {id = 18559, count = 5}}, monsters = "All Amalgam monsters from Arkeron with 4 Stars."},
    [32] = {name = "anomaly arkeron", mons_list = {"amazon anomaly [****]", "chester anomaly [****]", "demon anomaly [****]", "dragon anomaly [****]", "ghost anomaly [****]", "ghoul anomaly [****]", "hydra anomaly [****]", "mage anomaly [****]", "ulyss anomaly [****]", "undead berserker anomaly [****]", "undead elite guardian anomaly [****]", "undead elite mage anomaly [****]", "undead guardian anomaly [****]", "valkyrie anomaly [****]"}, storage = 400021, amount = 1000, exp = 1125000000, pointsTask = {5, 8}, items = {{id = 42027, count = 5}, {id = 24275, count = 5}, {id = 13565, count = 5}, {id = 25976, count = 10}, {id = 25979, count = 6}, {id = 25948, count = 10}, {id = 25951, count = 5}, {id = 18559, count = 5}}, monsters = "All Anomaly monsters from Arkeron with 4 Stars."},
}
 
 task_daily = {
    [1] = {name = "plagirath", mons_list = {"plagirath"}, storage = 400031, amount = 1, exp = 12500000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 10131, count = 5}, {id = 12790, count = 1}, {id = 12793, count = 1}, {id = 12796, count = 1}}, monsters = "Kill Plagirath."},
    [2] = {name = "ushuriel", mons_list = {"ushuriel"}, storage = 400032, amount = 1, exp = 9000000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 10129, count = 5}, {id = 12787, count = 1}, {id = 12793, count = 1}, {id = 12976, count = 1}}, monsters = "Kill Ushuriel."},
    [3] = {name = "tentuglys", mons_list = {"tentuglys boss"}, storage = 400036, amount = 1, exp = 12500000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 42053, count = 2}, {id = 13560, count = 3}, {id = 2629, count = 1}}, monsters = "Kill Tentuglys."},
    [4] = {name = "the king", mons_list = {"king zelos"}, storage = 400037, amount = 1, exp = 17500000, pointsTask = {1, 2}, items = {{id = 42027, count = 2}, {id = 37419, count = 1}, {id = 33973, count = 1}, {id = 33975, count = 1}}, monsters = "Kill King Zelos."},
    [5] = {name = "megalomania", mons_list = {"goshnar megalomania"}, storage = 400043, amount = 1, exp = 25500000, pointsTask = {1, 2}, items = {{id = 42027, count = 3}, {id = 34822, count = 1}, {id = 39178, count = 5}, {id = 39179, count = 5}}, monsters = "Kill Goshnar Megalomania."},
    [6] = {name = "bahamut", mons_list = {"bahamut [*****]"}, storage = 400022, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill Bahamut [*****] Boss on Arkeron."},
    [7] = {name = "dracafeu", mons_list = {"dracafeu [*****]"}, storage = 400023, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill Dracafeu [*****] Boss on Arkeron."},
    [8] = {name = "ghazrilla", mons_list = {"gahz'rilla [*****]"}, storage = 400024, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill Ghaz'rilla [*****] Boss on Arkeron."},
    [9] = {name = "lost terror", mons_list = {"lost terror [*****]"}, storage = 400025, amount = 1, exp = 1000000000, pointsTask = {5, 10}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 10}, {id = 13565, count = 10}}, monsters = "Kill Lost Terror [*****] Boss on Arkeron."},
    [10] = {name = "onyxia", mons_list = {"onyxia [*****]"}, storage = 400026, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill Onyxia [*****] Boss on Arkeron."},
    [11] = {name = "the monster", mons_list = {"the monster [*****]"}, storage = 400027, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill The Monster [*****] Boss on Arkeron."},
    [12] = {name = "ultros", mons_list = {"ultros [*****]"}, storage = 400028, amount = 1, exp = 500000000, pointsTask = {3, 5}, items = {{id = 42027, count = 10}, {id = 25932, count = 1}, {id = 27605, count = 1}, {id = 11400, count = 10}, {id = 24275, count = 5}, {id = 13565, count = 5}}, monsters = "Kill Ultros [*****] Boss on Arkeron."}
}
 
 task_storage = 480000
 task_points = 480001
 task_sto_time = 480002
 task_time = 1
 task_rank = 480003
 taskd_storage = 480004
 time_daySto = 480005
 awakening_points = 480006
 chaos_points = 480007
 
 
 local ranks_task = {
 [{1, 25}] = "Rookie",
 [{26, 100}] = "Bronze",
 [{101, 250}] = "Silver",
 [{251, 470}] = "Gold",
 [{471, 770}] = "Platinum",
 [{771, 1220}] = "Diamond",
 [{1221, 1820}] = "Ancestral",
 [{1821, 2820}] = "Mystic",
 [{2821, 4320}] = "Abyssal",
 [{4321, 6320}] = "Ascending",
 [{6321, 9999}] = "Chaos",
 [{10000, math.huge}] = "Awakening"
 }
 
 local RankSequence = {
 ["Rookie"] = 1,
 ["Bronze"] = 2,
 ["Silver"] = 3,
 ["Gold"] = 4,
 ["Platinum"] = 5,
 ["Diamond"] = 6,
 ["Ancestral"] = 7,
 ["Mystic"] = 8,
 ["Abyssal"] = 9,
 ["Ascending"] = 10,
 ["Chaos"] = 11,
 ["Awakening"] = 11
 }
 
 function rankIsEqualOrHigher(myRank, RankCheck)
     local ret_1 = RankSequence[myRank]
     local ret_2 = RankSequence[RankCheck]
     return ret_1 >= ret_2
 end
 
 function getTaskInfos(player)
     local player = Player(player)
     return task_monsters[player:getStorageValue(task_storage)] or false
 end
 
 function getTaskDailyInfo(player)
     local player = Player(player)
     return task_daily[player:getStorageValue(taskd_storage)] or false
 end
 
 
 function taskPoints_get(player)
     local player = Player(player)
     if player:getStorageValue(task_points) == -1 then
         return 0
     end
     return player:getStorageValue(task_points)
 end



 function taskPoints_add(player, count)
     local player = Player(player)
     return player:setStorageValue(task_points, taskPoints_get(player) + count)
 end
 
 function taskPoints_remove(player, count)
     local player = Player(player)
     return player:setStorageValue(task_points, taskPoints_get(player) - count)
 end
 
 function taskRank_get(player)
     local player = Player(player)
     if player:getStorageValue(task_rank) == -1 then
         return 1
     end
     return player:getStorageValue(task_rank)
 end
 
 function taskRank_add(player, count)
     local player = Player(player)
     return player:setStorageValue(task_rank, taskRank_get(player) + count)
 end
 
 function getRankTask(player)
     local pontos = taskRank_get(player)
     local ret
     for _, z in pairs(ranks_task) do
         if pontos >= _[1] and pontos <= _[2] then
             ret = z
         end
     end
     return ret
 end
 
 function getItemsFromTable(itemtable)
      local text = ""
      for v = 1, #itemtable do
          count, info = itemtable[v].count, ItemType(itemtable[v].id)
          local ret = "\n   - "
          if v == 1 then
              ret = ""
          elseif v == #itemtable then
              ret = "\n   - "
          end
          text = text .. ret
          text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
      end
      return text
 end

Nos iremos en el archivo , data/events/scripts/player.lua, buscaremos por:
Código Lua:
function Player:onLook(thing, position, distance)

Debajo en una parte libre, agregaremos:

Código Lua:
if thing:isCreature() then
        if thing:isPlayer() then
            description = string.format("%s\n Ancestral Rank: "..getRankTask(thing), description)
        end
    end

Ahora nos iremos en data/scripts/talkaction/players y crearemos una talkaction pondremos este codigo:

Código Lua:
local ancestralTalkAction = TalkAction("!ancestral")

function ancestralTalkAction.onSay(player, words, param)
   
    local text = '               Ancestral Tasks Information               \n\n - Ranking: '..getRankTask(player)..'.\n - Ancestral Rank Points: '..taskRank_get(player)..'.\n\n                                 Points                                          \n\n - Ancestral Points: '..taskPoints_get(player)..'.'
    local ret_t = getTaskInfos(player)
   
    if ret_t then
        text = text .. '\n\n                     Normal Ancestral Task               \n      \n- Current Task: '..ret_t.name..'. \n- Monsters: '..ret_t.monsters..'. \n- Progress: ['..(player:getStorageValue(ret_t.storage))..'/'..ret_t.amount..'] killed.\n- Rewards:\n   - '..getItemsFromTable(ret_t.items)..'\n   - '..ret_t.pointsTask[1]..' Ancestral Points\n   - '..ret_t.pointsTask[2]..' Ancestral Rank Points. \n- Task Status: '..(player:getStorageValue(ret_t.storage) == ret_t.amount and 'Complete' or 'Incomplete')..'!'           
    else
        text = text .. "\n\n                     Normal Ancestral Task               \n      \n    You aren't doing any Normal Ancestral Task."
    end
    local ret_td = getTaskDailyInfo(player)
    if ret_td then
        text = text .. '\n\n\n                     Daily Ancestral Task               \n      \n- Current Task: '..ret_td.name..'. \n- Monsters: '..ret_td.monsters..'.  \n- Progress: ['..(player:getStorageValue(ret_td.storage))..'/'..ret_td.amount..'] killed.\n- Rewards:\n   - '..getItemsFromTable(ret_td.items)..'\n   - '..ret_td.pointsTask[1]..' Ancestral Points\n   - '..ret_td.pointsTask[2]..' Ancestral Rank Points. \n- Task Status: '..(player:getStorageValue(ret_td.storage) == ret_td.amount and 'Complete' or 'Incomplete')..'!'        
    else
        text = text .. "\n\n\n                     Daily Ancestral Task               \n      \n    You aren't doing any Daily Ancestral Task."
    end
    return false,  player:popupFYI(text)
end
ancestralTalkAction:register()


Con esto, tendremos un Sistema de Ranking que funciona con Tasks y Puntos.
(Ps, hé borrado codigos de Awakening y Chaos Points, si quedo alguno, no se preocupen pueden borrar la linea, en el caso que desean utilizarlo, pueden descargar el Hellgrave v6.0 que lo tiene dentro y pueden ir en cada acceso como indicado aqui en este tema y encontraran los archivos )


Como retirar puntos,
Aqui les dejo un ejemplo de un acesso por Tile, para llegar en algun Spawn, zona de Boss y que retira Puntos:
En el ejemplo es un onStepIn, significa que al pisar una Tile o bien un TP que tenga la ActionID indicada en el script, podran ir a esa zona,
Comporta 2 ActionID, la primera es para ir a la zona y quitara puntos, la segunda es para volver sin que quite puntos,

Código Lua:
local entrance = MoveEvent()

function entrance.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end
    local configStorages = {
        rank = "Gold",
        points_need = 5,
        removePoints =  true
    }
    if item:getActionId() == 27523 then
        if rankIsEqualOrHigher(getRankTask(creature), configStorages.rank) and taskPoints_get(creature) >= 5 then
            player:teleportTo(Position(32874, 32405, 8))
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            if configStorages.removePoints then
                taskPoints_remove(creature, configStorages.points_need)
            end
            return true
        else
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
            player:teleportTo(Position(32601, 31823, 8))
            player:sendTextMessage(MESSAGE_INFO_DESCR, "You find the Deathwing Portal, you need at least Ancestral Rank 'Gold', Ancestral Points: 5, Parangon Level: 40 and Gear Score: 2800.")
            return true
        end
    elseif item:getActionId() == 27524 then
        if player then
            player:teleportTo(Position(32601, 31823, 8))
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            return true
        end
        return true
    end
    return true
end

entrance:type("stepin")
entrance:aid(27523, 27524)
entrance:register()

En el ejemplo, quita 5 Puntos y se necessita el Ranking Gold Para acceder a esa zona.
No olviden, los 5 Puntos se modifica arriba en el local configStorages, pero tambien al principio del if, veran un >= 5, inserten la misma cantidad en los dos lados.
Deberan de configurar las posiciones.


El codigo que se puede agregar en cualquier script para poder remover puntos es el siguiente:
Las variables ( encima de las functions o dentro pero al principio)
Código Lua:
local rank = "Gold"
local points_need = 3
local removePoints =  true

El estado IF que permite verificar el Rango y si tiene los puntos:
(Encima de a donde no querais que pueda ir, o que pueda hacer, sin ese rango , no olviden al final de agregar un end )

Código Lua:
 if rankIsEqualOrHigher(getRankTask(creature), rank) and taskPoints_get(creature) >= 1 then

Y Antes del end, que deberan de agregar, agregaran esta parte que permite remover puntos si han indicado true en las variables:
Código Lua:
if removePoints then
        taskPoints_remove(creature, points_need)
end

para terminar agregaremos un script en data/scripts/creaturescripts, que permitira contar los kills de las tasks:

Código Lua:
local ZooTaskCounter = CreatureEvent("ancestralTask")
function ZooTaskCounter.onKill(player, target)
    if target:isPlayer()  or target:getMaster() then
        return true
    end

    local mon_name = target:getName():lower()

    local ret_t = getTaskInfos(player)
    if ret_t then
        if mon_name == ret_t.name or isInArray(ret_t.mons_list, mon_name) then
        local sto_value = player:getStorageValue(ret_t.storage)
            if sto_value < ret_t.amount then
                sto_value = sto_value + 1
                player:setStorageValue(ret_t.storage, sto_value)
                if sto_value < ret_t.amount then
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, '[Ancestral Task] Killed ['..(sto_value)..'/'..ret_t.amount..'] '..mon_name..'.')
                else
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, '[Ancestral Task] You finished your '..mon_name..' task.')
                end
            end
        end
    end

    local ret_td = getTaskDailyInfo(player)
    if ret_td then
        if mon_name == ret_td.name or isInArray(ret_td.mons_list, mon_name) then
            local sto_value = player:getStorageValue(ret_td.storage)
            if sto_value < ret_td.amount then
                sto_value = sto_value + 1
                player:setStorageValue(ret_td.storage, sto_value)
                if sto_value < ret_td.amount then
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, '[Ancestral Task Daily] Killed ['..(sto_value)..'/'..ret_td.amount..'] '..mon_name..'.')
                else
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, '[Ancestral Task Daily] You finished your '..mon_name..' task.')
                end
            end
        end
    end

    return true
end
ZooTaskCounter:register()

Luego nos iremos en data/scripts/creaturescripts/others o bien en el login.lua o mejor en loginevents agregaran:

Código Lua:
"ancestralTask"
Si es login.lua:
Código Lua:
player:registerEvent("ancestralTask")
 
Última edición:
Arriba