• 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!

Lua Script Aura (Tibia 8.60-OTX2)

Gaber Zen

Well-Known Member
Joined
Apr 22, 2023
Messages
224
Reaction score
51
Location
Egypt
Hi
i have problem my Script is Faster healing, Fast efei
How fix it With To give 500 hp/Mp Every 2 Sec

talkactions
<talkaction access="0-4" words="!aura" event="script" value="aura.lua"/>

Lua:
-- 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 = 20 -- porcentagem do hp mلximo que cada cura irل curar. (No caso, irل curar 5% 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 = 30 -- nْmero do efeito da aura (efeito de distância, pode ser identificado com /x no jogo)
    efeitocura = 49 -- nْmero do efeito quando a cura chega ao player (efeito de posiçمo fixa, pode ser identificado com /z no jogo)

-- 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)
            else
                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 and getPlayerStorageValue(cid, aurastr)==2) then
            i = i+1
            tm = tempo/8
            return addEvent(efeitosAura1,tm,i,tm,cid)
        elseif(i>8 and getPlayerStorageValue(cid, aurastr)==2) then
            return efeitosAura1(1,0,cid)
        else
            return TRUE
        end
    else
        return TRUE
    end
end

-- Funçمo principal
function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, 25943) == 2 then
doPlayerSendCancel(cid, "Você precisa desativar sua aura level 2.")
return true
end
if getPlayerStorageValue(cid, 27651) == 2 then
doPlayerSendCancel(cid, "Você precisa desativar sua aura level 3.")
return true
end
if getPlayerStorageValue(cid, 28911) == 2 then
doPlayerSendCancel(cid, "Você precisa desativar sua aura level 4.")
return true
end
    if(param=="on") then
        if getPlayerStorageValue(cid, estr) > os.time() then
            doPlayerSendCancel(cid, "Espere "..(getPlayerStorageValue(cid, estr) - os.time()).." segundos para poder habilitar aura level 1 novamente.")
        else
            if(getPlayerStorageValue(cid, aurastr)==2) then
                doPlayerSendCancel(cid,"Sua Aura Level 1 jل estل habilitada.")
            elseif(getPlayerStorageValue(cid, aurastr)==-1) then
                doPlayerSendCancel(cid,"Aura Level 1 ligada!")
                setPlayerStorageValue(cid, aurastr, 2)
                efeitosAura1(1,tempo/8,cid)
        end
        end
    elseif(param=="off") then
        if(getPlayerStorageValue(cid, aurastr)== 2) then
            setPlayerStorageValue(cid, estr, os.time()+2)
            setPlayerStorageValue(cid, aurastr, -1)
            doPlayerSendCancel(cid,"Aura Level 1 desligada!")
        end
    else  
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Digite '!aura on' para ligar sua aura, e '!aura off' para desligل-la.")
    end
    return true
end
 
change porcentagem = 30 to porcentagem = 800
change tempo = 1180 to tempo = 2000
change if(chances<=porcentagem/8) then to if (chances<=porcentagem/8) and i == 8 then
change doCreatureAddHealth(cid, getCreatureMaxHealth(cid)/quantheal) to doCreatureAddHealth(cid, 500)
change doCreatureAddMana(cid, getCreatureMaxMana(cid)/quantheal) to doCreatureAddMana(cid, 500)
also, move doCreatureAddMana up 1 line, to be beside doCreatureAddHealth
 
Last edited:
I Add Your code But Still efei Very Fast in character in under
i think when i add Healing+ mana in Aura Get The problem
i`m update to Quest but working for all player
After logout or Dead need To use off to can open it
Is it possible that when I open the َQuest, you will be with me forever? i Don`t like use/on-off

function onUse(cid, item, fromPosition, itemEx, toPosition)
if (getPlayerStorageValue(cid, 89123) == -1) then
doPlayerSendTextMessage(cid,22,"You won Aura Level 1.")
setPlayerStorageValue(cid, 89123, 1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
else
doPlayerSendTextMessage(cid,22,"You already got your Aura Level 1.")
end
return true
end
 
Last edited:
This is as easy as the function can get.
Lua:
function regenerate(cid, health, mana, interval, duration)
    if not isPlayer(cid) then
        return
    end
    doCreatureAddHealth(cid, health)
    doCreatureAddMana(cid, mana)
    if duration > 0 then
        duration = duration - interval
        if duration <= 0 then
            return
        end
    end
    addEvent(regenerate, interval, cid, health, mana, interval, duration)
end
script usage.
Lua:
regenerate(cid, 500, 500, 2000, -1) -- regen hp/mp 500, every 2 seconds, forever
regenerate(cid, 5, 10, 500, 30000) -- regen 5 hp, 10 mp, every 0.5 seconds, for 30 seconds
 
I Add all code, now is working good
but when add Storage To open by Quest have Erro
Lua:
-- CONFIGURAاصES
    aurastr = 25950 -- storage da aura
        estr = 25951 -- storage para o exhaust
    porcentagem = 50 -- chance de curar em cada volta da aura, em porcentagem
    quantheal = 20 -- porcentagem do hp mلximo que cada cura irل curar. (No caso, irل curar 5% 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 = 30 -- nْmero do efeito da aura (efeito de distância, pode ser identificado com /x no jogo)
    efeitocura = 49 -- nْmero do efeito quando a cura chega ao player (efeito de posiçمo fixa, pode ser identificado com /z no jogo)

-- Funçمo que chama a aura
function efeitosAura1(i,tm,cid)
    if getCreatureStorage(cid,89123) == 1 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, 1000)
                doCreatureAddMana(cid, 1000)
            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 and getPlayerStorageValue(cid, aurastr)==2) then
            i = i+1
            tm = tempo/8
            return addEvent(efeitosAura1,tm,i,tm,cid)
        elseif(i>8 and getPlayerStorageValue(cid, aurastr)==2) then
            return efeitosAura1(1,0,cid)
        else
            return TRUE
        end
    else
        return TRUE
    end
end

-- Funçمo principal
function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, 25943) == 2 then
doPlayerSendCancel(cid, "Você precisa desativar sua aura level 2.")
return true
end
if getPlayerStorageValue(cid, 27651) == 2 then
doPlayerSendCancel(cid, "Você precisa desativar sua aura level 3.")
return true
end
if getPlayerStorageValue(cid, 28911) == 2 then
doPlayerSendCancel(cid, "Você precisa desativar sua aura level 4.")
return true
end
    if(param=="on") then
        if getPlayerStorageValue(cid, estr) > os.time() then
            doPlayerSendCancel(cid, "Espere "..(getPlayerStorageValue(cid, estr) - os.time()).." segundos para poder habilitar aura level 1 novamente.")
        else
            if(getPlayerStorageValue(cid, aurastr)==2) then
                doPlayerSendCancel(cid,"Sua Aura Level 1 jل estل habilitada.")
            elseif(getPlayerStorageValue(cid, aurastr)==-1) then
                doPlayerSendCancel(cid,"Aura Level 1 ligada!")
                setPlayerStorageValue(cid, aurastr, 2)
                efeitosAura1(1,tempo/8,cid)
        end
        end
    elseif(param=="off") then
        if(getPlayerStorageValue(cid, aurastr)== 2) then
            setPlayerStorageValue(cid, estr, os.time()+2)
            setPlayerStorageValue(cid, aurastr, -1)
            doPlayerSendCancel(cid,"Aura Level 1 desligada!")
        end
    else   
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Digite '!aura on' para ligar sua aura, e '!aura off' para desligل-la.")
    end
    return true
end
 

Attachments

Last edited:
Back
Top