• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Aura System

115820

Member
Joined
Feb 27, 2011
Messages
193
Solutions
1
Reaction score
5
Location
London, England
Hi, i have this script in my otserver. I put it activate when player login, but now i wanna change to when player OnEquip/OndeEquip.

When player onEquip start aura, when deEquip stop aura.

Code:
-- CONFIGURAÇÕES
aurastr = 25950 -- storage da aura
estr = 25951 -- storage para o exhaust
porcentagem = 30 -- chance de curar em cada volta da aura, em porcentagem
quantheal = 15 -- porcentagem do hp máximo que cada cura irá curar. (No caso, irá curar 10% do hp máximo cada cura)
tempo = 1180 -- tempo para dar uma volta no player (este tempo foi o que achei mais agradável visualmente, é recomendável não mudar)
tipoaura = 35 -- número do efeito da aura (efeito de distância, pode ser identificado com /x no jogo)
efeitocura = 53 -- número do efeito quando a cura chega ao player (efeito de posição fixa, pode ser identificado com /z no jogo)

local table = {
itemNeed = 9969, -- Mesmo id do itemid que você colocou na tag xml.
txt = {"´ .    ,", ".    ´ ,", "[ICODE]  .  ,", ",    [/ICODE] ."}, -- Texto que vai sair.
delay = 1000, -- Tempo que vai ficar saindo
cor = {26, 30, 31, 32}, -- Cor do texto que vai sair.
effect = 3 -- Efeito que vai sair(aura).
}

function doPlayerLoopEff(cid)
 if isPlayer(cid) and getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == table.itemNeed then
  doSendAnimatedText(getThingPos(cid), table.txt[math.random(#table.txt)], table.cor[math.random(#table.cor)])
  addEvent(function() doPlayerLoopEff(cid) end, table.delay) -- 1000 é o delay que vai sair o efeito e o texto.
 end 
end

-- Função que chama a aura
function efeitosAura1(i,tm,cid)
    if isCreature(cid) then
        local atual = getCreaturePosition(cid)
        local posaura = {
            {x=(atual.x)-1, y=(atual.y)-1, z=atual.z},
            {x=atual.x, y=(atual.y)-1, z=atual.z},
            {x=(atual.x)+1, y=(atual.y)-1, z=atual.z},
            {x=(atual.x)+1, y=atual.y, z=atual.z},
            {x=(atual.x)+1, y=(atual.y)+1, z=atual.z},
            {x=atual.x, y=(atual.y)+1, z=atual.z},
            {x=(atual.x)-1, y=(atual.y)+1, z=atual.z},
            {x=(atual.x)-1, y=atual.y, z=atual.z},
        }
        local chances = math.random(100)
        if(chances<=porcentagem/8) then
            doCreatureAddHealth(cid, getCreatureMaxHealth(cid)/quantheal)
            doCreatureAddMana(cid, getCreatureMaxMana(cid)/quantheal)
            if(i<=8 and i>1) then
                doSendDistanceShoot({x=posaura[I].x, y=posaura[I].y, z=posaura[I].z}, atual, tipoaura)
            else
                doSendDistanceShoot({x=posaura[1].x, y=posaura[1].y, z=posaura[1].z}, atual, tipoaura)
            end
            doSendMagicEffect(atual, efeitocura)
        end
        if(i==8) then
            doSendDistanceShoot({x=posaura[I].x, y=posaura[I].y, z=posaura[I].z}, {x=posaura[1].x, y=posaura[1].y, z=posaura[1].z}, tipoaura)
        elseif(i<8) then
            doSendDistanceShoot({x=posaura[I].x, y=posaura[I].y, z=posaura[I].z}, {x=posaura[i+1].x, y=posaura[i+1].y, z=posaura[i+1].z}, tipoaura)
        end
        if i<=8 then
            i = i+1
            tm = tempo/8
            return addEvent(efeitosAura1,tm,i,tm,cid)
        elseif i>8 then
            return efeitosAura1(1,0,cid)
        else
            return true
        end
    else
        return true
    end
end 

-- Função principal 

function onEquip (cid, item, slot)
doPlayerLoopEff(cid)
    efeitosAura1(1,tempo/8,cid)
      return true
      end[/I][/I][/I][/I][/I][/I][/I][/I][/I] [code]


PS: Sorry my english.
 
Back
Top