- Joined
- Mar 16, 2017
- Messages
- 1,439
- Solutions
- 158
- Reaction score
- 2,034
- Location
- London
- GitHub
- MillhioreBT
- Twitch
- millhiorebt
Hello everyone,
I hope you're all doing well. Today, I'm here to share a very simple aura system for TFS 1.5 that I think you'll find interesting. This system has some basic but useful configurations that can add a new touch to your gameplay.
One of the options available is the ability to add a storage system for VIP users. Additionally, you can set requirements for equipped items, which can add an extra layer of challenge to your game.
You can activate the aura using a simple command, or you can set it to automatically activate upon login. It's worth noting that if you have the equipped item requirement enabled, the aura will disappear or appear depending on whether or not you have the required item equipped.
Overall, this system is a great way to add some extra fun and challenge to your game. Give it a try and let me know what you think!
I hope you're all doing well. Today, I'm here to share a very simple aura system for TFS 1.5 that I think you'll find interesting. This system has some basic but useful configurations that can add a new touch to your gameplay.
One of the options available is the ability to add a storage system for VIP users. Additionally, you can set requirements for equipped items, which can add an extra layer of challenge to your game.
You can activate the aura using a simple command, or you can set it to automatically activate upon login. It's worth noting that if you have the equipped item requirement enabled, the aura will disappear or appear depending on whether or not you have the required item equipped.
Overall, this system is a great way to add some extra fun and challenge to your game. Give it a try and let me know what you think!
data/scripts/simple_aura.lua
Lua:
--[[
Simple Aura System
By: 𝓜𝓲𝓵𝓵𝓱𝓲𝓸𝓻𝓮 𝓑𝓣
Version: 1.1
TFS 1.5
]]--
local simpleAura = {
talkAction = "!aura",
distanceEffect = CONST_ANI_ENERGY,
vipStorage = 100000,
autoStartOnLogin = true,
onlyWhenEquippedItems = {
[CONST_SLOT_LEFT] = 8931,
[CONST_SLOT_RIGHT] = 8931
},
auxTable = {} -- don't touch this
}
local directions = {
DIRECTION_NORTH,
DIRECTION_NORTHEAST,
DIRECTION_EAST,
DIRECTION_SOUTHEAST,
DIRECTION_SOUTH,
DIRECTION_SOUTHWEST,
DIRECTION_WEST,
DIRECTION_NORTHWEST,
DIRECTION_NORTH
}
function simpleAura.checkItems(player)
for slotIndex, itemId in pairs(simpleAura.onlyWhenEquippedItems) do
local slotItem = player:getSlotItem(slotIndex)
if not slotItem or slotItem:getId() ~= itemId then
return false
end
end
return true
end
if next(simpleAura.onlyWhenEquippedItems) then
local ec = EventCallback
function ec.onItemMoved(player, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
local containerPos = toPosition.x == CONTAINER_POSITION and toPosition or fromPosition
if containerPos.x == CONTAINER_POSITION then
local slotIndex = simpleAura.onlyWhenEquippedItems[containerPos.y]
if slotIndex then
if simpleAura.checkItems(player) then
simpleAura.init(player)
else
simpleAura.stop(player)
end
else
simpleAura.stop(player)
end
end
end
ec:register(--[[0]])
end
function simpleAura.init(player)
local playerId = player:getId()
if not simpleAura.auxTable[playerId] then
simpleAura.auxTable[playerId] = {}
end
if player:getStorageValue(simpleAura.vipStorage) <= 0 then
return
end
local lastDirection = nil
local auxTable = simpleAura.auxTable[playerId]
for index, direction in pairs(directions) do
auxTable[index] = addEvent(simpleAura.iterate, 125 * (index - 1), playerId, direction, lastDirection, index)
lastDirection = direction
end
end
function simpleAura.iterate(playerId, direction, lastDirection, index)
local player = Player(playerId)
if not player then
return
end
if lastDirection then
local lastPos = player:getPosition()
lastPos:getNextPosition(lastDirection)
local pos = player:getPosition()
pos:getNextPosition(direction)
lastPos:sendDistanceEffect(pos, simpleAura.distanceEffect)
end
if index == 9 then
simpleAura.init(player)
end
end
function simpleAura.stop(player)
local playerId = player:getId()
local auxTable = simpleAura.auxTable[playerId]
if auxTable then
for _, eventId in pairs(auxTable) do
stopEvent(eventId)
end
simpleAura.auxTable[playerId] = nil
end
return true
end
local talkAction = TalkAction(simpleAura.talkAction)
function talkAction.onSay(player, words, param, type)
if simpleAura.checkItems(player) then
local auxTable = simpleAura.auxTable[player:getId()] or {}
if #auxTable ~= 0 then
player:sendCancelMessage("You already have an aura active.")
return false
end
simpleAura.init(player)
end
return false
end
talkAction:register()
if simpleAura.autoStartOnLogin then
local creatureEvent = CreatureEvent("AuraOnLogin")
function creatureEvent.onLogin(player)
if simpleAura.checkItems(player) then
simpleAura.init(player)
end
return true
end
creatureEvent:register()
local creatureEvent = CreatureEvent("AuraOnLogout")
creatureEvent.onLogout = simpleAura.stop
creatureEvent:register()
end
Last edited: