Skip to content

Items that fast-forward time to Dawn or Dusk?

So, I'm trying to create a consumable magic item that will fast forward time to the module's designated dawn or dusk hour. I can't find any "fast forward" time function, perhaps it's not possible?

Comments

  • FinalStandFinalStand Member Posts: 87
    You can do it with SetTime/SetCalendar:

    https://nwnlexicon.com/index.php?title=SetCalendar
    https://nwnlexicon.com/index.php?title=SetTime

    You would have to do some basic calculations yourself by using GetHour(), etc.

    https://nwnlexicon.com/index.php?title=Category:Time_Functions


    You could also fake it with NightToDay/DayToNight. Those don't change time, just changes what PC sees (so, it can be high noon, but looks like Night time, etc)


    https://nwnlexicon.com/index.php?title=NightToDay
    https://nwnlexicon.com/index.php?title=DayToNight

  • Dark_AnsemDark_Ansem Member Posts: 992

    You can do it with SetTime/SetCalendar:

    https://nwnlexicon.com/index.php?title=SetCalendar
    https://nwnlexicon.com/index.php?title=SetTime

    You would have to do some basic calculations yourself by using GetHour(), etc.

    https://nwnlexicon.com/index.php?title=Category:Time_Functions


    You could also fake it with NightToDay/DayToNight. Those don't change time, just changes what PC sees (so, it can be high noon, but looks like Night time, etc)


    https://nwnlexicon.com/index.php?title=NightToDay
    https://nwnlexicon.com/index.php?title=DayToNight

    Oh of course, I'd have to calculate it :)
    But the hour of Dawn and Dusk is customisable. Would this take it into account ?
  • FinalStandFinalStand Member Posts: 87


    Oh of course, I'd have to calculate it :)
    But the hour of Dawn and Dusk is customisable. Would this take it into account ?

    What do you mean dawn/dusk is customisable? The hour you mean?

    It won't be hard to calculate. Worse case if DUSK < CURRENT HOUR you are increment DAY and then simply setting the HOUR/MIN. Otherwise just set HOUR/MIN.



    Dark_Ansem
  • Dark_AnsemDark_Ansem Member Posts: 992
    edited March 2018


    Oh of course, I'd have to calculate it :)
    But the hour of Dawn and Dusk is customisable. Would this take it into account ?

    What do you mean dawn/dusk is customisable? The hour you mean?

    It won't be hard to calculate. Worse case if DUSK < CURRENT HOUR you are increment DAY and then simply setting the HOUR/MIN. Otherwise just set HOUR/MIN.
    Exactly. you can set the hour, precisely. I suck at math, thanks for your suggestions :)
  • squattingmonksquattingmonk Member Posts: 59
    edited March 2018


    It won't be hard to calculate. Worse case if DUSK < CURRENT HOUR you are increment DAY and then simply setting the HOUR/MIN. Otherwise just set HOUR/MIN.

    You don't even have to do that. Since SetTime() can only advance time forwards, you never have to worry about setting time back a previous hour.


    But the hour of Dawn and Dusk is customisable. Would this take it into account ?

    If you don't want to hardcode dawn and dusk times in case things change, you can advance time one hour at a time in a loop, checking to see if the time of day has changed:
    int GetIsDaytime() { return GetIsDawn() || GetIsDay(); } void main() { int nHour = GetTimeHour(); int bDaytime = GetIsDaytime(); // Advance time until the time of day changes while (bDaytime == GetIsDaytime()) SetTime(++nHour, 0, 0, 0); }
    Post edited by squattingmonk on
    Dark_Ansem
  • Dark_AnsemDark_Ansem Member Posts: 992


    It won't be hard to calculate. Worse case if DUSK < CURRENT HOUR you are increment DAY and then simply setting the HOUR/MIN. Otherwise just set HOUR/MIN.

    You don't even have to do that. Since SetTime() can only advance time forwards, you never have to worry about setting time back a previous hour.


    But the hour of Dawn and Dusk is customisable. Would this take it into account ?

    If you don't want to hardcode dawn and dusk times in case things change, you can advance time one hour at a time in a loop, checking to see if the time of day has changed:
    int GetIsDaytime() { return GetIsDawn() || GetIsDay(); } void main() { int nHour = GetTimeHour(); int bDaytime = GetIsDaytime(); // Advance time until the time of day changes while (bDaytime == GetIsDaytime()) SetTime(++nHour, 0, 0, 0); }
    I only meant to move time forward of course, thank you.
Sign In or Register to comment.