Jump to content
  • 0

Absolute Newbie Need Help - Real Time Sunrise/Sunset mod assistance - ChatGPT generated content and guide script included


Question

Posted

Hi all, newbie here.

I have been looking for a mod that adjusts the ingame sunrise, sunset and daytime hours based upon real life information for the Boston area.  I have collated all of the realworld information and have been planning out what a script would need to do, however, I have very little to no scripting experince and even less in creation kit.

I have roped in ChatGPT for assistance and had it create a python script that would update my enbseries.ini file with the information based upon a csv file containing the relevant information that would update the ini based upon my system date.  This was purely for testing as I wanted to know how well ChatGPT scripts work - after some tweaks and stuff, it turns out it works really well.

So I was wondering, is there a way to set the sunrise, sunset and daytime (I think those are the section in the TIMEOFDAY section of the enbseries.ini) using the infromation if i include an array containing the data into the script using this command:

Get the current in-game time
    Float currentGameTime = Utility.GetCurrentGameTime()

I had ChatGPT write a script based upon some prompts I gave it and it recognised it was papyrus and using commands from CK.

This is the guide script it wrote:

ScriptName RealTimeSunriseSunset extends ObjectReference

Event OnInit()
    RegisterForSingleUpdate(0.0)
EndEvent

Event OnUpdate()
    UnregisterForSingleUpdate()

    ; Define the array of sunrise, sunset, and daytime data
    Const Array[] ReferenceData[] = [

; Get the current in-game time
    Float currentGameTime = Utility.GetCurrentGameTime()

    ; Convert the current in-game time to a formatted string
    String currentTimeString = Utility.GameTimeToString(currentGameTime)

    ; Extract the date from the formatted time string
    String currentDate = currentTimeString.Split(" ")[0]

    ; Search for a matching date in the reference data array
    Bool foundMatch = false
    Int index = 0
    While index < Array.Length(ReferenceData)
        String date = ReferenceData[index][0]
        If date == currentDate
            foundMatch = true
            Break
        EndIf
        index += 1
    EndWhile

    ; If a matching date is found, set the sunrise, sunset, and daytime
    If foundMatch
        String sunriseTime = ReferenceData[index][1]
        String sunsetTime = ReferenceData[index][2]
        String dayTime = ReferenceData[index][3]

        ; Set the sunrise time
        Game.SetSunriseTime(sunriseTime)

        ; Set the sunset time
        Game.SetSunsetTime(sunsetTime)

        ; Set the daytime
        Game.SetDaytime(dayTime)

        Debug.Notification("RealTimeSunriseSunset set successfully! Sun will rise at " + sunriseTime + " and set at " + sunsetTime)
    Else
        Debug.Notification("RealTimeSunriseSunset could not be set")
    EndIf
EndEvent

I've excluded the array data since its just [date, sunrisetime, sunsettime, daytime] data.

Apologies if this is nonsensical, or if I have included too much information and text.  I hope there's a simpler way to do this, but I was hoping a holotape could be created as part of the mod, you enable it, it then runs at 00:00 in game daily and sets the aforementioned sunrise/set/daylight times and also  displays the message whether successful or unsuccessful.  It's something I have wanted in game for a long time since NACX seems to do a good job of seasonal weather. 

Huge thanks for reading and even more thanks if anyone can help out!

 

2 answers to this question

Recommended Posts

  • 1
Posted

First off, Time of Day (ToD) is governed by the weather plugin (in Skyrim, anyway, so assuming something similar for FO4, which I don't play). EnbSeries.ini TIMEOFDAY should be configured according to the weather mod if it differs from vanilla ToD.

That said, I will defer to someone on our team that knows FO4 and what you are attempting.

  • 0
Posted
16 minutes ago, z929669 said:

First off, Time of Day (ToD) is governed by the weather plugin (in Skyrim, anyway, so assuming something similar for FO4, which I don't play). EnbSeries.ini TIMEOFDAY should be configured according to the weather mod if it differs from vanilla ToD.

That said, I will defer to someone on our team that knows FO4 and what you are attempting.

Thank you so much!

I was looking more into CK and did notice that in the CK the sunrise and sunset seem to be governed by the Climate in WolrdData, which would be overwritten by a weather mod (I think).  I know that Mods such as NACX can change the weather, so I am now wondering if the script should call on the objects within the Climate folder in WorldData... this information seems to be then further tweaked by (some?) ENBs.

 

I appreciate any help I can get on this. Getting myself down a rabbit hole looking at everything!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.