Mudando Skills Iniciais
Olá Ékzordes, hoje precisei de uma script básica e notei que aqui no xTibia não tem exatamente como eu queria(a um tempo atras, eu até pedi uma dessa, mas me entregaram diferente), então, em vez de eu sugar de algum fórum, decidi eu mesmo criar e compartilhar com vocês, sendo assim meu primeiro tópico tutorial.
Ela é bem simples, quando você loga com um personagem, ela identifica a classe, verifica se a skill atual é menor que a configurada por você e se for menor, ele adiciona a quantidade que você configurou menos a quantidade atual, ou seja, vai ficar com a quantidade que você configurou...
Não coloquei Storage pra fazer só na primeira vez que logar, porque se você coloca esse número como skill inicial, é porque você não deseja que o player tenha menos skill que isso, então, caso ele morra e perca a skill (fique menor que a inicial) ela vai voltar pro mesmo valor da inicial.
Então vamos ao que interessa.
1 - Adicionar a tag em Creaturescripts.xml
Abra o creaturescripts.xml em:
Pasta do seu OT\data\creaturescripts\creaturescripts.xml
1.1 - Em uma das linhas entre <creaturescripts> e </creaturescripts> adicione a tag:
<event type="login" name="Start Skills" event="script" value="startskills.lua"/>
2 - Registre o CreatureEvent (Não sei se é necessário, se não for, me avisem.)
Abra o login.lua em:
Pasta do seu OT\data\creaturescripts\scripts\login.lua
2.1 - Procure por alguma linha que comece com "registerCreatureEvent" e logo em baixo dela coloque:
registerCreatureEvent(cid, "Start Skills")
3 - Abra o bloco de notas, adicione a seguinte script dentro:
function onLogin(cid) local Mages = 60 local playerVoc = getPlayerVocation(cid) local reqTries = getPlayerRequiredSkillTries local Mages = { ML = 60, Shield = 20 } local Paladin = { Distance = 80, Shield = 80, ML = 20 } local Kina = { Sword = 80, Axe = 80, Club = 80, Shield = 80, ML = 9 } if playerVoc == 1 then if getPlayerMagLevel(cid) < Mages.ML then doPlayerAddMagLevel(cid, Mages.ML - getPlayerMagLevel(cid)) end if getPlayerSkill(cid, SKILL_SHIELD) < Mages.Shield then doPlayerAddSkill(cid, SKILL_SHIELD, Mages.Shield - getPlayerSkill(cid, SKILL_SHIELD)) end elseif playerVoc == 2 then if getPlayerMagLevel(cid) < Mages.ML then doPlayerAddMagLevel(cid, Mages.ML - getPlayerMagLevel(cid)) end if getPlayerSkill(cid, SKILL_SHIELD) < Mages.Shield then doPlayerAddSkill(cid, SKILL_SHIELD, Mages.Shield - getPlayerSkill(cid, SKILL_SHIELD)) end elseif playerVoc == 3 then if getPlayerSkill(cid, SKILL_DISTANCE) < Paladin.Distance then doPlayerAddSkill(cid, SKILL_DISTANCE, Paladin.Distance - getPlayerSkill(cid, SKILL_DISTANCE)) end if getPlayerSkill(cid, SKILL_SHIELD) < Paladin.Shield then doPlayerAddSkill(cid, SKILL_SHIELD, Paladin.Shield - getPlayerSkill(cid, SKILL_SHIELD)) end if getPlayerMagLevel(cid) < Paladin.ML then doPlayerAddMagLevel(cid, Paladin.ML - getPlayerMagLevel(cid)) end elseif playerVoc == 4 then if getPlayerSkill(cid, SKILL_SWORD) < Kina.Sword then doPlayerAddSkill(cid, SKILL_SWORD, Kina.Sword - getPlayerSkill(cid, SKILL_SWORD)) end if getPlayerSkill(cid, SKILL_CLUB) < Kina.Club then doPlayerAddSkill(cid, SKILL_CLUB, Kina.Club - getPlayerSkill(cid, SKILL_CLUB)) end if getPlayerSkill(cid, SKILL_AXE) < Kina.Axe then doPlayerAddSkill(cid, SKILL_AXE, Kina.Axe - getPlayerSkill(cid, SKILL_AXE)) end if getPlayerSkill(cid, SKILL_SHIELD) < Kina.Shield then doPlayerAddSkill(cid, SKILL_SHIELD, Kina.Shield - getPlayerSkill(cid, SKILL_SHIELD)) end if getPlayerMagLevel(cid) < Kina.ML then doPlayerAddMagLevel(cid, Kina.ML - getPlayerMagLevel(cid)) end end return TRUE end
3.1 - Agora salve com o nome startskills.lua na pasta:
Pasta do seu OT\data\creaturescripts\scripts\login.lua
4 - Reinicie ou inicie o seu OT e pronto.
Caso utilize Mysql, vá no PhpMyAdmin e tire as skills dos samples.
Bem, sei que é possível diminuir essa script mas eu não tenho conhecimento pra isso, caso alguém se interesse por diminui-la fique a vontade, adiciono ela no tópico e coloco os devidos créditos.
Primeiro de muitos tutoriais, no nível conforme eu for sabendo. Até logo.
Créditos:
Spectrus