How to force the player to sleep

Post » Sat Nov 17, 2012 6:51 am

Hi,

I want to force the player to sleep anywhere, without any bed via script. Can it be done? Thanks in advance.
User avatar
Carolyne Bolt
 
Posts: 3401
Joined: Mon Jul 10, 2006 4:56 am

Post » Sat Nov 17, 2012 2:26 am

http://www.creationkit.com/Sleep_(Procedure

Like the page says, don't know if it will work. But it may be worth investigating. You will have to create a quest with an ai package override (either at the quest level or maybe in a scene) and use a player alias to force the package on the player.

I know in my mod (AFT) I spawn a portable bed object whenever you tell a follower to make camp or sleep. It seems these bed objects have activators on them that allow hooks into the games sleep system. There is an invisible one you can spawn/place anywhere (That is how I make followers sleep), however I don't know if a procedure can be set up to force the player to use/activate an object. If so, that might be your best bet (via a quest scene and a dynamically spawned invisible bed). However, even then, the user would probably get presented with a sleep menu which would let them specify only 1 hour or even cancel.

If the procedures don't work, you might want to consider a different approach. if sleep requires the Player to willingly activate something and choose a time setting, maybe you can "encourage" it more drastically.. For example, I might add a "Sleep Burden" quest object to the users inventory with a timer that decreases the players movement speed every 8 hours. Eventually, movement is so slow, the player more or less has to sleep to continue playing the game. Luckily, their inventory object could also serve as the sleep activator or a way of spawning a portable bed. So you aren't forcing them in a programatic sense, but you are still more or less forcing them to sleep. People probably wont mind as long as they can pull out their portable sleeping bag anywhere they need to.

Good luck
User avatar
Rachel Cafferty
 
Posts: 3442
Joined: Thu Jun 22, 2006 1:48 am

Post » Sat Nov 17, 2012 9:08 am

http://www.creationkit.com/Sleep_(Procedure

Like the page says, don't know if it will work. But it may be worth investigating. You will have to create a quest with an ai package override (either at the quest level or maybe in a scene) and use a player alias to force the package on the player.

I know in my mod (AFT) I spawn a portable bed object whenever you tell a follower to make camp or sleep. It seems these bed objects have activators on them that allow hooks into the games sleep system. There is an invisible one you can spawn/place anywhere (That is how I make followers sleep), however I don't know if a procedure can be set up to force the player to use/activate an object. If so, that might be your best bet (via a quest scene and a dynamically spawned invisible bed). However, even then, the user would probably get presented with a sleep menu which would let them specify only 1 hour or even cancel.

If the procedures don't work, you might want to consider a different approach. if sleep requires the Player to willingly activate something and choose a time setting, maybe you can "encourage" it more drastically.. For example, I might add a "Sleep Burden" quest object to the users inventory with a timer that decreases the players movement speed every 8 hours. Eventually, movement is so slow, the player more or less has to sleep to continue playing the game. Luckily, their inventory object could also serve as the sleep activator or a way of spawning a portable bed. So you aren't forcing them in a programatic sense, but you are still more or less forcing them to sleep. People probably wont mind as long as they can pull out their portable sleeping bag anywhere they need to.

Good luck

In truth I have already solved the problem. I have simpy spawned an invisible bed, forced the player to activate it and then destroyed it. Works like a charm! Anyway thanks. Now excuse me my werewolf has just woke up and his wolf pack grows restless:)
User avatar
Sabrina Steige
 
Posts: 3396
Joined: Mon Aug 20, 2007 9:51 pm


Return to V - Skyrim