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
An eager newcomer who wants to learn...
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#15
RE: An eager newcomer who wants to learn...

When the player collides with an area of some sorts, which in this example I'll call "ScriptArea_1", we have a footstep sound play. When using the PlaySoundAtEntity command function, you have to choose a location at which the sound will be played at. Perhaps behind the player? Lets call this area/object "SoundPlay".

PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

As I take this directly from the script functions page on the wiki, it may be overwhelming to someone who starts scripting for Amnesia. So lets take it apart.

string& asSoundName - This is the name of the sound. It can be left blank if you're dealing with non-repeatable sounds, so if it was, you could call it "Sound01" and then you would use the remove sound command function to disable it from looping continuously.

string& asSoundFile - This is the name of the sound file located in the "sounds" folder under your "amnesia the dark descent" or "Redist" folder. You will notice that there are ".ogg" and ".snt" extensions. ".snt" extensions are just text files that edit what the ".ogg" file does which include sound volume, fade in, fade out, loop, and some more. There is also one feature that allows multiple sounds get set up for one of them to be played at random. If you want to, you can right click on a ".snt" extension file and open it with a text editor. For this PlaySoundAtEntity command function, you can only fill this sound file slot with one that has the extension of ".snt".

string& asEntity - This is the name of the entity/area from which the sound is played at. If the object is too far away from the player, the sound may not be heard.

float afFadeTime - This is where a number is put into this slot for how long it will take the sounds to fade completely in.

bool abSaveSound - I'm not really sure why this is needed, but it maybe used for when stopping the sound and then playing it again but continuing it from the point it stopped at.

Here's what the example code could look like:

void OnStart()
{
     AddEntityCollideCallback("Player", "ScriptArea_1", "Func01", true, 1);
}
void Func01(string &in asParent, string &in asChild, int alState)
{
     PlaySoundAtEntity("", "scare_steps_big.snt", "SoundPlay", 0, false);
}

It appears this has been long gone forgotten and that I have been really late at posting this. Sad

(This post was last modified: 08-11-2011, 11:44 PM by Kyle.)
08-11-2011, 11:43 PM
Find


Messages In This Thread
RE: An eager newcomer who wants to learn... - by Kyle - 08-11-2011, 11:43 PM



Users browsing this thread: 1 Guest(s)