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

RevScripts 2 scripts need, chest + effect

Paxiz

Premium User
Premium User
Joined
Mar 21, 2024
Messages
44
Solutions
1
Reaction score
21
Location
~pl /opt
I need two scripts.
1. Need script to chest example evolunia quest chest, quest chest have storage 4444 and give to storage 5555 +1.
2. Need script to send effect (485) with interval 3s on Tutor, Senior Tutor, GM or other support rank.

TFS 1.4.2
 
Solution
X
LUA:
local config = {
    actionId = 4444, -- put on chest
    chestStorage = 4444,
    addStorage = 5555,
    reward = {itemId = 1111, amount = 1}
}

local action = Action()

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(config.chestStorage) == 1 then
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end
    player:setStorageValue(config.chestStorage, 1)
    player:addItem(config.reward.itemId, config.reward.amount, true)
  
    local addStorage = player:getStorageValue(config.addStorage)
    addStorage = addStorage <= 0 and 0 or addStorage
    addStorage = addStorage + 1
    player:setStorageValue(config.addStorage, addStorage)
    return...
LUA:
local config = {
    actionId = 4444, -- put on chest
    chestStorage = 4444,
    addStorage = 5555,
    reward = {itemId = 1111, amount = 1}
}

local action = Action()

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(config.chestStorage) == 1 then
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end
    player:setStorageValue(config.chestStorage, 1)
    player:addItem(config.reward.itemId, config.reward.amount, true)
  
    local addStorage = player:getStorageValue(config.addStorage)
    addStorage = addStorage <= 0 and 0 or addStorage
    addStorage = addStorage + 1
    player:setStorageValue(config.addStorage, addStorage)
    return true
end

action:aid(config.actionId)
action:register()
LUA:
local config = {
    [1] = {effect = 1}, -- player
    [2] = {effect = 2}, -- tutor
    [3] = {effect = 3}, -- senior tutor
    [4] = {effect = 4}, -- gamemaster
    [5] = {effect = 5}, -- community manager
    [6] = {effect = 6}  -- god
}

local globalevent = GlobalEvent("onThink_groupEffect")

function globalevent.onThink()
    for _, player in ipairs(Game.getPlayers()) do
        local groupId = player:getGroup():getId()
        if config[groupId] then
            player:getPosition():sendMagicEffect(config[groupId].effect)
        end
    end
    return true
end

globalevent:interval(3000) -- will be executed every 3000ms
globalevent:register()
 
Solution
Back
Top