Triggering a stage after 24 hours?

Post » Sun Nov 18, 2012 10:04 am

I'm looking to trigger a quest stage after 24 hours of game time. I'd imagine a function as so:

Int Function GetPassedGameDays() GlobalFloat GameTimeFloat GameDaysPassedGameTime = GetCurrentGameTime()GameDaysPassed = Floor(GameTime)return GameDaysPassed as IntEndFunction

So if the function returns 1 or greater the quest stages advances. The part I'm unsure of, that I've never done before is call a function and do this kind of action based on the return value. Any tips or pointers? Much appreciated.
User avatar
Stacyia
 
Posts: 3361
Joined: Mon Jul 24, 2006 12:48 am

Post » Sun Nov 18, 2012 4:42 am

I'm looking to trigger a quest stage after 24 hours of game time. I'd imagine a function as so:

Int Function GetPassedGameDays() GlobalFloat GameTimeFloat GameDaysPassedGameTime = GetCurrentGameTime()GameDaysPassed = Floor(GameTime)return GameDaysPassed as IntEndFunction

So if the function returns 1 or greater the quest stages advances. The part I'm unsure of, that I've never done before is call a function and do this kind of action based on the return value. Any tips or pointers? Much appreciated.

I'll post the script for you, give me 10 mins while I make a cuppa :)
User avatar
Danel
 
Posts: 3417
Joined: Tue Feb 27, 2007 8:35 pm

Post » Sun Nov 18, 2012 9:30 am

Here is an example script.

Scriptname script1 extends ObjectReference  Quest Property Quest  Auto  Event (put your event here, so OnActivate for example)	  RegisterForSingleUpdateGameTime(24) ;in game hoursEndEventEvent OnUpdateGameTime()   Quest.SetStage(10)EndEvent

Obviously you need to make a quest property pointing to your quest, and call it whatever (usually whatever the quest ID is is good for organising)
User avatar
Chantelle Walker
 
Posts: 3385
Joined: Mon Oct 16, 2006 5:56 am

Post » Sun Nov 18, 2012 4:10 pm

Beautiful! Thank you MUCH!
User avatar
Sammi Jones
 
Posts: 3407
Joined: Thu Nov 23, 2006 7:59 am

Post » Sun Nov 18, 2012 1:12 am

Beautiful! Thank you MUCH!

No probs :)
User avatar
Rachael Williams
 
Posts: 3373
Joined: Tue Aug 01, 2006 6:43 pm

Post » Sun Nov 18, 2012 12:39 am

One slight twist to this...what if I have over 80 quest stages to trigger? :) Doesn't make sense to have one script per stage.
User avatar
Alexis Acevedo
 
Posts: 3330
Joined: Sat Oct 27, 2007 8:58 pm

Post » Sun Nov 18, 2012 11:30 am

One slight twist to this...what if I have over 80 quest stages to trigger? :smile: Doesn't make sense to have one script per stage.

You want them all triggering one after the other? At say 24 hour intervals exactly?
User avatar
Rebekah Rebekah Nicole
 
Posts: 3477
Joined: Fri Oct 13, 2006 8:47 pm

Post » Sun Nov 18, 2012 1:15 am

Yes, Viconia interacts with the player the same way she did in Baldur's Gate II. Every 24 hours she will advance to the next quest stage, approach the player and start a conversation. They talk. End of stage, rinse and repeat.

This was ridiculously easy in Oblivion. Not so much here. Just her approaching the player is a PitA. :brokencomputer:
User avatar
Mark
 
Posts: 3341
Joined: Wed May 23, 2007 11:59 am

Post » Sun Nov 18, 2012 10:49 am

If the stage is complete when the dialogue is over, you could add the script to the end papyrus fragment in the response window.

That may work anyway. You'll have to test it :)
User avatar
Alexis Acevedo
 
Posts: 3330
Joined: Sat Oct 27, 2007 8:58 pm

Post » Sun Nov 18, 2012 12:44 pm

Okay thanks, I'll give it a shot this week
User avatar
Joey Avelar
 
Posts: 3370
Joined: Sat Aug 11, 2007 11:11 am

Post » Sun Nov 18, 2012 4:04 am

Crea
Doesn't make sense to have one script per stage.


Make another Int property (I just called mine stage) and use it like this:

Int Property Stage Auto (I think this is what it was, lol. I'm at the office and can't look right now)

Quest.SetStage(stage)

That way, you can use the script over and over, and just change the values in the property.


(At least, I think that's what you're asking for?)
User avatar
Rachel Tyson
 
Posts: 3434
Joined: Sat Oct 07, 2006 4:42 pm

Post » Sun Nov 18, 2012 12:39 pm

It's actually very easy with Skyrim, too. Something like:

Scriptname script1 extends SomethingQuest Property Quest AutoInt StageNum = 0Function SomeFunctionYouCallWhenSheStartsFollowing()	RegisterForSingleUpdateGameTime(24)EndFunctionEvent OnUpdateGameTime()	if StageNum < 800		StageNum += 10		Quest.SetStage(StageNum)		RegisterForSingleUpdateGameTime(24)	endifEndEvent

That assumes evenly-spaced stages. If your stage numbers are more arbitrary, you could put them in an array, and then cycle through them based on a counter variable that you add 1 to every 24 hours.
User avatar
Stu Clarke
 
Posts: 3326
Joined: Fri Jun 22, 2007 1:45 pm

Post » Sun Nov 18, 2012 1:00 am

A potentially easier way to do it would be:

Function RunMyQuest()  MyQuest.SetStage(10)  Utility.WaitGameTime(24) ; Pauses the script for 24 in-game hours, then will let the next line run  MyQuest.SetStage(20)  Utility.WaitGameTime(24)  MyQuest.SetStage(30)  ; And so onEndFunction
User avatar
Benji
 
Posts: 3447
Joined: Tue May 15, 2007 11:58 pm

Post » Sun Nov 18, 2012 7:00 am

A potentially easier way to do it would be:

Function RunMyQuest()  MyQuest.SetStage(10)  Utility.WaitGameTime(24) ; Pauses the script for 24 in-game hours, then will let the next line run  MyQuest.SetStage(20)  Utility.WaitGameTime(24)  MyQuest.SetStage(30)  ; And so onEndFunction

:woot:

:drool:

That is awesome! That will simplify my construction timers considerably! I assume you can make each Uility.WaitGameTime(XX) whatever number of hours you need it like 48, or 72 or whatever. Thanks for posting! :banana:
User avatar
Bloomer
 
Posts: 3435
Joined: Sun May 27, 2007 9:23 pm

Post » Sun Nov 18, 2012 9:41 am

A potentially easier way to do it would be:

Function RunMyQuest()  MyQuest.SetStage(10)  Utility.WaitGameTime(24) ; Pauses the script for 24 in-game hours, then will let the next line run  MyQuest.SetStage(20)  Utility.WaitGameTime(24)  MyQuest.SetStage(30)  ; And so onEndFunction

It's things like this that have made me decide to do a course in programming. Simply fixing PC's 'aint enough for me anymore... Thanks for posting that, some cool ideas will come of this :)
User avatar
Elisabete Gaspar
 
Posts: 3558
Joined: Thu Aug 31, 2006 1:15 pm

Post » Sun Nov 18, 2012 7:50 am

Wow, thanks everyone. What's funny is I program in C# and I'm freaking lost in Papyrus but I'm getting there.
User avatar
Abi Emily
 
Posts: 3435
Joined: Wed Aug 09, 2006 7:59 am

Post » Sun Nov 18, 2012 12:44 pm

It's things like this that have made me decide to do a course in programming. Simply fixing PC's 'aint enough for me anymore... Thanks for posting that, some cool ideas will come of this :smile:

Ya, that thar skript is plum sixY! :bunny:
User avatar
Naomi Lastname
 
Posts: 3390
Joined: Mon Sep 25, 2006 9:21 am

Post » Sun Nov 18, 2012 6:52 am



Ya, that thar skript is plum sixY! :bunny:

It'll definitely cut down on the amount of Registerforsingleupdates I was looking at using :D
User avatar
Riky Carrasco
 
Posts: 3429
Joined: Tue Nov 06, 2007 12:17 am

Post » Sun Nov 18, 2012 5:01 am

So for OP. if your quest dialogue is all in the one quest, and you want the stage to set 24 hours after a line of dialogue, put this in your end fragment papyrus box:

Utility.WaitGameTime(24)GetOwningQuest().SetStage(xx)

That's how I would do it. It'd be more organised for me that way :)
User avatar
Brentleah Jeffs
 
Posts: 3341
Joined: Tue Feb 13, 2007 12:21 am

Post » Sun Nov 18, 2012 1:33 am

It'll definitely cut down on the amount of Registerforsingleupdates I was looking at using :biggrin:

Yeah, that's why they're pro's and I'm a wanna-be hack, stumbling through this stuff and building it with duct tape and chicken wire, lol!
User avatar
Grace Francis
 
Posts: 3431
Joined: Wed Jul 19, 2006 2:51 pm

Post » Sun Nov 18, 2012 6:14 am

A potentially easier way to do it would be:

Function RunMyQuest()  MyQuest.SetStage(10)  Utility.WaitGameTime(24) ; Pauses the script for 24 in-game hours, then will let the next line run  MyQuest.SetStage(20)  Utility.WaitGameTime(24)  MyQuest.SetStage(30)  ; And so onEndFunction
but won't this thread the entire function into the save game? correct me if i'm wrong, (sorry if i'm not understanding this correctly) but from what i understand of papyrus, this would work fine up until the user uninstalls the mod. if the function is threaded and baked into the game save, it will run the remainder of the function for rest of the time remaining (and error if the mod is no longer exists), in which in this case, would be a single function that lasts for 1920 hours. at least with the registersingle loop, you can terminate the threaded functions when the update event fails the first time, so it doesnt have to keep running the remainder of the 80 day intervals.
User avatar
Jacob Phillips
 
Posts: 3430
Joined: Tue Aug 14, 2007 9:46 am

Post » Sun Nov 18, 2012 1:14 am

but won't this thread the entire function into the save game? correct me if i'm wrong, (sorry if i'm not understanding this correctly) but from what i understand of papyrus, this would work fine up until the user uninstalls the mod. if the function is threaded and baked into the game save, it will run the remainder of the function for rest of the time remaining (and error if the mod is no longer exists), in which in this case, would be a single function that lasts for 1920 hours. at least with the registersingle loop, you can terminate the threaded functions when the update event fails the first time, so it doesnt have to keep running the remainder of the 80 day intervals.
Good point. But it can be fixed by an if check after each stage set.
User avatar
lisa nuttall
 
Posts: 3277
Joined: Tue Jun 20, 2006 1:33 pm

Post » Sun Nov 18, 2012 11:44 am

So for OP. if your quest dialogue is all in the one quest, and you want the stage to set 24 hours after a line of dialogue, put this in your end fragment papyrus box:

Utility.WaitGameTime(24)GetOwningQuest().SetStage(xx)

That's how I would do it. It'd be more organised for me that way :smile:

If I remember correctly don't I have to declare a couple of script properties to include Utility and GetOwningQuest?

Also is there still the line limit on scripts the way there was in Oblivion? I thought it was 255.
User avatar
Charity Hughes
 
Posts: 3408
Joined: Sat Mar 17, 2007 3:22 pm

Post » Sun Nov 18, 2012 5:59 am

If I remember correctly don't I have to declare a couple of script properties to include Utility and GetOwningQuest?
No.
Also is there still the line limit on scripts the way there was in Oblivion? I thought it was 255.
I'm now working on a script with 683 lines and I think It had have more lines at some point. There is though a line limit. Someone reached it various months ago, but I'm not sure what that limit was or if even it was mentioned in the thread.

Could be a limit only applied to the CK though. I use notepad++ .
User avatar
Eileen Müller
 
Posts: 3366
Joined: Fri Apr 13, 2007 9:06 am

Post » Sun Nov 18, 2012 9:45 am

I'm now working on a script with 683 lines and I think It had have more lines at some point. There is though a line limit. Someone reached it various months ago, but I'm not sure what that limit was or if even it was mentioned in the thread.

Could be a limit only applied to the CK though. I use notepad++ .

Yes, there's a limit to what the CK's built-in editor can handle--I don't remember what it is, but I ran into it--but larger scripts beyond that limit compile fine with an external editor; my largest is 2,000+ lines.
User avatar
biiibi
 
Posts: 3384
Joined: Sun Apr 08, 2007 4:39 am


Return to V - Skyrim