Jump to content

Change Day on a Clock


Recommended Posts

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.

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

 

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?

 

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.)

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.

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.

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

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...