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
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#1
Dark Intro Almost Sequence

I need some assistance with an intro.

The plan is to just have the game open in darkness, but with the sound of rain and two characters talking being heard, then show the title of the story before fading into the first explorable map.

My thought is to just start the player out on a completely black map and then teleport them to the next, but I'm not sure how to go about scripting it. =/

Any help would be appreciated.

10-02-2013, 12:09 AM
Find
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
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#3
RE: Dark Intro Almost Sequence

Thanks so much! I'm trying it out now and will let you know how it goes! =D

EDIT: It's works brilliantly! The only thing that's not coming through is the title. I checked to make sure the names match up and it looks like they do, so not too sure what's going on there.

(This post was last modified: 10-02-2013, 06:37 AM by AGP.)
10-02-2013, 06:24 AM
Find
Romulator Offline
Not Tech Support ;-)

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

Give me a moment and I'll type it up

<CATEGORY Name="Messages">
<Entry Name="Title">CSTitle</Entry>
</CATEGORY>

Just change the "CSTitle" to whatever, then put it into the extra_english.lang file anywhere between the <LANGUAGE> and </LANGUAGE> categories, and does not interfere with other categories or the resources. Smile

Example:
<LANGUAGE>
  <RESOURCES>
    <Directory Path="fonts/eng" />
    <Directory Path="lang/eng" />
  </RESOURCES>
  <CATEGORY Name="Messages">
    <Entry Name="Title">CSTitle</Entry>
  </CATEGORY>
</LANGUAGE>

Also, in case you are wondering, I got all this scripting stuff from prior experience, and from looking at the Engine Scripts page, which contains all the codes usable in Amnesia: The Dark Descent.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 10-02-2013, 06:57 AM by Romulator.)
10-02-2013, 06:48 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#5
RE: Dark Intro Almost Sequence

Found out what the issue is... sort of.

For some reason the .lang file is no longer being detected and so nothing is showing. This happens to me every once in a while. Don't know why or how, don't even know how to fix it.

Usually restarting the computer helps, but that didn't do anything.

10-02-2013, 07:10 AM
Find
Romulator Offline
Not Tech Support ;-)

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

Could you please post it? Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
10-02-2013, 07:12 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#7
RE: Dark Intro Almost Sequence

Sent in a PM.

10-02-2013, 07:16 AM
Find




Users browsing this thread: 1 Guest(s)