Jump to content

Change Day on a Clock


Recommended Posts

OP means changing the day value on the clock without actually rolling back or moving forward to that day. Basically having a fake day on your clock. 

I have no idea how to do this I thought I should just clarify for those who don’t know what OP means.

Link to comment
Share on other sites

So... you're just wanting to change the number displayed on the clock, not anything else.

If you can find the relevant file, it ought to be doable by adjusting the bit of code where the number is fetched, having it subtract 7 or whatever from the number displayed (not the actual value of course, unless you want blood raining fron the sky).

Or just have it used a predefined number rather than fetching one.

 

Don't know where that is exactly and can't look atm, but there's the basic idea.

Link to comment
Share on other sites

Might be worth looking at these files:

scripts\widgets\uiclock.lua
scripts\components\clock.lua
scripts\components\shard_clock.lua
scripts\components\worldstate.lua

Look for mentions of cycles and _cycles.

The solution could be as simple as entering a command like "TheWorld.components.worldstate.data.cycles = 60". However, I suspect you'll need to do everything that the function "SetVariable" does in worldstate.lua to prevent it from reverting to the previous value. Moderate to severe risk of the game exploding spectacularly.

 

10 hours ago, maradyne said:

If you can find the relevant file, it ought to be doable by adjusting the bit of code where the number is fetched, having it subtract 7 or whatever from the number displayed

That would be in widgets/uiclock.lua:

function UIClock:UpdateWorldString()
    if self._cycles ~= nil then
        local day_text = subfmt(STRINGS.UI.HUD.WORLD_CLOCKDAY_V2,{day_count = self._cycles + 1})
        self._text:SetString(day_text)
    end
    self._showingcycles = true
end

 

Link to comment
Share on other sites

4 hours ago, -ICEMAN- said:

Where are those files?

In DST the game's scripts are stored in data/databundles/scripts.zip as a .zip archive.

You will need a program that can read .zip files to view or unzip the archive.

Link to comment
Share on other sites

On 6/7/2022 at 7:38 AM, Bumber64 said:

Might be worth looking at these files:


scripts\widgets\uiclock.lua
scripts\components\clock.lua
scripts\components\shard_clock.lua
scripts\components\worldstate.lua

Look for mentions of cycles and _cycles.

The solution could be as simple as entering a command like "TheWorld.components.worldstate.data.cycles = 60". However, I suspect you'll need to do everything that the function "SetVariable" does in worldstate.lua to prevent it from reverting to the previous value. Moderate to severe risk of the game exploding spectacularly.

 

That would be in widgets/uiclock.lua:


function UIClock:UpdateWorldString()
    if self._cycles ~= nil then
        local day_text = subfmt(STRINGS.UI.HUD.WORLD_CLOCKDAY_V2,{day_count = self._cycles + 1})
        self._text:SetString(day_text)
    end
    self._showingcycles = true
end

 

Okay I found this function. What should I do next?

 

Link to comment
Share on other sites

Create a mod that replaces the function with something like:

function UIClock:UpdateWorldString()
    if self._cycles ~= nil then
        local day_text = subfmt(STRINGS.UI.HUD.WORLD_CLOCKDAY_V2,{day_count = math.max(1, self._cycles - 9)})
        self._text:SetString(day_text)
    end
    self._showingcycles = true
end

That would make the day look like 10 days earlier (for any day past day 10.)

Link to comment
Share on other sites

On 6/11/2022 at 2:08 PM, -ICEMAN- said:

How can I replace this function?

Create a copy of uiclock.lua, change the function in the copy using a text editor. Create a mod (see modding section of forums) and put your copy in folders scripts\widgets\ of your mod.

Link to comment
Share on other sites

Here you are!

STRINGS.UI.HUD.WORLD_CLOCKDAY_V2 = "Day 61"

You want to run this on Local (not Remote) (press control in console to toggle)

This text will stay constant in your game session (the day number will not increment). Put whatever text you want to be displayed within the quotes.

Link to comment
Share on other sites

On 6/13/2022 at 3:24 AM, Bumber64 said:

Create a copy of uiclock.lua, change the function in the copy using a text editor. Create a mod (see modding section of forums) and put your copy in folders scripts\widgets\ of your mod.

Okay I tried and It doesn't work or I'm doing something wrong. I tried client mod and server mod. Both zipped and unzipped folder

Untitled.png

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...