• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

RevScripts TFS 1.3 - Storage Timer Countdown Talkaction

TheMaxwellGates

New Member
Joined
Aug 20, 2020
Messages
10
Solutions
1
Reaction score
3
Hi, friends. I would ask if someone could please help me with a script I was searching and couldn't find anywhere. :p
I need a talkaction (!bosstimer) that once the player send the command, it shows a modal window with the current cooldown to fight the bosses again.

Let me give some details here.

I got, for example, a lever that brings the team of 1-5 people to fight "Grand Master Oberon".
This boss can be fight once every 20 hours, and once the player pulls the lever, the team receives the current storage value that holds the cooldown timer.

The storage they receive when pulling the lever, in this case, is this one:
team:setStorageValue(Storage.BossesStorage.GrandMasterOberonTimer, os.time() + 20*60*60)

On my lib/core/storages, I got this line that holds the storage:
GrandMasterOberonTimer = 50760,

Now, what I'm trying to do is, when a player types !bosstimer, it shows a modal window with all the 50+ bosses I have, and the current cooldown to fight them again.
Like:
Grand Master Oberon 00:00:00
Scarlett Etzel 02:42:10
Izcandar The Banished 07:22:12

Is it possible to be done?
Additional info: I'm a server enthusiastic and not a developer. What I usually try to do, is getting into scripts that already exists, and try to turn them into something that works for me, but this one I haven't found anywhere, this is why I'm asking your help.

Thanks in advance, hope it helps other people that could be searching for it too. :)
 
Solution
Well, maybe what I asked is a bit complex and I couldn't do it without spending money. xD
Up, if you know how to do it, msg me.
not hard at all maybe just no one has time

maybe try with this (did it 2 minutes so might not work, anyways i will keep updating it tomorrow)
Lua:
local bosses = {
    {
        name = "Grand Master Oberon",
        storage = Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer,
    },
    {
        name = "Scarlett Etzel",
        storage = Storage.GraveDanger.CobraBastion.ScarlettTimer,
    }
}

local talk = TalkAction("!bosstimer")
function talk.onSay(player, words, param)
    local window = ModalWindow {
        title = "Boss Timers",
        message = "Select a boss to check the timer."
    }...
OP
OP
TheMaxwellGates

TheMaxwellGates

New Member
Joined
Aug 20, 2020
Messages
10
Solutions
1
Reaction score
3
Well, maybe what I asked is a bit complex and I couldn't do it without spending money. xD
Up, if you know how to do it, msg me.
 

StreamSide

Joseluis Gonzalez
Support Team
Joined
Aug 31, 2007
Messages
3,581
Solutions
51
Reaction score
1,189
Location
Arica - Chile
Well, maybe what I asked is a bit complex and I couldn't do it without spending money. xD
Up, if you know how to do it, msg me.
not hard at all maybe just no one has time

maybe try with this (did it 2 minutes so might not work, anyways i will keep updating it tomorrow)
Lua:
local bosses = {
    {
        name = "Grand Master Oberon",
        storage = Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer,
    },
    {
        name = "Scarlett Etzel",
        storage = Storage.GraveDanger.CobraBastion.ScarlettTimer,
    }
}

local talk = TalkAction("!bosstimer")
function talk.onSay(player, words, param)
    local window = ModalWindow {
        title = "Boss Timers",
        message = "Select a boss to check the timer."
    }

    for i = 1, #bosses do
        local choice = window:addChoice(bosses[i].name)
        choice.value = i
    end

    window:addButton("Check",
        function(button, choice)
            local boss = bosses[choice.value]
            if boss then
                local time = player:getStorageValue(boss.storage)
                if time > os.time() then
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                        boss.name .. " will respawn in " .. os.date("%H:%M:%S", time - os.time()) .. ".")
                else
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, boss.name .. " is not dead.")
                end
            end
        end
    )

    window:addButton('Close')
    window:setDefaultEnterButton('Check')
    window:setDefaultEscapeButton('Close')
    window:sendToPlayer(player)

    return false
end

talk:register()

this is a revscript btw
 
Last edited:
Solution
OP
OP
TheMaxwellGates

TheMaxwellGates

New Member
Joined
Aug 20, 2020
Messages
10
Solutions
1
Reaction score
3
not hard at all maybe just no one has time

maybe try with this (did it 2 minutes so might not work, anyways i will keep updating it tomorrow)
Lua:
local bosses = {
    {
        name = "Grand Master Oberon",
        storage = Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer,
    },
    {
        name = "Scarlett Etzel",
        storage = Storage.GraveDanger.CobraBastion.ScarlettTimer,
    }
}

local talk = TalkAction("!bosstimer")
function talk.onSay(player, words, param)
    local window = ModalWindow {
        title = "Boss Timers",
        message = "Select a boss to check the timer."
    }

    for i = 1, #bosses do
        local choice = window:addChoice(bosses[i].name)
        choice.value = i
    end

    window:addButton("Check",
        function(button, choice)
            local boss = bosses[choice.value]
            if boss then
                local time = player:getStorageValue(boss.storage)
                if time > os.time() then
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                        boss.name .. " will respawn in " .. os.date("%H:%M:%S", time - os.time()) .. ".")
                else
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, boss.name .. " is not dead.")
                end
            end
        end
    )

    window:addButton('Close')
    window:setDefaultEnterButton('Check')
    window:setDefaultEscapeButton('Close')
    window:sendToPlayer(player)

    return false
end

talk:register()

this is a revscript btw
My man, you know how to make a man smile like a child!
Thanks A LOT for it!

I edit this comment because I post that something wasn't right, because it always said that "The boss is not dead".
But I was being a dumb and didn't change the storage to the correct ones on your script, now it is working like a jewel.

I appreaciate your time and effort, hope it helps more people in the future!
 
Last edited:

StreamSide

Joseluis Gonzalez
Support Team
Joined
Aug 31, 2007
Messages
3,581
Solutions
51
Reaction score
1,189
Location
Arica - Chile
My man, you know how to make a man smile like a child!
Thanks A LOT for it!

I edit this comment because I post that something wasn't right, because it always said that "The boss is not dead".
But I was being a dumb and didn't change the storage to the correct ones on your script, now it is working like a jewel.

I appreaciate your time and effort, hope it helps more people in the future!
no worries friend, thanks a lot for your words
 

Extrodus

|| Blazera.net ||
Premium User
Joined
Dec 22, 2008
Messages
2,648
Solutions
7
Reaction score
446
Location
Canada
I can change it to the FYI popup if you want too, or with the name if thats what you want :)
Awh shucks that'd be awesome! A talkaction with the name would be perfect and I suppose if you leave the name param blank it could should FYI of a random five bosses (every time you use the command it randomly grabs 5 bosses from the list to display, if they are alive ofc)
 
Top