Frictional Games Forum (read-only)

Full Version: Amnesia Script and Sound Questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm nearing completion of The Dark Depths story. It will be a short one with two sequels. I've played with sequel possibilities on the forum, but I've finally thought up an official story line, one I hope you will not see coming. I just hope my first story will be scary despite being short.

I do have two questions that I'm not sure on the answer.

Question 1: How do I have a trigger box send you to the next map? Example: You start in Dumb1.map and enter the script box to send you to Dumb2.map.

Question 2: Is it possible to have a monster trigger a script box to play a sound? Example: You're in a wooden house, and a monster far away steps into the trigger, playing a wooden creak sound. As he steps closer to you, he 'plays' more sounds, each one louder because its script area is closer to you.

Now The Dark Depths mostly uses stuff available in Amnesia/Penumbra, but anything outside of the standard stuff I will give credit to the original creator(s). One example is http://www.frictionalgames.com/forum/thr...#pid186525 EntART3t and Hardarm have a cool SciFi interior design that I'm using for my current story and plan on using it in my future stories.

I hope to get an answer to my questions soon, not sure on a release date as my life can keep me busy, but know that The Dark Depths will be available to download soon.
(1) ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
Put this inside the function called by the "AddEntityCollideCallback". And change the names to protect the innocent.




(2) AddEntityCollideCallback("ImADoofus", string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

"ImADoofus" = Name of the monster in the editor, so he will trigger the Areas.
1. Make an area, then add a collide callback that will change the map when the player collides with the area. The script will look like this:

void OnStart()
{
AddEntityCollideCallback("Player", "AreaName", "ChangeMap", true, 1);
}

void ChangeMap(string &in asParent, string &in asChild, int alState)
{
ChangeMap("Dumb2.map", "PlayerStartArea_1", "", "");
}


2. You can make multiple script areas, then the monster will collide with each area as he gets closer and play the sound at the area he collided with. The script will look like this:

void OnStart()
{
for(int i=1, i<=10; i++)
{
AddEntityCollideCallback("monster_name", "CreakArea_"+i, "PlayerCreakSound", true, 1);
}
}

void PlayCreakSound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("creak", "scare_wood_creak_mix.snt", asChild, 0.1f, false);
}

You can call the creak area names CreakArea_1, CreakArea_2, CreakArea_3, etc...
The 10 that I put in bold is the amount of script areas you have for the creaking.

Hope this can help Smile
(12-09-2012, 06:15 AM)NaxEla Wrote: [ -> ]1. Make an area, then add a collide callback that will change the map when the player collides with the area. The script will look like this:

void OnStart()
{
AddEntityCollideCallback("Player", "AreaName", "ChangeMap", true, 1);
}

void ChangeMap(string &in asParent, string &in asChild, int alState)
{
ChangeMap("Dumb2.map", "PlayerStartArea_1", "", "");
}


2. You can make multiple script areas, then the monster will collide with each area as he gets closer and play the sound at the area he collided with. The script will look like this:

void OnStart()
{
for(int i=1, i<=10; i++)
{
AddEntityCollideCallback("monster_name", "CreakArea_"+i, "PlayerCreakSound", true, 1);
}
}

void PlayCreakSound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("creak", "scare_wood_creak_mix.snt", asChild, 0.1f, false);
}

You can call the creak area names CreakArea_1, CreakArea_2, CreakArea_3, etc...
The 10 that I put in bold is the amount of script areas you have for the creaking.

Hope this can help Smile
Both look great and should work. I am currently free and trying to test the Sound Script, but wondering where do I place the coding?