NOW

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

This isn't an actual command, but more a single line that provides the functionality of "NOW", which is typically the current time including days.

Using the already existing values from GameDaysPassed and GameHour, create the following:

A quest float variable named MyNOW.
OR A global float variable named MyNOW (replace My with something more meaningful).

Now that you have your variable, you can populate it with the following set:

set MyNOW to GameDaysPassed + (GameHour/24)

Place the above line of code somewhere that will run at least 1 time per second, though you can do this in multiple locations, you will not see any better results in resolution unless you do this on an object that runs in GameMode (which would need to be flagged Quest Item, Unplayable and stored on the Player).

The usage of this will be to provide the quest with an accumulative timeline that will not break any quest stages. Most of the used code was to check GameDaysPassed and add the difference from the last time to another variable, this worked okay, except during near midnight 24 hour sleeps, or fast travels that can take days.

An example of this would be to have a quest stage wait 1 day since your last interaction before it continues to the next stage.

set QuestWaitTime to MyNOW + 1  ; Current time + 1 day.

To test if the time has passed:

if QuestWaitTime < MyNOW
  ; Quest Wait is over
endif

The breakdown of how you can use this:

It's simple design isn't meant to replace GetSecondsPassed timings, but to allow for a seamless approach to timeline progression in quest scripts.

MyNOW's whole numbers are the days that have passed since you started the game (for that save). The value after the decimal is the amount into the day you've progressed.

An hour's best approximation is 0.0416666, so set QuestWaitTime to MyNOW + 0.0416666 would work for 1 hour. You can divide that number by 60 to get a minute, or further if you want shorter periods.

To work with periods of time other than an hour, the easiest way to get the value you want is to enter the Consule and enter the following:

set MyNOW to (minutes here)/1440  ; For seconds, use 86400 instead of 1440.
show MyNOW

Using the console to get these values ensures that the game's math returns the appropriate values you can use. It is recommended to do this before you start actually working on timing your quests, as this will provide you with ample timings beforehand. The use if MyNOW in this manner shouldn't affect your existing game.