Ir para conteúdo

Featured Replies

Postado

Bom manin, o script para distribuir pontos eu tenho em meu server, script do MaXwEIIDeN..

Vou te ensinar a usar:
 

 

 

 

 

Instalando:


Vá em data/creaturescript/scripts, crie um arquivo .lua chamado pointsystem.lua e coloque isso dentro:

-- #######################################
-- ####### Developed by MaXwEllDeN #######
-- ####### Level Points System     #######
-- ####### Version: 1.0            #######
-- #######################################

local VocPoints = L_LvlPoints.vocPoints

function onAdvance(cid, skill, oldlevel, newlevel)
    if not (VocPoints[getPlayerVocation(cid)]) then
        return true
    end

    if skill == 8 and getPlayerStorageValue(cid, 14573) < newlevel then
        if (getPlayerStorageValue(cid, 14574) < 0) then
            setPlayerStorageValue(cid, 14574, 0)
            setPlayerStorageValue(cid, 14573, 0)
        end

        setPlayerStorageValue(cid, 14573, newlevel)
        setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) + (newlevel - oldlevel) * (VocPoints[getPlayerVocation(cid)]))
        doSendAnimatedText(getThingPos(cid), "+" .. (newlevel - oldlevel) * (VocPoints[getPlayerVocation(cid)]), 18)
    end

    return true
end

 

 

 

depois em data/creaturescript/creaturescripts.xml e adicione essa linha no final ( antes do </creaturescripts> ):

<event type="advance" name="PointSystem" event="script" value="PointSystem.lua"/>



em seguida, vá para data/lib e crie outro arquivo .lua com o nome pointsystem.lua, coloque isso dentro:

-- #######################################
-- ####### Developed by MaXwEllDeN #######
-- ####### Level Points System     #######
-- ####### Version: 1.0            #######
-- #######################################

L_LvlPoints = {
    vocPoints = {
        -- [Skill] = Pontos que ganha,
        [1] = 3,
        [2] = 3,
        [3] = 3,
        [4] = 5,
        [5] = 5,
        [6] = 5,
        [7] = 5,
        [8] = 8,
    },

    attributes = {
        ["vitalidade"] = {np = 2, vl = 5, nm = "Hit Points"}, -- Precisa usar 2 points para adicionar 10 de hp
        ["energy"] = {np = 4, vl = 2, nm = "Mana Points"},
        ["magic"] = {np = 30, vl = 1, nm = "Magic Level"},
        ["shielding"] = {np = 40, vl = 1, nm = "Shielding Skill"},
        ["sword"] = {np = 20, vl = 1, nm = "Sword Skill"},
        ["axe"] = {np = 20, vl = 1, nm = "Axe Skill"},
        ["club"] = {np = 20, vl = 1, nm = "Club Skill"},
        ["distance"] = {np = 20, vl = 1, nm = "Distance Skill"},
    }

}


então vá em data/talkactions/scripts, crie mais um arquivo chamado pointsystem.lua com isso dentro:
-- #######################################
-- ####### Developed by MaXwEllDeN #######
-- ####### Level Points System     #######
-- ####### Version: 1.0            #######
-- #######################################

function onSay(cid, words, param)
    if not (L_LvlPoints.vocPoints[getPlayerVocation(cid)]) then
        return false
    end

    local param = param:lower()
    local p2 = string.explode(param, ",")

    if (getPlayerStorageValue(cid, 14574) < 0) then
        setPlayerStorageValue(cid, 14574, 0)
    end

    local skillids = {
        ["shielding"] = 5,
        ["sword"] = 2,
        ["axe"] = 3,
        ["club"] = 1,
        ["distance"] = 4
    }

    if (param == "check") then
        doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574) .."\nPontos por level: ".. L_LvlPoints.vocPoints[getPlayerVocation(cid)])
    elseif (p2[1] and p2[1] == "add") and (L_LvlPoints.attributes[p2[2]]) and (tonumber(p2[3])) then
        if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np) then
            doPlayerSendCancel(cid, "Você não tem pontos suficientes para distribuir!")
            return doSendMagicEffect(getThingPos(cid), 2)
        end

        if (p2[2] == "vitalidade") then
            setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
            doCreatureAddHealth(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
        elseif (p2[2] == "energy") then
            setCreatureMaxMana(cid, getCreatureMaxMana(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
            doCreatureAddMana(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
        elseif(skillids[p2[2]]) then
            for a = 1, tonumber(p2[3]) do
                doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) + 1) - getPlayerSkillTries(cid, skillids[p2[2]]), false)
            end
        end


        doSendMagicEffect(getThingPos(cid), 29)
        doSendMagicEffect(getThingPos(cid), 30)
        doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np, 180)
        setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np)
    else
        local msgx = ""
        for i, v in pairs(L_LvlPoints.attributes) do
            local add = (v.np > 1) and "s" or ""
            msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " ponto".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n"
        end

        doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos necessários para aumentar os stats:\n\n".. msgx .. "\nExemplo de uso: ".. words .." add, vitalidade, 5\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574))
    end

    return true
end


Por fim, vá em data/talkactions/talkactions.xml e adicione essa linha no final (antes de </talkactions> ) :
<talkaction words="!points" event="script" value="PointsSystem.lua"/>

 

 

 




Configurando:

Para configurar, vá novamente em data/lib e abra o pointsystem.lua que criou lá..

L_LvlPoints = {
    vocPoints = {
        -- [Skill] = Pontos que ganha,
        [1] = 3,
        [2] = 3,
        [3] = 3,
        [4] = 5,
        [5] = 5,
        [6] = 5,
        [7] = 5,
        [8] = 8,
    },

Nessa parte, você configura quantos pontos cada vocação ganhará ao passar de level.. no caso do script acima:
vocação 1 ganhará 3 pontos para distrubir quando passar de level

vocação 4 ganhará 5 pontos para distrubir quando passar de level

vocação 8 ganhará 8 pontos para distrubir quando passar de level


attributes = {
        ["vitalidade"] = {np = 2, vl = 5, nm = "Hit Points"}, -- Precisa usar 2 points para adicionar 10 de hp
        ["energy"] = {np = 4, vl = 2, nm = "Mana Points"},
        ["magic"] = {np = 30, vl = 1, nm = "Magic Level"},
        ["shielding"] = {np = 40, vl = 1, nm = "Shielding Skill"},
        ["sword"] = {np = 20, vl = 1, nm = "Sword Skill"},
        ["axe"] = {np = 20, vl = 1, nm = "Axe Skill"},
        ["club"] = {np = 20, vl = 1, nm = "Club Skill"},
        ["distance"] = {np = 20, vl = 1, nm = "Distance Skill"},
        ["fishing"] = {np = 20, vl = 1, nm = "Fishing Skill"},
    }

Nessa parte, configura quantos pontos precisa para upar cada skill e quanto irá mudar.. no caso acima:

    ["vitalidade"] = {np = 2, vl = 5, nm = "Hit Points"},  -  custa 2 points para aumentar 5 de Max HP
    ["energy"] = {np = 4, vl = 2, nm = "Mana Points"},  -  custa 4 points para aumentar 2 de Max Mana
    ["magic"] = {np = 30, vl = 1, nm = "Magic Level"},  -  custa 30 points para aumentar 1 magic level
    ["shielding"] = {np = 40, vl = 1, nm = "Shielding Skill"},  -  custa 40 points para aumentar 1 shielding level
    ["sword"] = {np = 20, vl = 1, nm = "Sword Skill"},  -  custa 20 points para aumentar 1 sword level

e por ai vai..

 

 

 

Para usar é só falar: !points add, vitalidade 5     -     !points add(comando padrão configurado)   ,  vitalidade(nome da skill que colocou em [" "] - pode ser energy vitalidade magic etc)   ,   5( quantidade de pontos que quer colocar nessa skill





Bom, eu tentei fazer uma janela tipo essa para o meu server mas não consegui editar no otclient, então nisso não poderei te ajudar ;x

  • Respostas 34
  • Visualizações 5k
  • Created
  • Última resposta

Top Posters In This Topic

Posted Images

Postado

Então, a parte do server eu sei, o problema mesmo é na parte do OTClient.

Isso realmente não to conseguindo fazer do jeito que eu quero, que a propósito é parecido com o seu modelo..

o máximo que to conseguindo é uma janela com uma imagem para cada atributo que ao clicar, aumentaria +1 ponto dependendo de que clicou

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo