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

Help with talkaction script

rogersenchou

New Member
Joined
Nov 27, 2016
Messages
36
Reaction score
3
Can some one help me with this function ?
Code:
-
        -- CONFIGURAÇÕES
           aurastr = 25950 -- storage da aura
           estr = 25951 -- storage para o exhaust
           porcentagem = 40 -- chance de curar em cada volta da aura, em porcentagem
           quantheal = 10 -- 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 = 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 efeitosAura(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 and getCreatureHealth(cid)<getCreatureMaxHealth(cid)) then
                 doCreatureAddHealth(cid, getCreatureMaxHealth(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(efeitosAura,tm,i,tm,cid)
              elseif(i>8 and getPlayerStorageValue(cid, aurastr)==2) then
                 return efeitosAura(1,0,cid)
              else
                 return TRUE
              end
           else
              return TRUE
           end
        end

        -- Função principal
        function onSay(cid, words, param, channel)
          if getPlayerStorageValue(cid, 89762) == 1 then
           if(param=="on") then
              if getPlayerStorageValue(cid, estr) > os.time() then
                 doPlayerSendCancel(cid, "Espere "..(getPlayerStorageValue(cid, estr) - os.time()).." segundos para poder habilitar tu aura nuevamente.")
              else
                 if(getPlayerStorageValue(cid, aurastr)==2) then
                 elseif(getPlayerStorageValue(cid, aurastr)==-1) then
                    doPlayerSendCancel(cid,"Aura ligada!")
                    setPlayerStorageValue(cid, aurastr, 2)
                    efeitosAura(1,tempo/8,cid)
                 end
              end
               else
               doPlayerSendCancel(cid,"Tu aura ya esta Activada.")
              end
           elseif(param=="off") then
              if(getPlayerStorageValue(cid, aurastr)==2) then
                 setPlayerStorageValue(cid, estr, os.time()+2)
                 setPlayerStorageValue(cid, aurastr, -1)
                 doPlayerSendCancel(cid,"Aura Desactivada!")
              end
           else  
              doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Di '!aura on' para activar tu aura, y '!aura off' para desactivarla.")
           end
           return TRUE
        end

I have this error in the console :(
Code:
[23/5/2017 1:18:34] [Error - LuaInterface::loadFile] data/talkactions/scripts/aura/aura.lua:66: 'end' expected (to close 'if' at line 56) near 'else'
[23/5/2017 1:18:34] [Error - Event::checkScript] Cannot load script (data/talkactions/scripts/aura/aura.lua)
[23/5/2017 1:18:34] data/talkactions/scripts/aura/aura.lua:66: 'end' expected (to close 'if' at line 56) near 'else'


my console is otxserver tfs 0.3.7.

please help me :(

I need this talkaction that need storage to use .
 
Last edited:
I cleaned it up and removed some stuff but you also had a - at the top of the page I am surprised you didn't get an error for that.
Lua:
-- CONFIGURAÇÕES
aurastr = 25950 -- storage da aura
estr = 25951 -- storage para o exhaust
porcentagem = 40 -- chance de curar em cada volta da aura, em porcentagem
quantheal = 10 -- 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 = 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 efeitosAura(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) and getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
            doCreatureAddHealth(cid, getCreatureMaxHealth(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(efeitosAura,tm,i,tm,cid)
        elseif i > 8 and getPlayerStorageValue(cid, aurastr) == 2 then
            return efeitosAura(1,0,cid)
        else
            return TRUE
        end
    else
        return TRUE
    end
end

-- Função principal
function onSay(cid, words, param, channel)
    if getPlayerStorageValue(cid, 89762) == 1 then
        if param == "on" then
            if getPlayerStorageValue(cid, estr) > os.time() then
                doPlayerSendCancel(cid, "Espere "..(getPlayerStorageValue(cid, estr) - os.time()).." segundos para poder habilitar tu aura nuevamente.")
            elseif getPlayerStorageValue(cid, aurastr) == -1 then
                doPlayerSendCancel(cid,"Aura ligada!")
                setPlayerStorageValue(cid, aurastr, 2)
                efeitosAura(1,tempo/8,cid)
            end
        else
            doPlayerSendCancel(cid,"Tu aura ya esta Activada.")
        end
    elseif param == "off" then
        if getPlayerStorageValue(cid, aurastr) == 2 then
            setPlayerStorageValue(cid, estr, os.time()+2)
            setPlayerStorageValue(cid, aurastr, -1)
            doPlayerSendCancel(cid,"Aura Desactivada!")
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Di '!aura on' para activar tu aura, y '!aura off' para desactivarla.")
    end
    return TRUE
end
 
the script doest work but Do not mark console error. i say !aura on and the script not work.
I switched the if statements, you should receive a message at the very least.
Lua:
-- CONFIGURAÇÕES
aurastr = 25950 -- storage da aura
estr = 25951 -- storage para o exhaust
porcentagem = 40 -- chance de curar em cada volta da aura, em porcentagem
quantheal = 10 -- 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 = 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 efeitosAura(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) and getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
            doCreatureAddHealth(cid, getCreatureMaxHealth(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(efeitosAura,tm,i,tm,cid)
        elseif i > 8 and getPlayerStorageValue(cid, aurastr) == 2 then
            return efeitosAura(1,0,cid)
        else
            return TRUE
        end
    else
        return TRUE
    end
end

-- Função principal
function onSay(cid, words, param, channel)
    if param == "on" then
        if getPlayerStorageValue(cid, 89762) == 1 then
            if getPlayerStorageValue(cid, estr) > os.time() then
                doPlayerSendCancel(cid, "Espere "..(getPlayerStorageValue(cid, estr) - os.time()).." segundos para poder habilitar tu aura nuevamente.")
            elseif getPlayerStorageValue(cid, aurastr) == -1 then
                doPlayerSendCancel(cid,"Aura ligada!")
                setPlayerStorageValue(cid, aurastr, 2)
                efeitosAura(1,tempo/8,cid)
            end
        else
            doPlayerSendCancel(cid,"Tu aura ya esta Activada.")
        end
    elseif param == "off" then
        if getPlayerStorageValue(cid, aurastr) == 2 then
            setPlayerStorageValue(cid, estr, os.time()+2)
            setPlayerStorageValue(cid, aurastr, -1)
            doPlayerSendCancel(cid,"Aura Desactivada!")
        end
    else 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Di '!aura on' para activar tu aura, y '!aura off' para desactivarla.")
    end
    return TRUE
end
 
no bro, doesnt work. it say that my aura is activate but i dont have the storage to use the aura .

And i use other chart taht have the storage and still same problem"aura is activate"


but the aure dont start
 
no bro, doesnt work. it say that my aura is activate but i dont have the storage to use the aura .

And i use other chart taht have the storage and still same problem"aura is activate"


but the aure dont start
Alright well you will need to rewrite the execution of the script, I know you don't know how to do that but I really don't have the time to be doing it for you, maybe someone else can help you or maybe you can try your hand at it yourself, a real simple way is the to use print, print each value per line and see what is executing and what is not. :)

And please stop calling me bro.
 
Back
Top