Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dark Intro Almost Sequence
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Dark Intro Almost Sequence

Done. Editing this post now Tongue

===============================
Okay, since what you have said needs a couple of steps in order to do properly, I'll break this down into spoilers.

Setting up the environment
Spoiler below!

Create a cube using the static object plane_black, which can be found under "technical" in the Level Editor using the brick button thingy, then add a PlayerStart from the Areas. This will be where you hear the rain and the conversation.

Next, add another PlayerStartArea wherever you want the game to begin, with the blue arrow within the box facing the direction you want the game to start in.

Have an example of what I did:
[Image: 2uthtgj.png]


Scripting
Spoiler below!

This bit here gets a bit technical, so I will take it slowly.
PHP Code: (Select All)
void OnStart()
    {
    
SetPlayerMoveSpeedMul(0.0f);
    
SetPlayerRunSpeedMul(0.0f);
    
SetPlayerLookSpeedMul(0.0f);
    
SetPlayerJumpDisabled(true);
    
SetPlayerCrouchDisabled(true);
    
SetSanityDrainDisabled(true);
    
SetPlayerActive(false);
    
PlaySoundAtEntity("rain""general_rain.snt""Player"0.1ffalse);
    
PlayMusic("conversation.ogg"false1.0f0.0f1false);
    
AddTimer("showtitle"15.0f"DisplayTitle");
    
AddTimer("teleport"30.0f"ReturnToNormal");
    } 
This is the starting code, which will happen while you are in the cube. Everything before PlaySoundAtEntity() stops the player from moving.
PlaySoundAtEntity() will get your rain going. It will play the sound around the Player and will loop.

PlayMusic() will play a conversation, but you must supply it. Download Audacity and record or place your conversation in that, then render it as an .ogg file. Place it somewhere like your custom_stories/<story>/music/ folder, naming it "conversion.ogg" with no quotes. The following code on that line simply says that it wont loop, plays above any other music and does not fade in or out.

AddTimer(showtitle) is a timer which after 15 seconds will run a function called "DisplayTitle" (shown below).
AddTimer(teleport) does the same, but calls the function "ReturnToNormal" after 30 seconds (shown below).

PHP Code: (Select All)
void DisplayTitle(string &in asTimer)
    {
    
AddTimer("fade"10.0f"FadeTimer");
    
SetMessage("Messages""Title"12.0f);
    } 

That void text basically means anything which we want to happen once that timer is executed goes in here. In this one, we will display the title of the game for 12 seconds, and fade the game to white after ten seconds.

In order to get your title to display however, you'll need to navigate to your extra_english.lang file (you should have one if making a Custom Story) and add a category and entry to it with your game title and name. There are enough tutorials of that on here, so a simple search will fix you there.

PHP Code: (Select All)
void FadeTimer(string &in asTimer)
    {
    
StartEffectFlash(3.0f1.0f4.0f);
    } 

Simply fades the screen to completely white (1.0f). In fading to white, it takes 3 seconds, and fading out takes 4.

PHP Code: (Select All)
void ReturnToNormal(string &in asTimer)
    {
    
SetPlayerMoveSpeedMul(1.0f);
    
SetPlayerRunSpeedMul(1.0f);
    
SetPlayerLookSpeedMul(1.0f);
    
SetPlayerJumpDisabled(false);
    
SetPlayerCrouchDisabled(false);
    
SetSanityDrainDisabled(false);
    
SetPlayerActive(true);
    
StopSound("rain"1.0f);
    
TeleportPlayer("PlayerStartArea_2");
    } 

This will basically return everything to normal, stop the sound of the rain, then it will take the player and move him/her to the start.

So with this script, you place it into a text editor (notepad or similar) and when you save it, name it the same name as the map, but change the extension to hps. So assume your map name is Level1.map, your script will be named Level1.hps

Here is the full script to avoid copying and pasting it all:
PHP Code: (Select All)
void OnStart()
    {
    
SetPlayerMoveSpeedMul(0.0f);
    
SetPlayerRunSpeedMul(0.0f);
    
SetPlayerLookSpeedMul(0.0f);
    
SetPlayerJumpDisabled(true);
    
SetPlayerCrouchDisabled(true);
    
SetSanityDrainDisabled(true);
    
SetPlayerActive(false);
    
PlaySoundAtEntity("rain""general_rain.snt""Player"0.1ffalse);
    
PlayMusic("conversation.ogg"false1.0f0.0f1false);
    
AddTimer("showtitle"15.0f"DisplayTitle");
    
AddTimer("teleport"30.0f"ReturnToNormal");
    }
    
void DisplayTitle(string &in asTimer)
    {
    
AddTimer("fade"10.0f"FadeTimer");
    
SetMessage("Messages""Title"10.0f);
    }

void FadeTimer(string &in asTimer)
    {
    
StartEffectFlash(3.0f1.0f4.0f);
    }
    
void ReturnToNormal(string &in asTimer)
    {
    
SetPlayerMoveSpeedMul(1.0f);
    
SetPlayerRunSpeedMul(1.0f);
    
SetPlayerLookSpeedMul(1.0f);
    
SetPlayerJumpDisabled(false);
    
SetPlayerCrouchDisabled(false);
    
SetSanityDrainDisabled(false);
    
SetPlayerActive(true);
    
StopSound("rain"1.0f);
    
TeleportPlayer("PlayerStartArea_2");
    }
    
void OnLeave()
    {
    
    } 


Too Long; Didn't Read
Spoiler below!


I would advise you to read the above, but if you rather not, here you go.

Copy and paste this script into your <levelname>.hps file
PHP Code: (Select All)
void OnStart()
    {
    
SetPlayerMoveSpeedMul(0.0f);
    
SetPlayerRunSpeedMul(0.0f);
    
SetPlayerLookSpeedMul(0.0f);
    
SetPlayerJumpDisabled(true);
    
SetPlayerCrouchDisabled(true);
    
SetSanityDrainDisabled(true);
    
SetPlayerActive(false);
    
PlaySoundAtEntity("rain""general_rain.snt""Player"0.1ffalse);
    
PlayMusic("conversation.ogg"false1.0f0.0f1false);
    
AddTimer("showtitle"15.0f"DisplayTitle");
    
AddTimer("teleport"30.0f"ReturnToNormal");
    }
    
void DisplayTitle(string &in asTimer)
    {
    
AddTimer("fade"10.0f"FadeTimer");
    
SetMessage("Messages""Title"10.0f);
    }

void FadeTimer(string &in asTimer)
    {
    
StartEffectFlash(3.0f1.0f4.0f);
    }
    
void ReturnToNormal(string &in asTimer)
    {
    
SetPlayerMoveSpeedMul(1.0f);
    
SetPlayerRunSpeedMul(1.0f);
    
SetPlayerLookSpeedMul(1.0f);
    
SetPlayerJumpDisabled(false);
    
SetPlayerCrouchDisabled(false);
    
SetSanityDrainDisabled(false);
    
SetPlayerActive(true);
    
StopSound("rain"1.0f);
    
TeleportPlayer("PlayerStartArea_2");
    }
    
void OnLeave()
    {
    
    } 

You will need to however do a thing or two to make sure your code works:
- You will need to record or place the conversation sounds into Audacity (google it) and render as an .ogg file.
- You will need to add the name of your Amnesia CS to the extra_english.lang

And you will need to set up your environment properly, which I think you should read in the least.


GOOD LUCK! Big Grin

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 10-02-2013, 04:36 AM by Romulator.)
10-02-2013, 02:59 AM
Find


Messages In This Thread
Dark Intro Almost Sequence - by AGP - 10-02-2013, 12:09 AM
RE: Dark Intro Almost Sequence - by Romulator - 10-02-2013, 02:59 AM
RE: Dark Intro Almost Sequence - by AGP - 10-02-2013, 06:24 AM
RE: Dark Intro Almost Sequence - by Romulator - 10-02-2013, 06:48 AM
RE: Dark Intro Almost Sequence - by AGP - 10-02-2013, 07:10 AM
RE: Dark Intro Almost Sequence - by Romulator - 10-02-2013, 07:12 AM
RE: Dark Intro Almost Sequence - by AGP - 10-02-2013, 07:16 AM



Users browsing this thread: 1 Guest(s)