Frictional Games Forum (read-only)
Anyone need 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Anyone need help? (/thread-7825.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22


RE: Anyone need help? - Ge15t - 05-08-2011

Code:
void ScaryFootstepsCallback(string &in asParent, string &in asChild, int alState)
{

    for(int s=2;s<8;s++) AddTimer("step"+s, 2.0 * s, "CreateFootstep");
    
}

void CreateFootstep(string &in asTimer)
{

    PlaySoundAtEntity("scary"+asTimer, "scare_wood_creak_walk.snt", "Area_step_1", 0, false);
    if(asTimer == "Area_step_6")
{
    
    PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false);
    
}

Ok so this script works, BUT the footsteps sound like they are coming from the player or really close by, how can I fix that? also, the PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false); doesnt work either.. any tips? The game loads fine btw


RE: Anyone need help? - RawkBandMan - 05-08-2011

(05-08-2011, 10:59 PM)Kyle Wrote: Inside of the function "Function01", it set the entity, the monster, "Monster" to true, thus spawning it.

So when the player activates the function, by the SetEntityPlayerInteractCallback, it calls the function, doing what ever is inside of it.

Okay thank you very much!


RE: Anyone need help? - Simpanra - 05-08-2011

but thats what i said! xD you just used the actual script while i was using a mock up script =)


RE: Anyone need help? - Dominic0904 - 05-08-2011

(05-08-2011, 10:46 PM)Kyle Wrote: Simpanra, I don't know why you are even trying to help him, you just screwed it all up, no offence. :p

Code:
void OnStart()
{
PreloadSound("react_scare");
AddEntityCollideCallback("Player", "ScriptArea_1", "LoadRoarEvent", true, 1);
}
void LoadRoarEvent(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(10, true);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}

The preloading of the sound will reduce the moment of lag between loading the sound and playing when it is used.

Hey I did what you put there and replaced with my sound and script area names. But when i enter the script area. The sanity damage is given, but the sound is not played. This is how my code looks so far:

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "RoomTwoArea", "CollideRoomTwo", true, 1);
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);

//Here are all the sounds stopped so they can be triggered later
StopSound("Roar_01", 2.0f);
StopSound("Scream_01", 2.0f);
StopSound("WallScratch_01", 2.0f);
StopSound("Piano_01", 2.0f);
StopSound("Reaction_2", 2.0f);
StopSound("Reaction_3", 2.0f);
StopSound("", 2.0f); //used for later
StopSound("", 2.0f);


PreloadSound("Reaction_3");
AddEntityCollideCallback("Player", "ScaryEvent_01", "LoadScaryEvent", true, 1);
}
void LoadScaryEvent(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(10, true);
PlaySoundAtEntity("", "Reaction_3", "Player", 0, false);
}

The reason I got all those StopSound(s) is because I needed to stop the sounds from playing as soon as I load the map up. Since I need them to be triggered later.


RE: Anyone need help? - Kyle - 05-08-2011

Oops. A my bad on my part. It should be:

PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);

The react_scare.snt is an actual file under sounds, and then react. You can try out sounds and see what sounds each one makes by going into the editor and clicking on the sound tab, and click on the "..." and then chose a sound file (.snt) and play it by pressing the play arrow there. Just to let you know. Smile


RE: Anyone need help? - Dominic0904 - 05-08-2011

Oh, so I don't need to place down sound entities? I just need to say where the sound is coming from (this example would be "Player") and then write out the actually file name?


RE: Anyone need help? - Kyle - 05-09-2011

(05-08-2011, 11:59 PM)Dominic0904 Wrote: Oh, so I don't need to place down sound entities? I just need to say where the sound is coming from (this example would be "Player") and then write out the actually file name?

That is correct. It is also best to preload the sound with: PreloadSound(""); with the sound file inside the quotes.
(05-08-2011, 11:06 PM)Ge15t Wrote:
Code:
void ScaryFootstepsCallback(string &in asParent, string &in asChild, int alState)
{

    for(int s=2;s<8;s++) AddTimer("step"+s, 2.0 * s, "CreateFootstep");
    
}

void CreateFootstep(string &in asTimer)
{

    PlaySoundAtEntity("scary"+asTimer, "scare_wood_creak_walk.snt", "Area_step_1", 0, false);
    if(asTimer == "Area_step_6")
{
    
    PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false);
    
}

Ok so this script works, BUT the footsteps sound like they are coming from the player or really close by, how can I fix that? also, the PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false); doesnt work either.. any tips? The game loads fine btw

The "PlaySoundAtEntity" only works with .snt files. In this case, it would be "PlaySoundAtEntity("", "scare_breath.snt", "Player", 0, false);"

I don't know about the footsteps sounding too close to the player. Just try placing them farther away? :p


RE: Anyone need help? - Dominic0904 - 05-09-2011

Thanks dude! I'll post here again if I want to know anything else (First I'll try and figure it out myself though! Wink )


RE: Anyone need help? - Kyle - 05-09-2011

You're welcome, anytime. Big Grin

It's funny how I'm helping people on the forums and scripting my custom story at the same time.


RE: Anyone need help? - Ge15t - 05-09-2011

(05-09-2011, 12:04 AM)Kyle Wrote:
(05-08-2011, 11:59 PM)Dominic0904 Wrote: Oh, so I don't need to place down sound entities? I just need to say where the sound is coming from (this example would be "Player") and then write out the actually file name?

That is correct. It is also best to preload the sound with: PreloadSound(""); with the sound file inside the quotes.
(05-08-2011, 11:06 PM)Ge15t Wrote:
Code:
void ScaryFootstepsCallback(string &in asParent, string &in asChild, int alState)
{

    for(int s=2;s<8;s++) AddTimer("step"+s, 2.0 * s, "CreateFootstep");
    
}

void CreateFootstep(string &in asTimer)
{

    PlaySoundAtEntity("scary"+asTimer, "scare_wood_creak_walk.snt", "Area_step_1", 0, false);
    if(asTimer == "Area_step_6")
{
    
    PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false);
    
}

Ok so this script works, BUT the footsteps sound like they are coming from the player or really close by, how can I fix that? also, the PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false); doesnt work either.. any tips? The game loads fine btw

The "PlaySoundAtEntity" only works with .snt files. In this case, it would be "PlaySoundAtEntity("", "scare_breath.snt", "Player", 0, false);"

I don't know about the footsteps sounding too close to the player. Just try placing them farther away? :p

It still doesnt work after trying that. Footstep noises are good though. Is the script right? Because game loads fine, but ignores the sound file at the end.