Frictional Games Forum (read-only)

Full Version: How to script waking up in a bed?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to start off with a kind of cliche "wake up in a bed, look around, then get out of the bed" type of thing. Only thing is, I don't know how to script it. Do I have to rotate the player start area so that the player starts sideways? Then how to I get him out of the bed? Please give me some suggestions.
You don't script this kind of thing in the level editor. What you've gotta do is place a couple of script areas around the room in the exact location you want the player's view to be centered at, so where you want him to look in the room is where you place these script areas. Then, in your .hps file for that level, under the 'OnStart' section, you would use FadeOut with a time of 0 seconds, then FadeIn with however much time you want, then throw some timers in there, with each timer using StartPlayerLookAt and telling the player to look around at the various scriptareas in the room, by name. Don't forget to use StopPlayerLookAt(); to give back player control once you are satisfied with him looking around! And throw some PlaySoundAtEntity funcs to make the player breathe, and if you're feeling fancy, use FadeSepiaColorTo and FadeImageTrailTo to imitate grogginess upon waking up. Hope that helps Smile