Frictional Games Forum (read-only)
Beginner asking for some help. - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Beginner asking for some help. (/thread-23379.html)

Pages: 1 2 3 4


Beginner asking for some help. - daortir - 09-25-2013

Hello everyone !
FIrst of all I'm quite new to the forums, even tough I've read a lot of stuff there. So I aplogize if I'm doing things wrong, or posting in the wrong section.

I started with Custom Stories creation a few weeks ago, did some really bad things at the beginning, but now I'm starting to understand most of the basic mechanisms that make a CS look nice. I still have a loooot to learn, but today I want to focus on one big question : how do I deal with sound files ?

I wanted the player to try to open a door, and make a scary noise come right when he tries to open it. In which folder should I ut the sounds I wanna use for my CS ? Or the eventual musics ?

And what is the best script for that kind of event ? (PlaySoundAtEntity, FadeInSound,... ?)

I managed to deal with a lot of isues so far (making a decent crowbar event, making my lighting look "decent",...) but I couldn't find a tutorial on YouTube, or any help on that in the Wiki >< .

I hope someone will be able to help me : ).

EDIT : I'm sorry by the way, as I said I'm new to the forums and there is a CS Support forum. I'm sorry for my mistake, but Frictional won't allow me to delete this post yet, for some odd reason. Sorry about that ><...


RE: Asking for some help with the sound files ! - The chaser - 09-25-2013

Go the Amnesia sounds folder "redist<sounds" and search your sound there (the .ogg file are the sound, the .snt files are text files which have specific configuration, specially for Amnesia). Then, simply put this line of code right when the player touches the door:

PlaySoundAtEntity("Justaname", "yoursound.snt", "Player", 1.0, false);

This right here is your friend. Downloading it as a .pdf is a very good choice Smile
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: Asking for some help with the sound files ! - FlawlessHappiness - 09-25-2013

A mod will move the thread when they see it Smile


You put the files in custom_stories/[YOUR CS]/sounds

Now you need to be sure that you have added
PHP Code:
<Directory Path="/custom_stories" AddSubDirs="true" /> 

in the resources.cfg file in the redist-folder.

For the event you're describing I'd use PlaySoundAtEntity, and you should be good to go.

Please, do respond if something is wrong, or if it works.


EDIT: GOD NO F... I got ninjaed by dat cwazy duck up there


RE: Asking for some help with the sound files ! - daortir - 09-25-2013

It worked, thanks a lot ! I actually moved all the files from the /sounds/scares folder to my custom story, so I'll be able to make that kind of small things easily in the future.

Well, thanks again for your help, I'll probably have some more questions in the future x) !


RE: Asking for some help with the sound files ! - FlawlessHappiness - 09-25-2013

Um... Smile

If the sounds are from the original amnesia, you don't need to add them to your custom story. People have the sounds too, so it should be no problem. Adding them to your CS is only if they're custom


RE: Asking for some help with the sound files ! - daortir - 09-26-2013

o_o.
That's gonna save me a lot of time I guess, thank you <3.

For now I'm gonna stick to the original sounds, but I might try to import some of my own : I didn't find what I was exactly looking for in the Amnesia files.

By the way, I want some functions to be called when my Player enters a script Area, what should I use ? I know it's a very basic function so I wanna be sure to do it right x)... Should I use AddEntityCollideCallback for that kind of things ?


RE: Asking for some help with the sound files ! - CarnivorousJelly - 09-26-2013

Yes, you should :) Use it like this:

AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

string& asParentName: the main object - in this case, it's "Player"
string& asChildName: the thing being collided with - in this case, it's whatever you called the area
string& asFunction: the script you're calling
bool abDeleteOnCollide: true or false, it wants to know if the function should occur every time you collide with the area
int alStates: when the collision starts; on entering the area (1), on leaving the area (-1) or both (0)

The program is case-sensitive, so watch for capitals, and make sure you use quotation marks where it says string, or the script won't work!


I should add an example:
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "area_monster", "script_ahhh", true, 0);
//The player is colliding with area_monster to trigger a script later in the file, which is called script_monster
//It will be deleted after the player triggers it, so it won't happen again
// The script will be triggered when the player enters or leaves the area
}

void script_ahhh(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("monster_grunt_1", true);
//This sets a pre-determined grunt model into existence in the player's world
}

Also, the lines with // in front of them are just comments (me explaining stuff)


RE: Asking for some help with the sound files ! - FlawlessHappiness - 09-26-2013

Kia you are missing the parameters Smile

After "void script_ahhh" you need to put (string &in asParent, string &in asChild, int alState) so it is like this


void script_ahhh(string &in asParent, string &in asChild, int alState)



For more help with parameters:http://www.frictionalgames.com/forum/thread-18368.html


RE: Asking for some help with the sound files ! - daortir - 09-26-2013

Well I did manage to get my functions called : D !
Now I'm having some more issues (I'm sorry about asking so much help, but scripting kinda looks terribly hard to me xD). Her's the thing : I want my player to enter a script area, which actually is a bed. Then the screen fades to black while a message is displayed on the screen. So far, i made it work easily.
But then, I want to add a timer that calls the Changemap function when it expires.
And I just can't get it to work, I get a fatal error : "No matching signatures".

Here's the code I used :


void LevelFinished(string &in asParent, string &in asChild, int alState)
{
FadeOut(5);
SetMessage("Messages", "sleep", 3);
AddTimer("", 5, LoadNextMap);
}
void LoadNextMap(string &in asName, int alCount)
{
ChangeMap("firstdream", "PlayerStartArea_1", "", "");
}

Thanks again for all your help !
EDIT : renamed topic ^^. Maybe that'll be a little better.


RE: Beginner asking for some help. - PutraenusAlivius - 09-26-2013

(09-26-2013, 03:32 PM)daortir Wrote: Well I did manage to get my functions called : D !
Now I'm having some more issues (I'm sorry about asking so much help, but scripting kinda looks terribly hard to me xD). Her's the thing : I want my player to enter a script area, which actually is a bed. Then the screen fades to black while a message is displayed on the screen. So far, i made it work easily.
But then, I want to add a timer that calls the Changemap function when it expires.
And I just can't get it to work, I get a fatal error : "No matching signatures".

Here's the code I used :


void LevelFinished(string &in asParent, string &in asChild, int alState)
{
FadeOut(5);
SetMessage("Messages", "sleep", 3);
AddTimer("", 5, LoadNextMap);
}
void LoadNextMap(string &in asName, int alCount)
{
ChangeMap("firstdream", "PlayerStartArea_1", "", "");
}

Thanks again for all your help !
EDIT : renamed topic ^^. Maybe that'll be a little better.

PHP Code:
AddTimer(""5LoadNextMap); 

You forgot to add quotation marks.

The right one:
PHP Code:
AddTimer(""5"LoadNextMap"); 
--------------------------------------------------------------------------
PHP Code:
void LoadNextMap(string &in asNameint alCount


You have the wrong callback syntax.

The right one:
PHP Code:
void LoadNextMap(string &in asTimer