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

TFS 1.X+ aura system

jel

Member
Joined
Mar 22, 2014
Messages
302
Reaction score
12
Does anyone help me with this error?
aura system, use tfs 1.3

capture-20190114-204240.png
 

Attachments

  • capture-20190114-204240.png
    capture-20190114-204240.png
    6.9 KB · Views: 13 · VirusTotal
Solution
-- CONFIGURAÇÕES
aurastr = 125950 -- storage da aura
estr = 25951 -- storage para o exhaust
porcentagem = 100 -- chance de curar em cada volta da aura, em porcentagem
quantheal = 90 -- porcentagem do hp máximo que cada cura irá curar. (No caso, irá curar 10% do hp máximo cada cura)
tempo = 1200 -- tempo para dar uma volta no player (este tempo foi o que achei mais agradável visualmente, é recomendável não mudar)
tipoaura = 31 -- número do efeito da aura (efeito de distância, pode ser identificado com /x no jogo)
efeitocura = 36 -- 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)...
It would help if you posted the code?

More than likely you are not pushing the playerid and pushing the whole structure.

local player = Player(cid)

addevent blah blah player
instead of addevent blah blah player:getId()
 
It would help if you posted the code?

More than likely you are not pushing the playerid and pushing the whole structure.

local player = Player(cid)

addevent blah blah player
instead of addevent blah blah player:getId()
-- CONFIGURAÇÕES
aurastr = 125950 -- storage da aura
estr = 25951 -- storage para o exhaust
porcentagem = 100 -- chance de curar em cada volta da aura, em porcentagem
quantheal = 90 -- porcentagem do hp máximo que cada cura irá curar. (No caso, irá curar 10% do hp máximo cada cura)
tempo = 1200 -- tempo para dar uma volta no player (este tempo foi o que achei mais agradável visualmente, é recomendável não mudar)
tipoaura = 31 -- número do efeito da aura (efeito de distância, pode ser identificado com /x no jogo)
efeitocura = 36 -- 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},
}

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, aurastr)==2) then
setPlayerStorageValue(cid, estr, os.time()+2)
setPlayerStorageValue(cid, aurastr, -1)
doPlayerSendCancel(cid,"Você desligou a Aura!")
else
doPlayerSendCancel(cid,"Você ligou a Aura!")
setPlayerStorageValue(cid, aurastr, 2)
efeitosAura(1,tempo/8,cid)
end
return true
end
 
-- CONFIGURAÇÕES
aurastr = 125950 -- storage da aura
estr = 25951 -- storage para o exhaust
porcentagem = 100 -- chance de curar em cada volta da aura, em porcentagem
quantheal = 90 -- porcentagem do hp máximo que cada cura irá curar. (No caso, irá curar 10% do hp máximo cada cura)
tempo = 1200 -- tempo para dar uma volta no player (este tempo foi o que achei mais agradável visualmente, é recomendável não mudar)
tipoaura = 31 -- número do efeito da aura (efeito de distância, pode ser identificado com /x no jogo)
efeitocura = 36 -- 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},
}

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, aurastr)==2) then
setPlayerStorageValue(cid, estr, os.time()+2)
setPlayerStorageValue(cid, aurastr, -1)
doPlayerSendCancel(cid,"Você desligou a Aura!")
else
doPlayerSendCancel(cid,"Você ligou a Aura!")
setPlayerStorageValue(cid, aurastr, 2)
efeitosAura(1,tempo/8,cid)
end
return true
end
It's because in TFS 1.3 player is passed instead of cid in onUse functions.
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

So try this out, I tried to convert it to work better with 1.3:
Lua:
-- CONFIGURAÇÕES
aurastr = 125950 -- storage da aura
estr = 25951 -- storage para o exhaust
porcentagem = 100 -- chance de curar em cada volta da aura, em porcentagem
quantheal = 90 -- porcentagem do hp máximo que cada cura irá curar. (No caso, irá curar 10% do hp máximo cada cura)
tempo = 1200 -- tempo para dar uma volta no player (este tempo foi o que achei mais agradável visualmente, é recomendável não mudar)
tipoaura = 31 -- número do efeito da aura (efeito de distância, pode ser identificado com /x no jogo)
efeitocura = 36 -- 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)
    local player = Player(cid)
    if player then
        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},
        }

        if i <= 8 and player:getStorageValue(aurastr) == 2 then
            i = i + 1
            tm = tempo / 8
            return addEvent(efeitosAura, tm, i, tm, cid)
        elseif i > 8 and player:getStorageValue(aurastr) == 2 then
            return efeitosAura(1, 0, cid)
        else
            return true
        end
    else
        return true
    end
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(aurastr) == 2 then
        player:setStorageValue(estr, os.time()+2)
        player:setStorageValue(aurastr, -1)
        player:sendCancelMessage("Você desligou a Aura!")
    else
        player:sendCancelMessage("Você ligou a Aura!")
        player:setStorageValue(aurastr, 2)
        efeitosAura(1, tempo / 8, player.uid)
    end
    return true
end
 
Solution
Back
Top