Ir para conteúdo

Featured Replies

Postado

Procurei em toda a internet e não achei nada parecido.

Preciso de um script que quando o player alcançar o level 200, ele ganhe aleatoriamente uma entre oito determinadas montarias.

 

 

Alguém consegue criar algo assim?

 

Eu uso TFS 1.3

 

 

Agradeço antecipadamente!

Postado

Em creaturescripts/scripts crie um arquivo.lua:

 

Spoiler

local config = {
level = 200,
repeatedMount = false, -- se puder ganhar só mount que o player não tem: false, caso contrário, true
mounts = {
[1] = {id = 14, name = "Tiger Slug"},
[2] = {id = 15, name = "Uniwheel"},
[3] = {id = 16, name = "Crystal Wolf"},
[4] = {id = 17, name = "War Horse"},
[5] = {id = 18, name = "Kingly Deer"},
[6] = {id = 19, name = "Tamed Panda"},
[7] = {id = 20, name = "Dromedary"},
[8] = {id = 21, name = "Scorpion King"}
}}

function onAdvance(player, skill, oldlevel, newlevel)
    if player:getStorageValue(77009) == -1 and skill == SKILL_LEVEL and newlevel >= config.level then
        local info = ""
        if not config.repeatedMount then
            local check = {}
            for i, v in pairs(config.mounts) do
                if not player:hasMount(v.id) then
                    table.insert(check, {id = v.id, name = v.name})
                end
            end
            if #check > 0 then
                local r = math.random(1, #check)
                player:addMount(check[r].id)
                info = check[r].name
            end
        else
            local r = math.random(1, #config.mounts)
            if not player:hasMount(config.mounts[r].id) then
                player:addMount(config.mounts[r].id)
                info = config.mounts[r].name
            end
        end
        if info ~= "" then
            player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Due to advance to level "..config.level..", you have received the "..info.." mount!")
        end
        player:setStorageValue(77009, 1)
    end
	return true
end

function onLogin(player)
	player:registerEvent("mountonadvance")
	return true
end

 

 

No creaturescripts.xml, adicione as tags: 

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

<event type="login" name="reg_mountonadvance" script="NOMEDOARQUIVO.lua"/>

 

Contato:

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo