icecreamassassin Posted May 15, 2014 Share Posted May 15, 2014 So the short of it; I want to have a timer that starts via conversation and then at the end of X days, advances the quest to another stage. Basically a script to check the passage of time since it was first initiated. I could totally do this in Oblivion but I am not seeing similar calls on total days passed so I can set up a check against that global vs the total days played later on when the check would pass as true... sigh... can anyone point me in the right direction? I'm not finding any leads at all online or on the forum And just FYI I am not looking for RegisterForSingleUpdate or Wait functions, these are in REAL TIME, I need to check GAME TIME. Thanks. Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 15, 2014 Author Share Posted May 15, 2014 bah, just found it I think WaitGameTime Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 15, 2014 Share Posted May 15, 2014 (edited) You can also use GetCurrentGameTime coupled with a while loop float Property DaysToPass Auto;... some eventfloat StartTime = Utility.GetCurrentGameTime()float EndTime = StartTime + DaysToPassWhile Utility.GetCurrentGameTime() < EndTime;do nothing, just loopUtility.Wait(1.0) ; wait just a single second so it doesn't over burden papyrus with rapid calls every few milliseconds.EndWhileIf Utility.GetCurrentGameTime() >= EndTime;enough time has passed, so do somethingEndIf;... other stuff Under the hood GetCurrentGameTime() is the same as GameDaysPassed.GetValue(). GameDaysPassed is the name of the global that holds the total amount of in-game time that has passed. FormID 00000039 EDIT: Saw I had used INT instead of FLOAT Edited May 15, 2014 by IsharaMeradin Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 15, 2014 Author Share Posted May 15, 2014 ah thanks, good to know. I thought it was kind of odd that Skyrim didn't seem to have a very similar time tracking mechanism to Oblivion. I'll try the simple script pause method and if that fails I'll work off what you posted. Thanks again as always, you are a huge life saver :) Link to comment Share on other sites More sharing options...
xenaclone Posted February 14, 2023 Share Posted February 14, 2023 (edited) I bumped this because I am like the OP: I've made countless timers in earlier games. So for my latest quest, I'm trying to make a timer script, and came across this thread. Because (again) I can't find any tutorials for this sort of thing. Bethesda's Creation Kit website only gives you bits and pieces.... What I want to happen is pretty simple. An NPC says "I'll be here. Come back in a day and I'll tell you what happens next." The player goes somewhere else, returns in 24 hours or more, and the NPC has new dialog. And so obviously, I need a timer. Which I assume the script below can work, but I have questions. -------------------------------------- float Property DaysToPass Auto ;... some event float StartTime = Utility.GetCurrentGameTime() float EndTime = StartTime + DaysToPass While Utility.GetCurrentGameTime() < EndTime ;do nothing, just loop Utility.Wait(1.0) ; wait just a single second so it doesn't over burden papyrus with rapid calls every few milliseconds. EndWhile If Utility.GetCurrentGameTime() >= EndTime ;enough time has passed, so do something EndIf ;... other stuff ---------------------------------------------- I kind of get how this works, but where do I declare how many days should pass? Edited February 14, 2023 by xenaclone Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 14, 2023 Share Posted February 14, 2023 There is probably a better method in your scenario. Use a quest script that contains the following (can be added to your existing quest script if you have one): ScriptName myQuestScript Extends Quest ;feel free to rename the script - just update its usage throughout GlobalVariable Property myDayIsUp Auto ;create a global variable record with a default float value of 0 ;i.e. create new, give it a name and 'ok' out of the record Function RFSUGT(Float afInterval) RegisterForSingleUpdateGameTime(afInterval) EndFunction Event OnUpdate() ;enough time has passed myDayIsUp.SetValue(1.0) EndEvent Where the NPC tells the player to go wait, add this to the dialog fragment: ;the following creates a local variable that will fetch the quest holding the dialog fragment ;and assign the designated script to the local variable ;which can then be used to run a function (or pull property variables) on said script myQuestScript MQS MQS = GetOwningQuest() as myQuestScript MQS.RFSUGT(24.0) Where you want the NPC to have dialog options after the time is up use the following condition statementGetGlobalValue, point it to the global variable you created for the myDayIsUp property and set it to be equal to 1. Link to comment Share on other sites More sharing options...
xenaclone Posted February 15, 2023 Share Posted February 15, 2023 (edited) Gracias Ishara, you are a livesaver. :smile: I like that you included the full script, too. Including Scriptname. What is MQS though? Oh wait, that's the name of the quest, right? Edited February 15, 2023 by xenaclone Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 15, 2023 Share Posted February 15, 2023 In the example MQS is a local variable which gets assigned the script attached to the quest. Link to comment Share on other sites More sharing options...
xenaclone Posted February 16, 2023 Share Posted February 16, 2023 Nice. I'm finally home and in front of my gaming computer. Everything compiled! Now just gotta get into the game and see if this works. Gotta get some rest though, first. Does RFSUGT stand for RegisterForSingleUpdateGameTime? Similar to the way Scriptname could be shortened to SCN? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 16, 2023 Share Posted February 16, 2023 Nice. I'm finally home and in front of my gaming computer. Everything compiled! Now just gotta get into the game and see if this works. Gotta get some rest though, first. Does RFSUGT stand for RegisterForSingleUpdateGameTime? Similar to the way Scriptname could be shortened to SCN? That is what I meant it to mean. But only because I created a custom function (and needed to give it a name) to be called upon which in turn calls the real function. Link to comment Share on other sites More sharing options...
Recommended Posts