Ir para conteúdo

Featured Replies

Postado
  • Este é um post popular.

Opa galera, eu vi esse script em outro fórum e trouxe aqui para compartilhar com vocês porque achei a ideia bacana.

 

TFS 1.0 Skill Point System

 

  Citar

 

Nome: TFS 1.0 Skill Point System

Versão: [10.34+] // Qualquer uma disponível para TFS 1.0
Tipo do script: CreatureEvent/TalkAction
Créditos: Codinablack, Ninja & MadMOOK (outro fórum)
Link Original: http://otland.net/th...-system.221645/

 

 

O script é uma forma de customizar seu personagem à medida que ele vai avançando de level. O avanço de level dá ao jogador "pontos", os quais podem ser utilizados para comprar HP, MP e niveis de skills. O grande benefício desse sistema é que jogadores de um mesmo level podem ser radicalmente diferentes e podem se especializar, como no caso de uma equipe/time (um druida com pontos pode se especializar em HP e MP e virar o healer do time, enquanto um knight pode se especializar somente skills para ser o atacante e outro em HP para ser o tank e bloquer). Algumas imagens do funcionamento (retiradas do outro tópico original):
2qd8sr8.jpg
2d0j2wj.jpg
2celms6.jpg
34dfkhj.jpg
2zzpxfs.jpg
6pmc1d.jpg
334mck3.jpg

Agora que já se interessou pelo sistema, vamos aplicá-lo em nosso servidor!

Em /creaturescripts/scripts/skillpoints.lua
local SkillPoints = {
  [1] = 1,
  [2] = 1,
  [3] = 1,
  [4] = 1,
  [5] = 1,
  [6] = 1,
  [7] = 1,
  [8] = 1,
  }
function onAdvance(cid, skill, oldlevel, newlevel)
    if not (SkillPoints[getPlayerVocation(cid)]) then
        return true
    end
    if (skill == 8) then
        if (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) * (SkillPoints[getPlayerVocation(cid)]))
            doCreatureSay(cid, '+1 Skill Point!', TALKTYPE_ORANGE_1)
        end
    end

  return true
end

Em /creaturescripts/scripts/login.lua, adicione

  player:registerEvent("SkillPointSystem")

Em /creaturescripts/creaturescripts.xml, adicione

<event type="advance" name="SkillPointSystem" script="skillpoints.lua"/>

Em /talkactions/scripts/skillpoints.lua

local SkillPoints = {
    [1] = 1,
    [2] = 1,
    [3] = 1,
    [4] = 1,
    [5] = 1,
    [6] = 1,
    [7] = 1,
    [8] = 1,
}
function onSay(cid, words, param)
    local player = Player(cid)
        local vocation = Player(cid)
            if not (SkillPoints[getPlayerVocation(cid)]) then
                return false
            end
        local param = param:lower()
            local p2 = param:split(",")
        if (getPlayerStorageValue(cid, 14574) < 0) then
            setPlayerStorageValue(cid, 14574, 0)
        end
            local skillids = {
                ["shielding"] = 5,
                ["sword"] = 2,
                ["axe"] = 3,
                ["club"] = 1,
                ["fist"] = 0,
                ["distance"] = 4
                }
            local attributes = {
                ["health"] = {np = 1, vl = 2, skn = "Hit Points"},
                ["energy"] = {np = 1, vl = 2, skn = "Mana Points"},
                ["magic"] = {np = 15, vl = 1, skn = "Magic Level"},
                ["shielding"] = {np = 15, vl = 1, skn = "Shielding Skill"},
                ["sword"] = {np = 15, vl = 1, skn = "Sword Skill"},
                ["axe"] = {np = 15, vl = 1, skn = "Axe Skill"},
                ["club"] = {np = 15, vl = 1, skn = "Club Skill"},
                ["fist"] = {np = 15, vl = 1, skn = "Fist Skill"},
                ["distance"] = {np = 15, vl = 1, skn = "Distance Skill"},
                }
        if (param == "check") then
            doPlayerPopupFYI(cid, "<<<<< Skill Points >>>>> \n\nPoints Available: ".. getPlayerStorageValue(cid, 14574) .."\nPoints Per Level: ".. SkillPoints[getPlayerVocation(cid)])
                elseif (p2[1] and p2[1] == "add") and (attributes[p2[2]]) and (tonumber(p2[3])) then
                    local creature = Creature(cid)
                        local    cpos = creature:getPosition()
                            if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * attributes[p2[2]].np) then
                                    doPlayerSendCancel(cid, "you need more skill points go hunt!")
                                return cpos:sendMagicEffect(CONST_ME_POFF)
                            end
                        if (p2[2] == "health") then
                            player:setMaxHealth(player:getMaxHealth() + attributes[p2[2]].vl * tonumber(p2[3]))
                                player:addHealth(attributes[p2[2]].vl * tonumber(p2[3]))
                            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been rewarded with ".. tonumber(p2[3]) * attributes[p2[2]].vl .. "Hit Points")
                        elseif (p2[2] == "energy") then
                            player:setMaxMana(player:getMaxMana() + attributes[p2[2]].vl * tonumber(p2[3]))
                                player:addMana(attributes[p2[2]].vl * tonumber(p2[3]))
                            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been rewarded with ".. tonumber(p2[3]) * attributes[p2[2]].vl .. "Mana Points")
                        elseif (p2[2] == "magic") then
                            player:addManaSpent(math.ceil((Vocation(getPlayerVocation(cid)):getRequiredManaSpent(player:getBaseMagicLevel() + 1) - player:getManaSpent()) / configManager.getNumber(configKeys.RATE_MAGIC)))
                            ---Player receives message on Skill Advance
                        elseif(skillids[p2[2]]) then
                            for a = 1, tonumber(p2[3]) do
                            player:addSkillTries(skillids[p2[2]], player:getVocation():getRequiredSkillTries(skillids[p2[2]], player:getSkillLevel(skillids[p2[2]]) + 1) - player:getSkillTries(skillids[p2[2]]))
                        --Player receives message on Level Advance
                    end
                end
            setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * attributes[p2[2]].np)
        else
        local msgx = ""
        for i, v in pairs(attributes) do
            local add = (v.np > 1) and "s" or ""
                msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " points".. add .. " = " .. v.vl .. " ".. v.skn .. "\n"
            end
            doPlayerPopupFYI(cid, " <<<<<<<< Add Skill Points >>>>>>>> \n\n Skill Points are used to customize your character\n\n".. msgx .. "\nExample of Use: ".. words .." add,health, 1\n\nPoints available: ".. getPlayerStorageValue(cid, 14574))
        end
    return true
end

Em /talkactions/talkactions.xml, adicione

<talkaction words="!points" separator=" " script="skillpoints.lua"/>

Se gostou, poste, CURTA e compartilhe!
<Não testei o script, embora tenham garantido no outro fórum que está funcionando... se não funcionar, poste no próprio tópico os erros relacionados a esse script ou então em nossa seção de dúvidas de scripting (http://www.tibiaking.com/forum/forum/249-suporte-de-scripts/)>

 

Abraços e continue sempre conferindo as novidades do TibiaKing!

[m's]

 

  • Respostas 9
  • Visualizações 2.8k
  • Created
  • Última resposta

Top Posters In This Topic

  • 8 months later...
  • 1 year later...
Postado

Boa tarde,

 

Instalei o sistema de acordo com o tutorial acima, porém quando eu mato algum monstro ele não salva o evento e não atribui o ponto ao personagem, como posso fazer?

 

local SkillPoints = {
  [1] = 1,
  [2] = 1,
  [3] = 1,
  [4] = 1,
  [5] = 2,
  [6] = 2,
  [7] = 2,
  [8] = 2,
  }

local events = {
    'ElementalSpheresOverlords',
    'BigfootBurdenVersperoth',
    'Razzagorn',
    'Shatterer',
    'Zamulosh',	
    'The Hunger',
    'The Rage',
    'Eradicator',
    'Eradicator1',
    'Rupture',
    'World Devourer',	
    'Tarbaz',
    'Shulgrax',
    'Ragiaz',
    'Plagirath',
    'Mazoran',
    'Destabilized',
    'BigfootBurdenWiggler',
    'SvargrondArenaKill',
    'NewFrontierShardOfCorruption',
    'NewFrontierTirecz',
    'ServiceOfYalaharDiseasedTrio',
    'ServiceOfYalaharAzerus',
    'ServiceOfYalaharQuaraLeaders',
    'InquisitionBosses',
    'InquisitionUngreez',
    'KillingInTheNameOfKills',
    'KillingInTheNameOfKillss',
    'KillingInTheNameOfKillsss',
    'MastersVoiceServants',
    'SecretServiceBlackKnight',
    'ThievesGuildNomad',
    'WotELizardMagistratus',
    'WotELizardNoble',
    'WotEKeeper',
    'WotEBosses',
    'WotEZalamon',
    'WarzoneThree',
    'PlayerDeath',
    'AdvanceSave',
    'bossesWarzone',
    'AdvanceRookgaard',
    'PythiusTheRotten',
    'DropLoot',
    'Yielothax',
    'BossParticipation',
    'Energized Raging Mage',
    'Raging Mage', 
    'modalMD1',
    'VibrantEgg',
    'SkillPointSystem',
    'DeathCounter',
    'KillCounter',
    'bless1',
    'lowerRoshamuul' 
}
 
local function onMovementRemoveProtection(cid, oldPosition, time)
    local player = Player(cid)
    if not player then
        return true
    end
 
    local playerPosition = player:getPosition()
    if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
        player:setStorageValue(Storage.combatProtectionStorage, 0)
        return true
    end
 
    addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1) 
end
 
function onLogin(player)
	local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
	if player:getLastLoginSaved() <= 0 then
		loginStr = loginStr .. ' Please choose your outfit.'
		player:sendOutfitWindow()
		player:sendTutorial(1)
	else
		if loginStr ~= "" then
			player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
		end

		loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
	end
 
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
   
    local playerId = player:getId()
 
    -- Stamina
    nextUseStaminaTime[playerId] = 1
 
    -- STAMINA DEVIDO A QUEDAS START
   
    --local stamina_full = 42 * 60 -- config. 42 = horas
   -- if player:getStamina() >= stamina_full then
      --  player:sendCancelMessage("Your stamina is already full.")
   -- elseif player:getPremiumDays() < 1 then
     --   player:sendCancelMessage("You must have a premium account.")
   -- else
      --  player:setStamina(stamina_full)
     -- player:sendTextMessage(MESSAGE_INFO_DESCR, "Your stamina has been refilled.")      
   -- end
   
    -- STAMINA DEVIDO A QUEDAS END
   
    -- Promotion
   --[[ local vocation = player:getVocation()
    local promotion = vocation:getPromotion()
    if player:isPremium() then
        local value = player:getStorageValue(Storage.Promotion)
        if not promotion and value ~= 1 then
            player:setStorageValue(Storage.Promotion, 1)
        elseif value == 1 then
            player:setVocation(promotion)
        end
    elseif not promotion then
        player:setVocation(vocation:getDemotion())
    end--]]
   
     -- ABRIR CHANNELS
    if(not isInArray({1,2,3,5,6,7,8}, player:getVocation():getId()) or player:getLevel() < 6) then
   -- player:openChannel(7)   -- help channel
    player:openChannel(3)   -- world chat 
    player:openChannel(6)   -- advertsing rook main
    else
  --  player:openChannel(7)   -- help channel
    player:openChannel(3)   -- world chat
    player:openChannel(5)   -- advertsing main 
    end
   
    --
    -- Rewards
    local rewards = #player:getRewardList()
    if(rewards > 0) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You have %d %s in your reward chest.", rewards, rewards > 1 and "rewards" or "reward"))
    end
 
    -- Update player id
    local stats = player:inBossFight()
    if stats then
        stats.playerId = player:getId()
    end
 
    -- fury gates
   
    if Game.getStorageValue(GlobalStorage.FuryGates, (9710)) == 1 then -- for venore
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Venore Today.')
elseif Game.getStorageValue(GlobalStorage.FuryGates, (9711)) == 2 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Abdendriel Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9712)) == 3 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Thais Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9713)) == 4 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Carlin Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9714)) == 5 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Edron Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9716)) == 6 then -- for ab...
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Kazordoon Today.')
      end
     
   player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'OTXServer Global by Malucooo http://www.github.com/malucooo/otxserver-testing/')
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BONUS EXP] Command for check !experience.')
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[GUILD LEADER COMMAND] Will change all outfits from members !outfit.')
   
    -- Events
    for i = 1, #events do
        player:registerEvent(events[i])
    end
 
    if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
        player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
        onMovementRemoveProtection(playerId, player:getPosition(), 10)
    end

player:registerEvent("SkillPointSystem")
player:registerEvent("Dialogue") 

    return true
end

O meu creaturescript/other/login.lua está como mostrado acima.

 

Obg

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