how to start a quest after a specified sleep ?

Post » Thu Jun 21, 2012 3:26 pm

Hi I want that a series of events start while the player is sleeping in a specific bed

this is what I Was thinking to do but I am not sure if it can work ...


Make an alias of the previous quest with the bed where the player should sleep

add a script to the bed



Scriptname Issgard_Cabinsleep extends ReferenceAlias   Function SomeFunction()  RegisterForSleep() ; Before we can use OnSleepStart we must register. EndFunction Event OnTriggerEnter(ObjectReference  akActionRef)    if (akActionRef == game.GetPlayer() && GetOwningQuest().GetStage()<50 &&GetOwningQuest().GetStage() >=40)          endif[left]Event OnSleepStop()set GetOwningQuest().SetStage(50)[/left]EndEvent  

but I think makes no sense as is not compiled
User avatar
Chase McAbee
 
Posts: 3315
Joined: Sat Sep 08, 2007 5:59 am

Post » Thu Jun 21, 2012 4:40 pm

Have you looked at the stuf behind the Dark-Brotherhood Questline?

The first phase (The Ruined cabin scene) must start something like that ... PC goes to sleep and Quest is started

Check that out ;)
User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am

Post » Thu Jun 21, 2012 2:29 pm

Maybe you could tell us more about what error did the compiler give you?

So far, here is what I see
- left/ left are not correct syntax, right
- Event OnTriggerEnter doesn't have EndEvent tag?
User avatar
Ross
 
Posts: 3384
Joined: Thu Aug 10, 2006 7:22 pm

Post » Thu Jun 21, 2012 4:26 pm

The left left are code stuff of the forum that dunno how got in , I am not sure if I can unify two events at the same time ....

Have you looked at the stuf behind the Dark-Brotherhood Questline?

The first phase (The Ruined cabin scene) must start something like that ... PC goes to sleep and Quest is started

Check that out :wink:

Hi I haven't played the DB quests yet ingame and I would like ot not be spoiled , eventually cold you point me to the actual quest using the code that I can check and see?
User avatar
glot
 
Posts: 3297
Joined: Mon Jul 17, 2006 1:41 pm

Post » Thu Jun 21, 2012 9:59 am

Can't find what quest code is this ... any help?
User avatar
Dina Boudreau
 
Posts: 3410
Joined: Thu Jan 04, 2007 10:59 pm

Post » Thu Jun 21, 2012 1:16 pm

DBEntranceQuest
User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Thu Jun 21, 2012 8:29 am

Ok here is the DB quest script ...
Scriptname pDBEntranceQuestScript extends Quest  ConditionalQuest Property WICourier  Auto  Book Property DBEntranceLetter  Auto  int Property pSleepyTime  Auto ConditionalObjectReference Property pPlayerShackMarker  AutoReferenceAlias Property pAstridAlias  Auto  int Property pPlayerSecondSleep  Auto Conditional  Idle Property WakeUp AutoImageSpaceModifier Property Woozy Auto; When stage is set to 30, register for sleep via RegisterForSleep()Event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime); For the player sleeping, to move him to the shack to be forcegreeted by Astrid.If pSleepyTime == 1		Game.DisablePlayerControls(ablooking = true, abCamSwitch = true)   		Game.ForceFirstPerson()		Game.GetPlayer().MoveTo(pPlayerShackMarker)		Woozy.Apply()		Game.GetPlayer().PlayIdle(WakeUp)		Utility.Wait (3)		pSleepyTime = 3endif;Tempted in for future, when sleeping is working;If the player is sleeping	;play the sleeping/wake up animation	;in previous block, set pSleepyTime to 2, and use 2 in this block to have the player play the wakeup animnation, then set to 3 to have Astrid forcegreet;endif; For the player sleeping the second time, and being greeted by Astrid (commented out because it's no longer used);If pPlayerSecondSleep == 0	;If pSleepyTime >= 5			;pSleepyTime = 6			;pAstridAlias.GetReference().Moveto (Game.GetPlayer(), afXOffset = 60.0)			;pPlayerSecondSleep = 1	;endif;endifEndEvent


and this is the script fragments of the quest stages

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 20Scriptname QF_DBEntranceQuest_00050F2E Extends Quest Hidden;BEGIN ALIAS PROPERTY Captive1;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_Captive1 Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY Captive2;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_Captive2 Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY CourierLetter;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_CourierLetter Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY AstridAlias;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_AstridAlias Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY Captive3;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_Captive3 Auto;END ALIAS PROPERTY;BEGIN FRAGMENT Fragment_2Function Fragment_2();BEGIN AUTOCAST TYPE pDBEntranceQuestScriptQuest __temp = self as QuestpDBEntranceQuestScript kmyQuest = __temp as pDBEntranceQuestScript;END AUTOCAST;BEGIN CODEUnRegisterForSleep();END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_18Function Fragment_18();BEGIN CODE;Debug.MessageBox("Restrained Start")Actor Captive1 = Alias_Captive1.GetReference() as ActorCaptive1.SetRestrained(1)Actor Captive2 = Alias_Captive2.GetReference() as ActorCaptive2.SetRestrained(1)Actor Captive3 = Alias_Captive3.GetReference() as ActorCaptive3.SetRestrained(1);END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_12Function Fragment_12();BEGIN CODE;Alias_CourierLetter.GetRef().Disable();END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_0Function Fragment_0();BEGIN AUTOCAST TYPE pDBEntranceQuestScriptQuest __temp = self as QuestpDBEntranceQuestScript kmyQuest = __temp as pDBEntranceQuestScript;END AUTOCAST;BEGIN CODE;(Kmyquest.WICourier as WiCourierScript).AddItemToContainer(Kmyquest.DBEntranceLetter);END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_11Function Fragment_11();BEGIN AUTOCAST TYPE pDBEntranceQuestScriptQuest __temp = self as QuestpDBEntranceQuestScript kmyQuest = __temp as pDBEntranceQuestScript;END AUTOCAST;BEGIN CODEAlias_AstridAlias.GetReference().Moveto (pShackMarkerRef)kmyQuest.pSleepyTime = 1kmyQuest.RegisterForSleep()(Kmyquest.WICourier as WiCourierScript).AddRefToContainer(Alias_CourierLetter.GetReference())kmyQuest.DarkBrotherhoodQuest.CourierLetter = Alias_CourierLetter.GetReference();END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin commentObjectReference Property pShackMarkerRef  Auto   

Can you help me understand what those codes actually do ?
User avatar
Alexandra Ryan
 
Posts: 3438
Joined: Mon Jul 31, 2006 9:01 am

Post » Thu Jun 21, 2012 5:17 am

Reading back to see what you want to do, I don't think this quest is much use to you. It does not care which bed the player sleeps in, it just kidnaps them and moves them to a shack when they sleep anywhere.

Can you not just use the OnActivate event of the bed?
User avatar
dav
 
Posts: 3338
Joined: Mon Jul 30, 2007 3:46 pm

Post » Thu Jun 21, 2012 6:52 am

I dunno , what I want to do is :

the captain gives a key to the player and adds him to the faction of the ship so that do not gets gangbanged when he enters the ship , then when he reaches his cabin he can open the door and use the "faction bed" to sleep ...

when he wakes up nothing seem to have changed but actually I will have to have replaced the door entrance to another one wich links to the next quest start and new worldspace where a new exterior ship is setup ... and this to be done on a several quest steps ...


so basicallyh what should do is ...

the player uses the bed and

I need that the game somehow gives out a fixed time passed possibly I woudl like ot decide how many hours passes befoure he wakes up or get the time passed so that I can decide how long the step travels last ... may be even add a popup window that describe what happens during that time passed ( not all sleeping supposely ) and when he wakes up starts the new quest that is the actual voyage made of several steps locations / ship locations etc ...
User avatar
Len swann
 
Posts: 3466
Joined: Mon Jun 18, 2007 5:02 pm

Post » Thu Jun 21, 2012 3:03 pm

Have a look at this: http://www.creationkit.com/RegisterForSleep_-_Form
This: http://www.creationkit.com/OnSleepStart_-_Form
and this http://www.creationkit.com/OnSleepStop_-_Form

So it depends how strict you want to be. From counting how long PC was asleep, to just catching the event when it wakes (or goes to sleep).
User avatar
Daniel Lozano
 
Posts: 3452
Joined: Fri Aug 24, 2007 7:42 am

Post » Thu Jun 21, 2012 7:43 pm

I already took a look to the forms but how I put themtogether?
User avatar
John Moore
 
Posts: 3294
Joined: Sun Jun 10, 2007 8:18 am

Post » Thu Jun 21, 2012 3:31 pm

Ok I have not yet compiled neither tried in the ck but .... I want first someone more expert than me check if think it coul dwork this script ....



With /// I mean the stage script portions

/// to be done in stage set ///

//// When stage is set to 10, register for sleep via RegisterForSleep()
////
//// myQuest.RegisterForSleep()


Scriptname ------int Property sleepy  Auto ConditionalImageSpaceModifier Property fadein AutoImageSpaceModifier Property fadeout AutoIdle Property WakeUp AutoEvent OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime)    Game.DisablePlayerControls(ablooking = true, abCamSwitch = true)			    afDesiredSleepEndTime=2        Game.ForceFirstPerson()			    fadeout.Apply()        Utility.Wait (3)        myQuest.sleepy = 1        if sleepy == 1		           			        fadein.Apply()            Game.GetPlayer().PlayIdle(WakeUp)			        Utility.Wait (3)        endif     game.setqueststage(20)	    Game.EnablePlayerControls()EndEvent


///UnRegisterForSleep()




What you think?

and how do I do to add the reference to the actual ojbect alias bed I placed as alias ? Should I attach this script to the bed alias or to the quest?
User avatar
sexy zara
 
Posts: 3268
Joined: Wed Nov 01, 2006 7:53 am

Post » Thu Jun 21, 2012 6:31 pm

The above code 'should' work for quest script, although it will need more ... work :P

You can place that particular bed you wish player to sleep on in the world. To link that bed to your quest, you can use Reference Alias. Go to Quest Alias in your quest window, create new Reference Alias. In 'Fill Type', you have an option to select whatever reference you want from the Render Window.

With Reference Alias (says myBed), you can assign any script to this Alias myBed while the quest is running. In this script, you could use 'RegisterForSleep' or 'OnActivate' or whatever you want player to do with in, then advance to next quest stage.
User avatar
vanuza
 
Posts: 3522
Joined: Fri Sep 22, 2006 11:14 pm

Post » Thu Jun 21, 2012 8:37 pm

I did this already and I added this following script to it ...


Scriptname Issgard_Shipbed   Int Property sleepy  Auto  ImageSpaceModifier Property FadeIn  Auto  ImageSpaceModifier Property FadeOut  Auto  Idle Property WakeUp  Auto  Idle Property gosleep  Auto  Event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime)    Game.DisablePlayerControls(ablooking = true, abCamSwitch = true)			    afDesiredSleepEndTime=2        Game.ForceThirdPerson()			    fadeout.Apply()        sleepy = 1        Utility.Wait (3)                    if sleepy == 1		           			        fadein.Apply()            Game.GetPlayer().PlayIdle(WakeUp)			        Utility.Wait (3)        endif     	    Game.EnablePlayerControls()EndEvent

I compiled fine ....

I added on stage 10 in the stages
KmyQuest.RegisterForSleep()

stage 20
UnRegisterForSleep()

now how that works looks?
User avatar
Theodore Walling
 
Posts: 3420
Joined: Sat Jun 02, 2007 12:48 pm

Post » Thu Jun 21, 2012 11:07 am

didn't work at all , looks like when I goto sleep in that bed the scripted stuff gets completely ignored , I got no debug showing ....
User avatar
Mario Alcantar
 
Posts: 3416
Joined: Sat Aug 18, 2007 8:26 am

Post » Thu Jun 21, 2012 5:51 am

Your script needs to extend quest. Also make sure that you selected the correct script when you set kMyQuest in the quest stage script fragments.
User avatar
Richard Thompson
 
Posts: 3302
Joined: Mon Jun 04, 2007 3:49 am

Post » Thu Jun 21, 2012 8:28 am

Your ShipBed script did NOT registerForSleep (It is a script attached to ReferenceAlias, right? If so, it should extends ReferenceAlias)

Your fragment Quest script registerForSleep does not necessary mean your alias script will as well. Each script should registerFor-whatever-event individually

You might want to create a function, say

Function RegisterForSleepEvent ()   RegisterForSleep()endFunction

and put it somewhere in your Issgard_ShipBed script

In your fragment, or your main quest script, you can call this function (depend on the quest stage as well)
Something like

Issgard_ShipBed Property ShipBed_Script autoShipBed_Script.RegisterForSleepEvent()
User avatar
Lyd
 
Posts: 3335
Joined: Sat Aug 26, 2006 2:56 pm

Post » Thu Jun 21, 2012 4:39 am

Here is edited :

Scriptname Issgard_Shipbed   extends ReferenceAlias  Int Property sleepy  Auto  ImageSpaceModifier Property FadeIn  Auto  ImageSpaceModifier Property FadeOut  Auto  Idle Property WakeUp  Auto  Idle Property gosleep  Auto  Quest Property journey01  Auto  Function RegisterForSleepEvent ()   RegisterForSleep()endFunctionEvent OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime)    Game.DisablePlayerControls(ablooking = true, abCamSwitch = true)			    afDesiredSleepEndTime=2        Game.ForceThirdPerson()			    fadeout.Apply()        sleepy = 1        Utility.Wait (3)                    if sleepy == 1		           			        fadein.Apply()            Game.GetPlayer().PlayIdle(WakeUp)			        Utility.Wait (3)        endif     	    Game.EnablePlayerControls()    journey01 .SetStage(20)    EndEvent

it gives error when I put

Issgard_ShipBed Property ShipBed_Script auto


ShipBed_Script.RegisterForSleepEvent()


the property in the fragment


Starting 1 compile threads for 1 files...
Compiling "QF_ISSGARDJourney01_0107303D"...
e:\giochi\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_ISSGARDJourney01_0107303D.psc(27,0): no viable alternative at input 'Issgard_ShipBed'
e:\giochi\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_ISSGARDJourney01_0107303D.psc(27,25): no viable alternative at input 'ShipBed_Script'
No output generated for QF_ISSGARDJourney01_0107303D, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on QF_ISSGARDJourney01_0107303D
User avatar
Brian LeHury
 
Posts: 3416
Joined: Tue May 22, 2007 6:54 am

Post » Thu Jun 21, 2012 4:13 pm

Fragments are actually functions (eg quest stage result scripts are functions in the quest fragments script).

You cannot declare a property inside of a function. You need to add the property to your quest fragments script before using it in the quest stage result script. If you don't have a quest fragments script, you can generate it by compiling ";" as a quest stage result script.
User avatar
mike
 
Posts: 3432
Joined: Fri Jul 27, 2007 6:51 pm

Post » Thu Jun 21, 2012 1:05 pm

I did also this but refused to compile taking out errors ...
User avatar
Amber Hubbard
 
Posts: 3537
Joined: Tue Dec 05, 2006 6:59 pm

Post » Thu Jun 21, 2012 7:44 am

RegisterForSleepEvent should be http://www.creationkit.com/RegisterForSleep_-_Form. If it still doesn't compile, exactly what's in your quest fragments script, and what are you trying to put in your quest stage result script?
User avatar
Maria Leon
 
Posts: 3413
Joined: Tue Aug 14, 2007 12:39 am

Post » Thu Jun 21, 2012 1:09 pm

I gived up with the bed as it is obviously not workig I did an activator box that "ALSO" is not working with this script alias !!!

Scriptname Issgard_Timebox extends ReferenceAlias  ImageSpaceModifier Property FadeIn  Auto  ImageSpaceModifier Property FadeOut  Auto  Quest Property journey01  Auto  Event OnActivate(ObjectReference akActionRef)  if (akActionRef == game.GetPlayer() && journey01.GetStage()<20 &&journey01.GetStage() >=10)				Debug.Notification("Sleeped and quest is stage 10 ")			Game.DisablePlayerControls(ablooking = true, abCamSwitch = true)							FadeOut.Apply()		  Utility.Wait (3)								FadeIn.Apply()								Utility.Wait (3)			  Game.EnablePlayerControls()		journey01.SetStage(20)		Debug.Notification("Sleeped and quest is stage 20 ")endifEndEvent	


Can someone be able to tell me a working script that is able to perform with the Bed Solution what I have described ? I almosut been all evening here on this small script and I couln't progress at all in quest , it's very frustrating as I amno scripter ...
User avatar
jenny goodwin
 
Posts: 3461
Joined: Wed Sep 13, 2006 4:57 am

Post » Thu Jun 21, 2012 5:29 pm

I apology, my previous post was a little misleading, it will work if you put these

Issgard_ShipBed Property ShipBed_Script autoShipBed_Script.RegisterForSleepEvent()

inside your main Quest, NOT fragment Quest window.

RegisterForSleepEvent should be http://www.creationkit.com/RegisterForSleep_-_Form. If it still doesn't compile, exactly what's in your quest fragments script, and what are you trying to put in your quest stage result script?

RegisterForSleepEvent is custom function I suggested. This was meant to be called remotely from other script....


@Prometheus: You can try to put those code I mentioned inside a main Quest script, not Fragment, or... making your Bed's script looks something like this:

Scriptname Issgard_Shipbed   extends ReferenceAlias;;;; Variables and stuff goes herebool activeOnce;{Register this script for player's sleep when player click/activate the bed}Event OnActivate(ObjectReference akActionRef)   if (!activeOnce)	  RegisterForSleep()	  activeOnce = true   endifEndEvent;{Handling the quest's stage after when player finish sleeping}Event OnSleepStop(bool abInterrupted)   ;do what you must here   ;advance quest stage, or start new quest, or Keyword.SendStoryEvent ......EndEvent

Plz note that, this script must be attached to the bed's Quest Alias
User avatar
danni Marchant
 
Posts: 3420
Joined: Sat Oct 07, 2006 2:32 am

Post » Thu Jun 21, 2012 11:53 am

Bed's quest alias ? I need to make another alias for the quest inside the quest? I attached to the bed if I add to the quest how will recognize the bed is using ? Thx for helping btw...
User avatar
Andrew Lang
 
Posts: 3489
Joined: Thu Oct 11, 2007 8:50 pm

Post » Thu Jun 21, 2012 11:31 am

I put tthis

Issgard_ShipBed Property ShipBed_Script auto

ShipBed_Script.RegisterForSleepEvent()

inthe main script of the quest but this is the result ...





Starting 1 compile threads for 1 files...
Compiling "QF_ISSGARDJourney01_0107303D"...
e:\giochi\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_ISSGARDJourney01_0107303D.psc(49,14): no viable alternative at input '.'
No output generated for QF_ISSGARDJourney01_0107303D, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on QF_ISSGARDJourney01_0107303D
User avatar
Shannon Marie Jones
 
Posts: 3391
Joined: Sun Nov 12, 2006 3:19 pm

Next

Return to V - Skyrim