Ir para conteúdo

Posts Recomendados

Este script foi feito por MaXwEllDeN.

 

Objetivo

Quando player upar, irá aparecer essa mensagem informando para que level ele avançou e quais magias já pode usar.

 

DNZUlcL.png

 

Crie o arquivo creaturescripts/scripts/advancespells.lua e adicione o seguinte conteúdo:

function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL__LEVEL then        
        local spells = {}
        for index = 0,     getPlayerInstantSpellCount(cid) - 1 do
            local spell = getPlayerInstantSpellInfo(cid, index)
        
            if spell.level > oldLevel and spell.level <= newLevel then
                table.insert(spells, " [".. spell.name .."] \"".. spell.words .. "\" Mana[".. spell.mana .."]")
            end
        end
    
        if #spells > 0 then            
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You have just advanced to level ".. newLevel .." and learned new spells!")
 
            for _, v in pairs(spells) do
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, v)
            end
        end
    end
        
    return true
end

No arquivo creaturescripts/creaturescripts.xml adicione a tag:

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

No seu arquivo creaturescripts/scritps/login.lua adicione a seguinte linha ANTES DO ÚLTIMO return true:

registerCreatureEvent(cid, "AdvLevelSpells")

Exemplo:

    registerCreatureEvent(cid, "AdvLevelSpells")
    return true
end
Link para o comentário
https://xtibia.com/forum/topic/234278-spell-info-ao-avan%C3%A7ar-o-level/
Compartilhar em outros sites

×
×
  • Criar Novo...