estanho não funcionou aqui olha :
function onLogin(cid)
local playerVoc = getPlayerVocation(cid) -- Deixe isso como esta.
local reqTries = getPlayerRequiredSkillTries -- Deixe isso como esta.
local LevelMin = 0 -- Caso não queira utilizar essa função da script, mude o valor de 130 para 0.
local Mages = {
ML = 15, -- Level inicial/minimo dos mages, sorc e druid.
Shield = 15 -- Shield inicial/minimo dos mages, sorc e druid.
}
local Paladin = {
Distance = 50, -- Distancia inicial/minima dos paladinos.
Shield = 35, -- Shield inicial/minimo dos paladinos.
ML = 1 -- MagicLevel inicial/minimo dos paladinos.
}
local Kina = {
Sword = 45, -- Sword Level inicial/minimo dos knights.
Axe = 45, -- Axe Level inicial/minimo dos knights.
Club = 45, -- Club Level inicial/minimo dos knights.
Shield = 40, -- Shield Level inicial/minimo dos knights.
ML = 1 -- MagicLevel inicial/minimo dos knights.
}
if getPlayerLevel(cid) < LevelMin then
doPlayerAddExperience(cid, (getExperienceForLevel(LevelMin) - getPlayerExperience(cid)))
end
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






info
Grupo: Campones
Registrado: 12/08/12
Posts: 40
Reputação: +3
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:
1.1 - Em uma das linhas entre <creaturescripts> e </creaturescripts> adicione a tag:
2 - Registre o CreatureEvent (Não sei se é necessário, se não for, me avisem.)
Abra o login.lua em:
2.1 - Procure por alguma linha que comece com "registerCreatureEvent" e logo em baixo dela coloque:
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 end3.1 - Agora salve com o nome startskills.lua na pasta:
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