Timer Scripts. Game: TES IV: Oblivion or Fallout 3Today's post is going to be another shortie, and shall deal specifically with timers. I use timers a lot, for a bunch of different ideas, so it'll be good to have a timer standalone post.
There are a couple different types of timers Bethesda uses; daily and hourly versions. I've only figured out the daily ones. Timers can be used in all sorts of ways for scripting, for a variety of different functions. In this case, the timer script below will cause a quest stage to advance.
1). Open up the Oblivion Construction Set, or Fallout 3 GECK. File > Data.
2). Find the esp you've been working with and activate it, bla bla bla..
...Let's say a quest is already being written, and there are two quest stages. For now, I'll call them Stage X and Stage Y. Between these two stages is going to be a timer script, which triggers after Stage X begins. And Stage X begins due to some sort of event. This event can be any number of things: Maybe an NPC finishes pontificating a speech. Maybe a door gets unlocked. Maybe an enemy gets pwned. Maybe a certain calendar day gets passed. Whatever it is, the event causes Stage X to occur. Once X is happening, now the timer begins its job. The timer counts down a day, or a certain number of days. Once the timer's job is done, the quest advances from Stage X to Stage Y.
Hope that made sense.
![rolleyes.gif](style_emoticons/sinders/rolleyes.gif)
Basically the process goes:
event occurs, quest bumps to Stage X, timer begins, a day (or more) passes, timer ends, quest bumps to Stage Y. That is just one example of how a timer script can be used. And here is how to set it all up.
3). Go into your quest's Quest Data tab. Open up its main script.
And here is the script necessary to make the timer begin...
-------------------
scriptname aaaQuestnameScript
short Timer
short StartDay
Begin GameMode
If (GetStage aaaQuestname == X)
If (Timer == 0)
Set StartDay to GameDaysPassed
SetTimer to 1
EndIf
EndIf
If (Timer == 1)
If ((GameDaysPassed - StartDay) >=1)
SetStage aaaQuestname Y
Set Timer to 0
EndIf
EndIf
End
------------------
Notice the "StartDay) >=1" part. The number 1 means at least one day must pass before the quest stage advances from X to Y. The number 1 can be changed to whatever you'd like though: 3... 10 .... 16 whatever you'd like. I'm sure there is some sort of limit here. Not sure what this could be though. I've gone as high as 30.
Let's say Stage X is actually Stage 30, and Stage Y is actually Stage 40. Altogether, this means an event happens which sets Stage 30 (whether an NPC gives us information, a door is opened, the death of an NPC occurs, whatever). Since the quest is at 30, this triggers the timer to begin. After a day (or more) has passed, the timer automatically moves the quest's stage to 40.
During playtesting, the timer might sometimes require more than an actual day before it does its job. We've all been there during certain Bethesda quests, right?
![laugh.gif](style_emoticons/sinders/laugh.gif)
We wait and wait for ... whatever the quest is supposed to do next. An example is during Oblivion's Main Quest, when Martin needs time to translate the Mysterium Xarxes. This takes several days, if I remember correctly, during which some gamers can become impatient.
I think it all depends on what hour the timer began. In-game days begin at midnight, just like they do on Earth. I haven't figured out what this means in-game though, pertaining to timer scripts. Does the timer begin counting at the very hour the event occurs? (9 pm, for instance?) or does it start at midnight, since that's the beginning of the next day? .... I haven't figured that out, yet.
To be safe, if you want 10 days to go by, and the quest
must get something done within 10 days, you can use the number 9 instead of 10, in the StartDay line. Chances are, 10 days are what will pass.
4). Save the script and close it.
And that is all. As I said, timers can be used to do all sorts of things, not just triggering quest stages. The first time I used a timer, I managed to make a quest advance, but the timer also made two NPCs teleport from two outside cells, into Summitmist Manor. These two NPCs met, had a conversation full of threats and insults, and then began attacking one another.
==============================================================
And here's a timer I wrote in which time is counted in seconds, rather than days. This timer can repeat itself, too. The idea: My skooma dealer, if he makes a sale, won't immediately be able to just make another sale right away, to the same NPC or to any other NPC. He must wait 30 seconds. The idea being: we can't just spam sales to the same NPC (asking them over and over), the temptation will be there to move on to another NPC.
Making a sale (via dialog with skooma den addicts and bandits) causes the DoOnce variable to go from 0 to 1
1). Start the script like so...
scriptname TimerScript
short DoOnce
short Timer
Begin GameMode
End2). Change Script Type from Object to Quest and save.
Close the script, press OK, closing the quest, reopen the quest and find the script in the scroll-bar. Click OK again, and reopen.
3). Here is the rest of the script.
scriptname TimerScript
short DoOnce
float Timer
Begin GameMode
If (DoOnce == 1) && (Timer < 30)
Set Timer to Timer + GetSecondsPassed
EndIf
If (DoOnce == 1) && (Timer >= 30)
Set DoOnce to 0
SetTimer to 0
Message "I should try for another sale."
EndIf
EndThis post has been edited by Renee: Sep 24 2023, 04:47 AM