
guirpraduh
Membro
-
Registro em
-
Última visita
Histórico de Curtidas
-
guirpraduh deu reputação a Mophus em TFS 1.0 Skill Point SystemOpa 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
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):
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]
-
guirpraduh deu reputação a MaXwEllDeN em {Simple} Level Points#Introdução
Este é um sistema muito simples e básico que eu fiz baseando-me no jogo Mu Online, no qual ao avançar de nível você ganha pontos que podem ser distribuídos para aumentar seus "stats".
#Instalação
Faça o download do sistema e cole na pasta do seu servidor.
@Creaturescripts
Depois abra a pasta creaturescripts/scripts que fica dentro da pasta data do seu servidor, abra o arquivo login.lua, com algum editor de texto, e lá no final antes do último return true cole a seguinte linha:
registerCreatureEvent(cid, "PointSystem") #Configuração No arquivo PointsSystem.lua da pasta lib L_LvlPoints = { vocPoints = { -- [Skill] = Pontos que ganha, [1] = 3, [2] = 3, [3] = 3, [4] = 5, [5] = 5, [6] = 5, [7] = 5, [8] = 8, }, entre Colchetes fica o id da vocation, e depois do sinal de igualdade a quantidade de pontos que ele ganhará por level que for upado. 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"}, } np - quantidade de pontos para adicionar o stat vl - quanto vai adicioanar pelo np. Exemplo: ["vitalidade"] = {np = 2, vl = 5, nm = "Hit Points"}
Com 2 pontos eu compro 5 de HP
É isso ai galera, bye bye