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

Solved [TFS 1.2] Conversion of talkaction

Caduceus

Unknown Member
Joined
May 10, 2010
Messages
321
Solutions
2
Reaction score
24
trying to convert this script to 1.2. As of right now the aura turns on, but the actual aura does not work. I am sure the script is far from correct. Any help is appreciated.


Code:
    local aurastr = 25950 -- storage of aura
    local estr = 25951 -- storage for exhaust
    local porcentagem = 40 -- chance to heal in every turn of the aura, in percentage
    local quantheal = 2 -- percentage of the maximum hp each healing will heal . (In the case, will cure 10% of maximum hp each cure)
    local tempo = 1800 -- time to go around the player (this time was what I found most visually pleasing, it is recommended not to change)
    local tipoaura = 38 -- effect of number aura (distance effect, can be identified by !x in the game) 37
    local efeitocura = 49 -- effect curing when the number reaches the player (fixed position effect, can be identified with !z in the game)

-- calling function the aura
local function Aura(i,tm,cid)
local player = Player(cid)
    if not player then
        return true
    end
        local playerPos = player:getPosition()
        local posaura = {
            {x=(playerPos.x)-1, y=(playerPos.y)-1, z=playerPos.z},
            {x=playerPos.x, y=(playerPos.y)-1, z=playerPos.z},
            {x=(playerPos.x)+1, y=(playerPos.y)-1, z=playerPos.z},
            {x=(playerPos.x)+1, y=playerPos.y, z=playerPos.z},
            {x=(playerPos.x)+1, y=(playerPos.y)+1, z=playerPos.z},
            {x=playerPos.x, y=(playerPos.y)+1, z=playerPos.z},
            {x=(playerPos.x)-1, y=(playerPos.y)+1, z=playerPos.z},
            {x=(playerPos.x)-1, y=playerPos.y, z=playerPos.z},
        }
        local chances = math.random(100)
        if(chances<=porcentagem/8 and playergetHealth(cid)<player:getMaxHealth()) then
            player:AddHealth(player:getMaxHealth()/quantheal)
            if(i<=8 and i>1) then
                doSendDistanceShoot({x=posaura[i].x, y=posaura[i].y, z=posaura[i].z}, playerPos, tipoaura)
            else
                doSendDistanceShoot({x=posaura[1].x, y=posaura[1].y, z=posaura[1].z}, playerPos, tipoaura)
            end
            doSendMagicEffect(playerPos, 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 player:getStorageValue(aurastr) ==2 then
            i = i + 1
            tm = tempo/8
            return addEvent(Aura,tm,i,tm)
        elseif i > 8 and player:getStorageValue(aurastr) ==2 then
            return Aura(1,0,cid)
        else
            return true
        end
    end

-- main Function
function onSay(player, words, param)
    if param == "on" then
        if player:getStorageValue(estr) > os.time() then
            player:sendCancelMessage("You must wait "..(player:getStorageValue(estr) - os.time()).." seconds to enable aura again.")
        else
            if player:getStorageValue(aurastr) == 2 then
                player:sendCancelMessage("Your aura is already enabled.")
            elseif player:getStorageValue(aurastr) ==-1 then
                player:sendCancelMessage("Aura On!")
                player:setStorageValue(aurastr, 2)
                Aura(1,tempo/8)
            end
        end
    elseif param == "off" then
        if player:getStorageValue(aurastr) ==2 then
            player:setStorageValue(estr, os.time()+2)
            player:setStorageValue(aurastr, -1)
            player:sendCancelMessage("Aura off!")
        end
    else  
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Enter '!Aura on' to turn aura on and '!Aura off' to turn it off.")
    end
    return true
end
 
Original script: source unknown

Code:
    local aurastr = 25950 -- storage of aura
    local estr = 25951 -- storage for exhaust
    local porcentagem = 40 -- chance to heal in every turn of the aura, in percentage
    local quantheal = 2 -- percentage of the maximum hp each healing will heal . (In the case, will cure 10% of maximum hp each cure)
    local tempo = 500 -- time to go around the player (this time was what I found most visually pleasing, it is recommended not to change)
    local tipoaura = 38 -- effect of number aura (distance effect, can be identified by !x in the game) 37
    local efeitocura = 49 -- effect curing when the number reaches the player (fixed position effect, can be identified with !z in the game)

-- calling function the aura
function Aura(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(Aura,tm,i,tm,cid)
        elseif(i>8 and getPlayerStorageValue(cid, aurastr)==2) then
            return Aura(1,0,cid)
        else
            return TRUE
        end
    else
        return TRUE
    end
end

-- main Function
function onSay(cid, words, param, channel)
    if(param=="on") then
        if getPlayerStorageValue(cid, estr) > os.time() then
            doPlayerSendCancel(cid, "You must wait "..(getPlayerStorageValue(cid, estr) - os.time()).." seconds to enable aura again.")
        else
            if(getPlayerStorageValue(cid, aurastr)==2) then
                doPlayerSendCancel(cid,"Your aura is already enabled.")
            elseif(getPlayerStorageValue(cid, aurastr)==-1) then
                doPlayerSendCancel(cid,"Aura On!")
                setPlayerStorageValue(cid, aurastr, 2)
                Aura(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 off!")
        end
    else   
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Enter '!Aura on' to turn aura on and '!Aura off' to turn it off.")
    end
    return TRUE
end
 
Original script: source unknown

Code:
    local aurastr = 25950 -- storage of aura
    local estr = 25951 -- storage for exhaust
    local porcentagem = 40 -- chance to heal in every turn of the aura, in percentage
    local quantheal = 2 -- percentage of the maximum hp each healing will heal . (In the case, will cure 10% of maximum hp each cure)
    local tempo = 500 -- time to go around the player (this time was what I found most visually pleasing, it is recommended not to change)
    local tipoaura = 38 -- effect of number aura (distance effect, can be identified by !x in the game) 37
    local efeitocura = 49 -- effect curing when the number reaches the player (fixed position effect, can be identified with !z in the game)

-- calling function the aura
function Aura(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(Aura,tm,i,tm,cid)
        elseif(i>8 and getPlayerStorageValue(cid, aurastr)==2) then
            return Aura(1,0,cid)
        else
            return TRUE
        end
    else
        return TRUE
    end
end

-- main Function
function onSay(cid, words, param, channel)
    if(param=="on") then
        if getPlayerStorageValue(cid, estr) > os.time() then
            doPlayerSendCancel(cid, "You must wait "..(getPlayerStorageValue(cid, estr) - os.time()).." seconds to enable aura again.")
        else
            if(getPlayerStorageValue(cid, aurastr)==2) then
                doPlayerSendCancel(cid,"Your aura is already enabled.")
            elseif(getPlayerStorageValue(cid, aurastr)==-1) then
                doPlayerSendCancel(cid,"Aura On!")
                setPlayerStorageValue(cid, aurastr, 2)
                Aura(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 off!")
        end
    else  
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Enter '!Aura on' to turn aura on and '!Aura off' to turn it off.")
    end
    return TRUE
end

Code:
local aurastr = 25950 -- storage of aura
local estr = 25951 -- storage for exhaust
local porcentagem = 40 -- chance to heal in every turn of the aura, in percentage
local quantheal = 20 -- percentage of the maximum hp each healing will heal . (In the case, will cure 10% of maximum hp each cure)
local tempo = 500 -- time to go around the player (this time was what I found most visually pleasing, it is recommended not to change)
local tipoaura = 38 -- effect of number aura (distance effect, can be identified by !x in the game) 37
local efeitocura = 49 -- effect curing when the number reaches the player (fixed position effect, can be identified with !z in the game)

-- calling function the aura
function Aura(i,tm, cid)
    local player = Player(cid)
    if not player then
        return
    end
   
    local atual = player:getPosition()
    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 player:getHealth() < player:getMaxHealth()) then
        player:addHealth(player:getMaxHealth()/quantheal)
        local pos
        if(i<=8 and i>1) then
            pos = Position({x=posaura[i].x, y=posaura[i].y, z=posaura[i].z})
        else
            pos = Position({x=posaura[1].x, y=posaura[1].y, z=posaura[1].z})
        end
        if pos then
            pos:sendDistanceEffect(atual, tipoaura)
        end
        atual:sendMagicEffect(efeitocura)
    end
    local pos
    if(i==8) then
        pos = Position({x=posaura[i].x, y=posaura[i].y, z=posaura[i].z})
        pos:sendDistanceEffect(Position({x=posaura[1].x, y=posaura[1].y, z=posaura[1].z}), tipoaura)
    elseif(i<8) then
        pos = Position({x=posaura[i].x, y=posaura[i].y, z=posaura[i].z})
        pos:sendDistanceEffect(Position({x=posaura[i+1].x, y=posaura[i+1].y, z=posaura[i+1].z}), tipoaura)
    end
    if(i<=8 and player:getStorageValue(aurastr)==2) then
        i = i+1
        tm = tempo/8
        return addEvent(Aura,tm,i,tm,player:getId())
    elseif(i>8 and player:getStorageValue(aurastr)==2) then
        return Aura(1,0,player)
    else
        return true
    end
    return true
end

-- main Function
function onSay(player, words, param, channel)
    if(param=="on") then
        if player:getStorageValue(estr) > os.time() then
            player:sendCancelMessage("You must wait "..(player:getStorageValue(estr) - os.time()).." seconds to enable aura again.")
        else
            if(player:getStorageValue(aurastr)==2) then
                player:sendCancelMessage("Your aura is already enabled.")
            elseif(player:getStorageValue(aurastr)==-1) then
                player:sendCancelMessage("Aura On!")
                player:setStorageValue(aurastr, 2)
                Aura(1,tempo/8, player:getId())
            end
        end
    elseif(param=="off") then
        if(player:getStorageValue(aurastr)==2) then
            player:setStorageValue(estr, os.time()+2)
            player:setStorageValue(aurastr, -1)
            player:sendCancelMessage("Aura off!")
        end
    else  
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Enter '!Aura on' to turn aura on and '!Aura off' to turn it off.")
    end
    return false
end
 
Back
Top