Frictional Games Forum (read-only)

Full Version: An eager newcomer who wants to learn...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello! I am not new to the modding scene at all, and have a good grasp of HPL 2 in two days. So, this will not be a barrage of simple questions. In fact, the only reason I ask is because I hear the community is nice, and I can't find tutorials for this.

1: How do I create ambient noises in a level? This includes music or stuff like rain or humming. I cannot, for the life of me, figure it out.

2: Book creation! How do I make my own book like the diary pages of Daniel? Is there an extensive tutorial here for it? They will be narrated, so I need to know how to attatch .ogg's to them as well.

3: How do I polish up a "start" of a map? Like the screen fading in, a note or narration playing right away before the player has control, stuff like that? Right now I just "teleport" into my map and my narrations aren't working.

4: How do I make supplies carry over between levels? This is aggrevating me. All my tinderboxes and equipment reset per level_door usage.

Thanks so much for your time guys.
Aye, thanks mate. I will read it eagerly and willingly from top to bottom! I love this engine.
Okey doke, that solved all questions besides two!

3 and 1 were unanswered and still stand. Smile Anyone want to help me out with those?
I add just one more question. How do I add multiple keys and doors into the same .hps file? Smile
Just add multiple instances of the code. If you want to have two keys open two doors, use the same script twice, with the appropriate entities matched up.

As to #3, it's in the reference thread. CTRL + F and look for 'faint' and it should take you to the mini-tutorial. Click the link to see a list of relevant functions I posted on a thread asking a similar question.

#1 is also there too, but on a different thread which the reference thread I posted leads to. Search for 'cool thing' and you should find the link. Click that and look for 'scary/spooky ambience' or something like that. That should give you a script structure to use for random ambience.
Alright, we're getting there!

Ambient sound is 99% done, that variation worked. However I can't figure out how to add my own music into the mix, want to give me some pointers?

Lastly, that "faint" script didn't help at ALL. I just want a diary entry to play immediately upon the game starting. If that can't be done, just a screen fade out to fade in would suffice, I couldn't trim that script out of the whole rolling/fainting mode.
As far as I know, you can't show the player automatically a diary entry.
But you can easily make a Fade out/Fade in:

Code:
void OnStart(){
FadeOut(0);
AddTimer("", 3, "FadeIn");
}

void FadeIn(string &in asTimer){
FadeIn(3);
}
This page shows you all the script functions.

http://wiki.frictionalgames.com/hpl2/amn..._functions

A script function is a series of commands built into one common job, or function. In AngelScript, the programming language that Amnesia uses, you can create your own functions. I also want to note that AngelScript is very similar to C++. A callback is a built in function that calls another function, in which is usually a functon you create. Every function has parameters that are needed to be told in a callback to correctly call the correct function.

Code:
void Function01()
{

}

Let's take apart this function. Its type is "void" in which it has no apparent type. Then there is the function name, which is "Function01". The parentheses at the end dictate what it includes in the function. It's blank so it has nothing added to it.

Code:
void Function01(string &in asEntity)
{

}

This has a parameter. It is a string, or text. It's name is "asEntity". Whatever asEntity holds in there can be used in the function for other built in callbacks.
(07-31-2011, 09:10 AM)MrCookieh Wrote: [ -> ]As far as I know, you can't show the player automatically a diary entry.
But you can easily make a Fade out/Fade in:

Code:
void OnStart(){
FadeOut(0);
AddTimer("", 3, "FadeIn");
}

void FadeIn(string &in asTimer){
FadeIn(3);
}

Hey man that looked good but it actually makes my custom story crash. Want to take a look to see whats wrong? I'm still learning the steps of the code.

http://i.imgur.com/NzIZ4.jpg
You have to put the
Code:
AddUseItemCallback(...);
AddUseItemCallback(...);

into the void OnStart() function
Pages: 1 2