Frictional Games Forum (read-only)

Full Version: How to make an intro?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is what I want to do.

When you click start, you see just a black screen and you hear a voice telling something about the story with some backround music, then the blackness fades out and the game begins.

How do I make this happen?


Thanks
this is done pretty simple:

first, under your OnStart() section you code the following

PHP Code:
OnStart() {
fadeout(0.0f);
AddTimer("GameBegin"5.0f"GameBeginFunction");
}

void GameBeginFunction (string &in asTimer) {
stuffyouwanttohappen();


The AddTimer is the timer for when you want stuff to happen.

When you want the screen to go normal again, you either do it with an extra timer or you include it in your function somewhere.

I've get something similar in my full conversion, maybe you'r interested but you can take a look if you want. (Added as attachment and you will have to re-save it as a .hps file as i couldn't upload it in that format for some reason)

EDIT: If you have more questions, feel free to ask at any time!
Here's your script. The Voice must have the Background Music added on it's .ogg file. If I recall correctly.

PHP Code:
void OnStart()
{
FadeOut(0);
AddTimer("Opening"5.0f"OpeningIntro"); //5.0f is how long the voice will start
}

void OpeningIntro(string &in asTimer)
{
AddEffectVoice("VoiceFile.ogg""EffectToPlay""TextCategory""TextEntry"true"TheEntityWhereTheSoundOriginates"110);

(11-29-2013, 01:52 PM)JustAnotherPlayer Wrote: [ -> ]Here's your script. The Voice must have the Background Music added on it's .ogg file. If I recall correctly.

PHP Code:
void OnStart()
{
FadeOut(0);
AddTimer("Opening"5.0f"OpeningIntro"); //5.0f is how long the voice will start
}

void OpeningIntro(string &in asTimer)
{
AddEffectVoice("VoiceFile.ogg""EffectToPlay""TextCategory""TextEntry"true"TheEntityWhereTheSoundOriginates"110);


Okay, everything works except for the fade in. The game starts out with a black screen and the voice starts. that works, but after the voice the screen continue to be black. What did I forget?

void OnStart()
{
FadeOut(0);
AddTimer("Opening", 5.0f, "OpeningIntro"); //5.0f is how long the voice will start
}

void OpeningIntro(string &in asTimer)
{
AddEffectVoice("record_music.ogg", "EffectToPlay", "TextCategory", "TextEntry", true, "TheEntityWhereTheSoundOriginates", 1, 10);
}
You forgot to use the function to fade the screen to normal again Big Grin
You should change your code to something similar to this:
PHP Code:
void OnStart()
{
FadeOut(0);
AddTimer("Opening"5.0f"OpeningIntro");
}

void OpeningIntro(string &in asTimer)
{
AddEffectVoice("record_music.ogg""EffectToPlay""TextCategory""TextEntry"true"TheEntityWhereTheSoundOriginates"110);
AddTimer("EndOpening"x.xf"FadeIn"); //x.x depends on how long your intro is (time till fadein starts)
}
void FadeIn (string &in asTimer) {
FadeIn(x.xf); //x.x is how long it takes to go from black to normal

Hope understand everything i've written. I tried explaining it a bit simple c:
(11-30-2013, 08:01 PM)RaideX Wrote: [ -> ]You forgot to use the function to fade the screen to normal again Big Grin
You should change your code to something similar to this:
PHP Code:
void OnStart()
{
FadeOut(0);
AddTimer("Opening"5.0f"OpeningIntro");
}

void OpeningIntro(string &in asTimer)
{
AddEffectVoice("record_music.ogg""EffectToPlay""TextCategory""TextEntry"true"TheEntityWhereTheSoundOriginates"110);
AddTimer("EndOpening"x.xf"FadeIn"); //x.x depends on how long your intro is (time till fadein starts)
}
void FadeIn (string &in asTimer) {
FadeIn(x.xf); //x.x is how long it takes to go from black to normal

Hope understand everything i've written. I tried explaining it a bit simple c:

Thanks so much, dude. It works now Smile
Could help me with something else please, I want to make it that when you enter a certain area a message pops up.
Quote:Thanks so much, dude. It works now Smile
Could help me with something else please, I want to make it that when you enter a certain area a message pops up.

Glad it worked Big Grin. For you other question i'll try to explain it as easy as the first one c:

PHP Code:
OnStart() {
AddEntityCollideCallback("Player""CollideArea""CollideFunction"true1)
//When "Player" collides with "CollideArea" the "CollideFunction" is called and the area gets disabled (true) when you enter it (1)
}

void CollideFunction (string &in asParentstring &in asChildint alState) {
SetMessage("TextCategory""TextEntry"x.xf); 
//"TextCategory" is the category in your .lang file and "TextEntry" the entry. x.xf is how long it should be displayed (0 means auto calculate)


Regarding the .lang file: You basically have to write your text in this file and tell the game then where to get the text to display from.

Oh and of course you will have to create the "CollideArea" with the level editor, just in case you didn't know.

EDIT: You can also get EVERYTHING you want to code on this site.