RegisterForSleep Where & what?

Post » Tue Nov 20, 2012 5:02 am

I feel kinda bad by creating another topic on that subject but I need the basic understanding on the event http://www.creationkit.com/RegisterForSleep_-_Form.

Basically, I want to be able to make something happen when the player sleep and I keep seeing "Before you can use http://www.creationkit.com/OnSleepStart_-_Form you must register."

Also, I have no idea where I should put the piece of script. On the bed? In the player's alias in the quest? In the quest script tab? :ermm:


I would really appreciate if I can get some quick help because I am making some kind of assignment that is due tomorrow. I've check already on the forum but there is nothing about basic understanding. The replies are all taking for granted that you know how it works.

Thank you!

:biggrin:
User avatar
Matt Bigelow
 
Posts: 3350
Joined: Sun Sep 30, 2007 6:36 pm

Post » Tue Nov 20, 2012 4:45 am

You need to Register the Bed with Bethesda before the NPC can sleep in it.




OK, I am kidding, I am sure someone will come along with the correct answer.....
User avatar
Shiarra Curtis
 
Posts: 3393
Joined: Thu Jan 04, 2007 3:22 pm

Post » Tue Nov 20, 2012 2:35 pm

Also, I have no idea where I should put the piece of script. On the bed? In the player's alias in the quest? In the quest script tab?


That depends. Who needs to receive the event?

When you register a script for an event, when that event is raised, you can catch it with an Event block. So, say I wanted an ObjectReference to enable itself when the player sleeps. I might do something like this...

Event OnInit()   RegisterForSleep()endEventEvent OnSleepStop(bool abInterrupted)	self.Enable()endEvent

This would register your ObjectReference for player sleep events on instantiation, and would enable itself when the registered event is raised.

I hope that answers your question enough to get started. Just think about who needs to catch the event, and register for it there in a block of code that will execute. This could be a quest stage fragment, or an OnInit() block when quests are initialized or when ObjectReferences are instantiated.
User avatar
Kira! :)))
 
Posts: 3496
Joined: Fri Mar 02, 2007 1:07 pm


Return to V - Skyrim