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

revscript aura system

QuebradaZN

New Member
Joined
May 5, 2019
Messages
12
Solutions
1
Reaction score
2
Good night people
I was using a tfs 1.3 pack more, I decided to migrate to otservbr (revscript)
I have an aura system, on tfs 1.3 it works perfectly, on otservbr when equipped, it has a multiplied effect, you can equip more than 1x, I tried several modes ...
Maybe you could have expressed me badly

MoveMent
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 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 = 31 -- número do efeito da aura (efeito de distância, pode ser identificado com /x no jogo)
    efeitocura = 54 -- 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
local auraequip = MoveEvent()

function auraequip.onEquip(player, item, slots_t, isCheck)
    local slots_t = player:getSlotItem(CONST_SLOT_RING)
                    if slots_t and slots_t.itemid == item.itemid then
                        return false
                    end
                    doPlayerSendCancel(player,"Você Ativou a Aura!")
            setPlayerStorageValue(player, aurastr, 2)
            efeitosAura(1,tempo/8,player.uid)
    return true
end

auraequip:type("equip")
auraequip:id(9003)
auraequip:register()

auradequip = MoveEvent()

function auradequip.onDeEquip(player, item, slots_t, isCheck)
    if(getPlayerStorageValue(player, aurastr)==2) then
            setPlayerStorageValue(player, estr, os.time()+2)
            setPlayerStorageValue(player, aurastr, -1)
            doPlayerSendCancel(player,"Você Desativou a Aura!")
    return true
end
end
auradequip:type("deequip")
auradequip:id(9003)
auradequip:register()
 
OP
Q

QuebradaZN

New Member
Joined
May 5, 2019
Messages
12
Solutions
1
Reaction score
2

I did it that way, Still no solution, correct me if I'm wrong, please!

Lua:
local auraequip = MoveEvent()
function auraequip.onEquip(player, item, slot, isCheck)
    if not isCheck then
   
local slot = player:getSlotItem(CONST_SLOT_RING)
                    if slot and slot.itemid == item.itemid then
                        return false
                    end
                    doPlayerSendCancel(player,"Você Ativou a Aura!")
            setPlayerStorageValue(player, aurastr, 2)
            efeitosAura(1,tempo/8,player.uid)
    return true
end
end
       
auraequip:type("equip")
auraequip:id(9003)
auraequip:register()

@EDIT After adding the code after isCheck, it does not equip
 
Last edited:

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,522
Solutions
378
Reaction score
3,638

I did it that way, Still no solution, correct me if I'm wrong, please!

Lua:
local auraequip = MoveEvent()
function auraequip.onEquip(player, item, slot, isCheck)
    if not isCheck then
  
local slot = player:getSlotItem(CONST_SLOT_RING)
                    if slot and slot.itemid == item.itemid then
                        return false
                    end
                    doPlayerSendCancel(player,"Você Ativou a Aura!")
            setPlayerStorageValue(player, aurastr, 2)
            efeitosAura(1,tempo/8,player.uid)
    return true
end
end
      
auraequip:type("equip")
auraequip:id(9003)
auraequip:register()

@EDIT After adding the code after isCheck, it does not equip
Start here, and make sure it works, and prints to console properly.

Then try to integrate your script after confirming a bare-bones ring equip & de-equip work properly.

Lua:
local onEquip_Aura = MoveEvent()

function onEquip_Aura.onEquip(player, item, slot, isCheck)
    print("attempting to equip...")
    if not isCheck then
        print("item equipped successfully.")
    end
    return true
end

onEquip_Aura:slot("ring")
onEquip_Aura:id(9003)
onEquip_Aura:register()


local onDeEquip_Aura = MoveEvent()

function onDeEquip_Aura.onDeEquip(player, item, slot, isCheck)
    print("attempting to De-equip...")
    if not isCheck then
        print("item De-equipped successfully.")
    end
    return true
end

onDeEquip_Aura:slot("ring")
onDeEquip_Aura:id(9003)
onDeEquip_Aura:register()
 
OP
Q

QuebradaZN

New Member
Joined
May 5, 2019
Messages
12
Solutions
1
Reaction score
2
Start here, and make sure it works, and prints to console properly.

Then try to integrate your script after confirming a bare-bones ring equip & de-equip work properly.

Lua:
local onEquip_Aura = MoveEvent()

function onEquip_Aura.onEquip(player, item, slot, isCheck)
    print("attempting to equip...")
    if not isCheck then
        print("item equipped successfully.")
    end
    return true
end

onEquip_Aura:slot("ring")
onEquip_Aura:id(9003)
onEquip_Aura:register()


local onDeEquip_Aura = MoveEvent()

function onDeEquip_Aura.onDeEquip(player, item, slot, isCheck)
    print("attempting to De-equip...")
    if not isCheck then
        print("item De-equipped successfully.")
    end
    return true
end

onDeEquip_Aura:slot("ring")
onDeEquip_Aura:id(9003)
onDeEquip_Aura:register()
I may be doing something wrong, it didn’t work, I tested the team’s ring in another ring, but it’s not the ring’s effect ... :(
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,522
Solutions
378
Reaction score
3,638
Someone else will probably need to chime in here.

Might be an otservbr issue and/or different formatting required for the revscript.

Just in case though.. make sure that your ring isn't registered in movements.xml, otherwise it would over-ride this new script
 
OP
Q

QuebradaZN

New Member
Joined
May 5, 2019
Messages
12
Solutions
1
Reaction score
2
Someone else will probably need to chime in here.

Might be an otservbr issue and/or different formatting required for the revscript.

Just in case though.. make sure that your ring isn't registered in movements.xml, otherwise it would over-ride this new script

Capturar.PNG
in another datapack it works perfectly, after I started using revscript I got the problem!

I will continue to try hard to solve
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Support Team
Joined
Mar 16, 2017
Messages
989
Solutions
96
Reaction score
1,012
Location
London
GitHub
MillhioreBT
The script from the first post that opens this thread works fine!
Most likely, the problem you have on your server is due to modifications you made in the sources!
the files that could affect this system could be modifications in player.cpp or movement.cpp

btw and for the love of god use local variables 😑
Whenever I hear something related to OTServBR I see scripts working with global variables, Lua was created in Brazil and even so they don't know how to write in lua :D
Please do not be offended, it is just a small scolding so that you do not make this mistake later, since in the future you could have conflicts between scripts that use the same variable names XD
 
Last edited:
Top