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
Beginner asking for some help.
daortir Offline
Senior Member

Posts: 422
Threads: 9
Joined: Sep 2013
Reputation: 18
#1
Beginner asking for some help.

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 ><...

(This post was last modified: 09-26-2013, 03:33 PM by daortir.)
09-25-2013, 09:38 PM
Find Reply
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#2
RE: Asking for some help with the sound files !

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/amn..._functions

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
09-25-2013, 09:57 PM
Find Reply
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: Asking for some help with the sound files !

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: (Select All)
<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

Trying is the first step to success.
(This post was last modified: 09-25-2013, 10:00 PM by FlawlessHappiness.)
09-25-2013, 09:59 PM
Find Reply
daortir Offline
Senior Member

Posts: 422
Threads: 9
Joined: Sep 2013
Reputation: 18
#4
RE: Asking for some help with the sound files !

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) !

09-25-2013, 10:56 PM
Find Reply
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: Asking for some help with the sound files !

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

Trying is the first step to success.
09-25-2013, 11:35 PM
Find Reply
daortir Offline
Senior Member

Posts: 422
Threads: 9
Joined: Sep 2013
Reputation: 18
#6
RE: Asking for some help with the sound files !

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 ?

09-26-2013, 12:04 AM
Find Reply
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#7
RE: Asking for some help with the sound files !

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:
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)

[Image: quote_by_rueppells_fox-d9ciupp.png]
(This post was last modified: 09-26-2013, 05:58 PM by CarnivorousJelly.)
09-26-2013, 02:00 AM
Find Reply
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
RE: Asking for some help with the sound files !

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

Trying is the first step to success.
(This post was last modified: 09-26-2013, 07:07 AM by FlawlessHappiness.)
09-26-2013, 07:07 AM
Find Reply
daortir Offline
Senior Member

Posts: 422
Threads: 9
Joined: Sep 2013
Reputation: 18
#9
RE: Asking for some help with the sound files !

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.

(This post was last modified: 09-26-2013, 03:34 PM by daortir.)
09-26-2013, 03:32 PM
Find Reply
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#10
RE: Beginner asking for some help.

(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: (Select All)
AddTimer(""5LoadNextMap); 

You forgot to add quotation marks.

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


You have the wrong callback syntax.

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

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 09-26-2013, 03:39 PM by PutraenusAlivius.)
09-26-2013, 03:39 PM
Find Reply




Users browsing this thread: 1 Guest(s)