Jump to content

Mudando Skills Iniciais - Start Skills (Sqlite e Mysql)


Spectrusz

Recommended Posts

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

Link to comment
Share on other sites

  • 1 month later...

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

 

 

Edited by sergionilo
Link to comment
Share on other sites

  • 1 month later...

Oi, obrigado pelo script

Poderia me ajudar?

Tem alguma coisa que eu possa fazer para remover essas mensagens:

 

20:55 You advanced to axe fighting level 11.

20:55 You advanced to axe fighting level 12.

20:55 You advanced to axe fighting level 13.

20:55 You advanced to axe fighting level 14.

20:55 You advanced to axe fighting level 15.

20:55 You advanced to axe fighting level 16.

20:55 You advanced to axe fighting level 17.

20:55 You advanced to axe fighting level 18.

20:55 You advanced to axe fighting level 19.

20:55 You advanced to axe fighting level 20.

20:55 You advanced to axe fighting level 21.

20:55 You advanced to axe fighting level 22.

20:55 You advanced to axe fighting level 23.

20:55 You advanced to axe fighting level 24.

20:55 You advanced to axe fighting level 25.

20:55 You advanced to axe fighting level 26.

20:55 You advanced to axe fighting level 27.

20:55 You advanced to axe fighting level 28.

20:55 You advanced to axe fighting level 29.

20:55 You advanced to axe fighting level 30.

20:55 You advanced to axe fighting level 31.

20:55 You advanced to axe fighting level 32.

20:55 You advanced to axe fighting level 33.

20:55 You advanced to axe fighting level 34.

20:55 You advanced to axe fighting level 35.

20:55 You advanced to axe fighting level 36.

20:55 You advanced to axe fighting level 37.

20:55 You advanced to axe fighting level 38.

20:55 You advanced to axe fighting level 39.

20:55 You advanced to axe fighting level 40.

20:55 You advanced to axe fighting level 41.

20:55 You advanced to axe fighting level 42.

20:55 You advanced to axe fighting level 43.

20:55 You advanced to axe fighting level 44.

20:55 You advanced to axe fighting level 45.

20:55 You advanced to axe fighting level 46.

20:55 You advanced to axe fighting level 47.

20:55 You advanced to axe fighting level 48.

20:55 You advanced to axe fighting level 49.

20:55 You advanced to axe fighting level 50.

20:55 You advanced to axe fighting level 51.

20:55 You advanced to axe fighting level 52.

20:55 You advanced to axe fighting level 53.

20:55 You advanced to axe fighting level 54.

20:55 You advanced to axe fighting level 55.

20:55 You advanced to axe fighting level 56.

20:55 You advanced to axe fighting level 57.

20:55 You advanced to axe fighting level 58.

20:55 You advanced to axe fighting level 59.

20:55 You advanced to axe fighting level 60.

20:55 You advanced to axe fighting level 61.

20:55 You advanced to axe fighting level 62.

20:55 You advanced to axe fighting level 63.

20:55 You advanced to axe fighting level 64.

20:55 You advanced to axe fighting level 65.

20:55 You advanced to axe fighting level 66.

20:55 You advanced to axe fighting level 67.

20:55 You advanced to axe fighting level 68.

20:55 You advanced to axe fighting level 69.

20:55 You advanced to axe fighting level 70.

20:55 You advanced to axe fighting level 71.

20:55 You advanced to axe fighting level 72.

20:55 You advanced to axe fighting level 73.

20:55 You advanced to axe fighting level 74.

20:55 You advanced to axe fighting level 75.

20:55 You advanced to axe fighting level 76.

20:55 You advanced to axe fighting level 77.

20:55 You advanced to axe fighting level 78.

20:55 You advanced to axe fighting level 79.

20:55 You advanced to axe fighting level 80.

 

 

 

 

O char novo trava durante uns 10 segundos antes de logar, exatamente por causa dessas mensagens.

Tem algum jeito de remove-las?

 

Agradeço dês de já

Link to comment
Share on other sites

×
×
  • Create New...