RevScript Aura System

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Aura System TalkAction
TFS 1.X +



Nos iremos en data/scripts/talkactions/player e crearemos un archivo llamado aura.lua:

local getAurax = TalkAction("!aura")
local config_aurea = {
effect = 4; -- effecto que girara en el player
effect_health = 162; -- effecto cuando curara al player
level_use = { -- nivel que sera utilizado (min/max)
min = 20,
max = 600,
} ;
health = 10; -- lo que curara por el tiempo
pos_aurea = { -- no tocar
[1] = {x = 0, y = -1};
[2] = {x = 1, y = -1};
[3] = {x = 1, y = 0};
[4] = {x = 1, y = 1};
[5] = {x = 0, y = 1};
[6] = {x = -1, y = 1};
[7] = {x = -1, y = 0};
[8] = {x = -1, y = -1};
};
storage_pos = 1547637649; -- no tocar
storage = 165477963; -- no tocar
tempo_aurea = 700; -- tiempo de aura para pasar en cada posicion
}

local function calculePosAurea(player_uid)
local player = Player(player_uid)
if(not(player))then
return(nil)
end

if(player:getStorageValue(config_aurea.storage) <= 0)then
return(nil)
end

if(player:getStorageValue(config_aurea.storage_pos) >= 8)then
player:setStorageValue(config_aurea.storage_pos, 0)
end

player:setStorageValue(config_aurea.storage_pos, player:getStorageValue(config_aurea.storage_pos) + 1)
return(player:getStorageValue(config_aurea.storage_pos))
end

local function posAurea(player_uid)
local player = Player(player_uid)
if(not(player))then
return(nil)
end

if(player:getStorageValue(config_aurea.storage) <= 0)then
return(nil)
end

local pos_x = player:getPosition().x
local pos_y = player:getPosition().y
local pos_z = player:getPosition().z

local aa = calculePosAurea(player_uid)

local pos = Position(pos_x + config_aurea.pos_aurea[aa].x, pos_y + config_aurea.pos_aurea[aa].y, pos_z)
if(not(pos))then
return(nil)
end
return(pos)
end

local function aurea(player_uid)
local player = Player(player_uid)
if(not(player))then
return(nil)
end

if(player:getStorageValue(config_aurea.storage) <= 0)then
return(nil)
end

player:addHealth(config_aurea.health)
player:getPosition():sendMagicEffect(config_aurea.effect_health)

local position = posAurea(player_uid)
position:sendMagicEffect(config_aurea.effect)
addEvent(aurea, config_aurea.tempo_aurea, player_uid)
end

function getAurax.onSay(player, words, param)
if(words == "!aura on")then
if(player:getLevel() > config_aurea.level_use.max)then
return(not(player:sendTextMessage(MESSAGE_STATUS_SMALL, player:getName() .. " seu level(" .. player:getLevel() .. ") precisa ser maior(" .. config_aurea.level_use.max)))
end

if(player:getLevel() < config_aurea.level_use.min)then
return(not(player:sendTextMessage(MESSAGE_STATUS_SMALL, player:getName() .. " seu level(" .. player:getLevel() .. ") precisa ser menor(" .. config_aurea.level_use.max)))
end

if(player:getStorageValue(config_aurea.storage) >= 1)then
return(not(player:sendTextMessage(MESSAGE_STATUS_SMALL, player:getName() .. " Você ja esta com a aurea ligada")))
end

player:setStorageValue(config_aurea.storage, 1)
player:setStorageValue(config_aurea.storage_pos, 0)
aurea(player.uid)
elseif(words == "!aura off")then
player:setStorageValue(config_aurea.storage, 0)
end
return(false)
end


getAurax:separator(" ")
getAurax:register()

En data/scripts/creaturescripts/others/login.lua añadiremos:

encima de:
player:sendTextMessage(MESSAGE_STATUS, "Welcome to " .. SERVER_NAME .. "!")
pondremos:
player:setStorageValue(165477963, 0)
player:setStorageValue(1547637649, 0)

Ha sido probado en TFS 1.+ sin ser convertido en RevScript.
Si alguien tiene y lo quiere normal, sin Revscript, aquí tiene:

Talkaction ( aura.lua ):

local config_aurea = {
effect = 4; -- effecto que girara en el player
effect_health = 162; -- effecto cuando curara al player
level_use = { -- nivel que sera utilizado (min/max)
min = 1,
max = 600,
} ;
health = 10; -- lo que curara por el tiempo
pos_aurea = { -- no tocar
[1] = {x = 0, y = -1};
[2] = {x = 1, y = -1};
[3] = {x = 1, y = 0};
[4] = {x = 1, y = 1};
[5] = {x = 0, y = 1};
[6] = {x = -1, y = 1};
[7] = {x = -1, y = 0};
[8] = {x = -1, y = -1};
};
storage_pos = 1547637649; -- no tocar
storage = 165477963; -- no tocar
tempo_aurea = 100; -- tiempo de aura para pasar en cada posicion
}

local function calculePosAurea(player_uid)
local player = Player(player_uid)
if(not(player))then
return(nil)
end

if(player:getStorageValue(config_aurea.storage) <= 0)then
return(nil)
end

if(player:getStorageValue(config_aurea.storage_pos) >= 8)then
player:setStorageValue(config_aurea.storage_pos, 0)
end

player:setStorageValue(config_aurea.storage_pos, player:getStorageValue(config_aurea.storage_pos) + 1)
return(player:getStorageValue(config_aurea.storage_pos))
end

local function posAurea(player_uid)
local player = Player(player_uid)
if(not(player))then
return(nil)
end

if(player:getStorageValue(config_aurea.storage) <= 0)then
return(nil)
end

local pos_x = player:getPosition().x
local pos_y = player:getPosition().y
local pos_z = player:getPosition().z

local aa = calculePosAurea(player_uid)

local pos = Position(pos_x + config_aurea.pos_aurea[aa].x, pos_y + config_aurea.pos_aurea[aa].y, pos_z)
if(not(pos))then
return(nil)
end
return(pos)
end

local function aurea(player_uid)
local player = Player(player_uid)
if(not(player))then
return(nil)
end

if(player:getStorageValue(config_aurea.storage) <= 0)then
return(nil)
end

player:addHealth(config_aurea.health)
player:getPosition():sendMagicEffect(config_aurea.effect_health)

local position = posAurea(player_uid)
position:sendMagicEffect(config_aurea.effect)
addEvent(aurea, config_aurea.tempo_aurea, player_uid)
end

function onSay(player, words, param)
if(words == "!aura on")then
if(player:getLevel() > config_aurea.level_use.max)then
return(not(player:sendTextMessage(MESSAGE_STATUS_SMALL, player:getName() .. " seu level(" .. player:getLevel() .. ") precisa ser maior(" .. config_aurea.level_use.max)))
end

if(player:getLevel() < config_aurea.level_use.min)then
return(not(player:sendTextMessage(MESSAGE_STATUS_SMALL, player:getName() .. " seu level(" .. player:getLevel() .. ") precisa ser menor(" .. config_aurea.level_use.max)))
end

if(player:getStorageValue(config_aurea.storage) >= 1)then
return(not(player:sendTextMessage(MESSAGE_STATUS_SMALL, player:getName() .. " Você ja esta com a aurea ligada")))
end

player:setStorageValue(config_aurea.storage, 1)
player:setStorageValue(config_aurea.storage_pos, 0)
aurea(player.uid)
elseif(words == "!aura off")then
player:setStorageValue(config_aurea.storage, 0)
end
return(false)
end

En talkactions.xml
<talkaction words="!aura on;!aura off" script="aura.lua"/>
y en login.lua:
player:setStorageValue(165477963, 0)
player:setStorageValue(1547637649, 0)
 

Shuyin

Miembro
LV
23
 
Awards
17
Este script me manda error en las lineas 25, 43 y 66. He probado de quitarlos y no da error luego pero tampoco hace nada xD
 

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Este script me manda error en las lineas 25, 43 y 66. He probado de quitarlos y no da error luego pero tampoco hace nada xD
Es possible que no funcione, es TFS 1.x , pero script, solamente le añadimos el register, el local función.
Pienso y es possible que se deba de registrar separado los paquetes.este revscripts no lo probé
 

Shuyin

Miembro
LV
23
 
Awards
17
Hola, este seria el script que funciona haciendo !aura on o !aura off, al parecer es infinito xD. Esto que es como un bonus para subir mas facil hasta cierto nivel? xd

local getAurax = TalkAction("!aura")
local config_aurea = {
effect = 4; -- effecto que girara en el player
effect_health = 162; -- effecto cuando curara al player
level_use = { -- nivel que sera utilizado (min/max)
min = 20,
max = 600,
} ;
health = 10; -- lo que curara por el tiempo
pos_aurea = { -- no tocar
[1] = {x = 0, y = -1};
[2] = {x = 1, y = -1};
[3] = {x = 1, y = 0};
[4] = {x = 1, y = 1};
[5] = {x = 0, y = 1};
[6] = {x = -1, y = 1};
[7] = {x = -1, y = 0};
[8] = {x = -1, y = -1};
};
storage_pos = 1547637649; -- no tocar
storage = 165477963; -- no tocar
tempo_aurea = 700; -- tiempo de aura para pasar en cada posicion
}

local function calculePosAurea(player_uid)
local player = Player(player_uid)
if(not(player))then
return(nil)
end

if(player:getStorageValue(config_aurea.storage) <= 0)then
return(nil)
end

if(player:getStorageValue(config_aurea.storage_pos) >= 8)then
player:setStorageValue(config_aurea.storage_pos, 0)
end

player:setStorageValue(config_aurea.storage_pos, player:getStorageValue(config_aurea.storage_pos) + 1)
return(player:getStorageValue(config_aurea.storage_pos))
end

local function posAurea(player_uid)
local player = Player(player_uid)
if(not(player))then
return(nil)
end

if(player:getStorageValue(config_aurea.storage) <= 0)then
return(nil)
end

local pos_x = player:getPosition().x
local pos_y = player:getPosition().y
local pos_z = player:getPosition().z

local aa = calculePosAurea(player_uid)

local pos = Position(pos_x + config_aurea.pos_aurea[aa].x, pos_y + config_aurea.pos_aurea[aa].y, pos_z)
if(not(pos))then
return(nil)
end
return(pos)
end

local function aurea(player_uid)
local player = Player(player_uid)
if(not(player))then
return(nil)
end

if(player:getStorageValue(config_aurea.storage) <= 0)then
return(nil)
end

player:addHealth(config_aurea.health)
player:getPosition():sendMagicEffect(config_aurea.effect_health)

local position = posAurea(player_uid)
position:sendMagicEffect(config_aurea.effect)
addEvent(aurea, config_aurea.tempo_aurea, player_uid)
end

function getAurax.onSay(player, words, param)
if(words == "!aura on")then
if(player:getLevel() > config_aurea.level_use.max)then
return(not(player:sendTextMessage(MESSAGE_STATUS_SMALL, player:getName() .. " seu level(" .. player:getLevel() .. ") precisa ser maior(" .. config_aurea.level_use.max)))
end

if(player:getLevel() < config_aurea.level_use.min)then
return(not(player:sendTextMessage(MESSAGE_STATUS_SMALL, player:getName() .. " seu level(" .. player:getLevel() .. ") precisa ser menor(" .. config_aurea.level_use.max)))
end

if(player:getStorageValue(config_aurea.storage) >= 1)then
return(not(player:sendTextMessage(MESSAGE_STATUS_SMALL, player:getName() .. " Você ja esta com a aurea ligada")))
end

player:setStorageValue(config_aurea.storage, 1)
player:setStorageValue(config_aurea.storage_pos, 0)
aurea(player.uid)
elseif(words == "!aura off")then
player:setStorageValue(config_aurea.storage, 0)
end
return(false)
end


getAurax:separator(" ")
getAurax:register()
 
Última edición por un moderador:

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Hola, este seria el script que funciona haciendo !aura on o !aura off, al parecer es infinito xD. Esto que es como un bonus para subir mas facil hasta cierto nivel? xd

El Aura es infinito, correcto.
Es una Aura.. Luego hay que acomodarlo si se desea que haga algo, pero hay que conocer el lua.
 

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Arriba