Ir para conteúdo

Posts Recomendados

bom estou prescisando de um script que a pessoa ganhe promotion em certo level automaticamente, tipo eu so um knight cheguei no level (50 de exemplo) que foi programado para ganhar a promotion ai ele vira elite knight, espero que mim ajudem valeu :smile_positivo:

Editado por nbb147
Link para o comentário
https://xtibia.com/forum/topic/156401-voca%C3%A7%C3%A3o-por-level/
Compartilhar em outros sites

Veja se funciona:

 

function onAdvance(cid, skill, oldLevel, newLevel)

local c = {
[1] = {NewVocation = 5, Level = 20},
[2] = {NewVocation = 6, Level = 20}
}

if (skill == 8) then
 if (c[getPlayerVocation(cid)]) then
    if (c[getPlayerVocation(cid)].Level == newLevel) then
       doPlayerSetVocation(cid, c[getPlayerVocation(cid)].NewVocation)
    end
 end
end
return true
end

 

 

flw

Link para o comentário
https://xtibia.com/forum/topic/156401-voca%C3%A7%C3%A3o-por-level/#findComment-1032865
Compartilhar em outros sites

Creaturescript / Scripts / Promotion.lua E Adicione

 

 

local config = {

promoLevel = 1, -- promotion level

needLevel = 20, -- level to get promotion

needPremium = "yes" -- need premium (YES/NO)?

}

 

function onAdvance(cid, skill, oldlevel, newlevel)

if (skill == 0) and (newlevel >= config.needLevel and getPlayerPromotionLevel(cid)<config.promoLevel) then

if(string.lower(config.needPremium) == "yes" and isPremium(cid) == TRUE) or (string.lower(config.needPremium) == "no") then

setPlayerPromotionLevel(cid, config.promoLevel)

doPlayerSendTextMessage(cid, 22, "You have been promoted to " .. getVocationInfo(getPlayerVocation(cid)).name .. ".")

end

end

return TRUE

end

 

 

Creaturescript.xml Adicione

 

 

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

 

 

Ve se funciona!

Editado por Pinpao
Link para o comentário
https://xtibia.com/forum/topic/156401-voca%C3%A7%C3%A3o-por-level/#findComment-1032875
Compartilhar em outros sites

Em creaturescripts/scripts, crie o arquivo AdvancePromote.lua e coloque o conteúdo abaixo:

 

function onAdvance(cid, skill, oldLevel, newLevel)

local c = {
[1] = {NewVocation = 5, Level = 20},
[2] = {NewVocation = 6, Level = 20}
}

if (skill == 8) then
 if (c[getPlayerVocation(cid)]) then
    if (c[getPlayerVocation(cid)].Level == newLevel) then
       doPlayerSetVocation(cid, c[getPlayerVocation(cid)].NewVocation)
    end
 end
end
return true
end

 

Feito isso, vá em creaturescripts.xml e adicione:

 

<event type="advance" name="AdvancePromote" event="script" value="AdvancePromote.lua"/>

 

Agora, vá em creaturescripts/scripts/login.lua e adicione:

 

registerCreatureEvent(cid, "AdvancePromote")

 

 

Pronto.

 

flw

Link para o comentário
https://xtibia.com/forum/topic/156401-voca%C3%A7%C3%A3o-por-level/#findComment-1033299
Compartilhar em outros sites

×
×
  • Criar Novo...