Triggering a timer script in dialogue

Post » Thu Jun 21, 2012 7:41 pm

I used to know how to do this in Oblivion (or, at the very least, I knew how to cannibalize existing mod scripts with the same effect) but the Creation Kit has changed the quest scripting formatting. I don't even know where to start.

I need to make it, essentially, so that my quest stages automatically advance to their next stage after three in-game days (these stages trigger ForceGreet dialogue from my follower, which may or may not be relevant).

The scripting to do this would probably be something like...

GlobalVariable Property GameDaysPassed AutoQuest Property MyQuest AutoInt Property Day AutoDay = GameDaysPassed.GetValueInt() + 3Function ThreeDayTimer	if (Day < GameDaysPassed.GetValueInt()) && MyQuest.GetStage(25)		then MyQuest.SetStage(30)	endifEndFunction

...which probably isn't perfect, but it should do until I get the mod (mostly) running. Here's my question: where do I put this script? I realize it'll be an 'extendsquest" script, but I know I still have to attach it to my quest somehow (Is it the 'Scripts' tab in my quest window? It's already got a script with an odd name in it). And after this script is in place, where do I actually activate my ThreeDayTimer function? Do I put it in the same dialogue script fragment that initially advanced my stages, like:

MyQuest.SetStage(25)Function ThreeDayTimer

Once my main quest script is attached to my quest, will my quest's dialogue script fragments be able to pull the function like that?

EDIT: I really, really don't want to break what I have working already.
User avatar
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm

Post » Thu Jun 21, 2012 9:37 am

Well, the way I did pretty much the same thing was have a completely separate quest from my main quest to run the timer. A quest stage, dialog or other event starts my timer quest which is set NOT to start with the game. Then when the timer ran it's designated time it set the next stage in my main quest. You may find something helpful in the threads I used for my timers:

http://www.gamesas.com/topic/1359254-scripting-your-quest-to-start-via-a-timer/

http://www.gamesas.com/topic/1370015-help-dissecting-and-using-a-timer-script/

Hope that helps.
User avatar
Lovingly
 
Posts: 3414
Joined: Fri Sep 15, 2006 6:36 am

Post » Fri Jun 22, 2012 12:30 am

It's working!

Thank you for the pointer, Balok; this is definitely using scripting you and DreamKing put together for your Helgen Rebuilt mod. :biggrin:

Just in case someone wants to use this as a reference (triggering dialogue/quest stages via a timer) here's the scripting I used. My dialogue fragments look like this, which starts my timer:

if (MyMainQuest.SetStage(25))	Debug.Trace("Quest successfully set to stage 25.")endIfIf TimerQUST.start()	Debug.Trace("Our three-day timer is attempting to start...")endIf

And my timer quest has this script attached to it:

Scriptname TimerQuestScript extends QuestQuest property MyMainQuest autoEvent OnInit()   If IsRunning()	  RegisterForSingleUpdateGameTime(72)	  Debug.Trace("Our three-day timer is starting! Yay!")   EndIfEndEventEvent OnUpdateGameTime()	if MyMainQuest.getStage() == 25	  MyMainQuest.setStage(30)	  Debug.Trace("Triggering 2nd dialogue...")	  UnregisterForUpdateGameTime()   endIfendEvent

And once my quest hits stage 30, my ForceGreet triggers. :biggrin: It doesn't have to be a ForceGreet though; this should adapt to any kind of timed quest stage.
User avatar
Ilona Neumann
 
Posts: 3308
Joined: Sat Aug 19, 2006 3:30 am


Return to V - Skyrim