05-08-2011, 07:52 PM
Ok, now the title is slightly misleading, i don't ened help stopping a sound from looping as in just playing again and again (i know that is down to changing it from "1" to "0" or something, i am actually asking about something slightly different,
Please read the below mock up script; (Bear in mind it is a mock up and so this script is missing a few components that i deemed unnecessary for my example.
}
AddEntityCollideCallback("Player", "StartSoundsArea", "PlaySounds")
}
void PlaySounds(Parent, Child, State)
{
PlaySoundAtEntity("EnemyGrunting", "Player");
AddTimer( 1.5f, "PlaySounds2");
}
void PlaySounds2( Timer)
{
PlaySoundAtEntity("EnemyGrowling", "Player");
AddTimer( 1.5f, "PlaySounds3");
}
voidPlaySounds3( Timer)
{
PlaySoundAtEntity("EnemyGrunting", "Player");
AddTimer( 1.5f, "PlaySounds2");
}
Ok, so above we now have a timer that starts when i enter the area, and it plays two different sounds, one after the other, with a 1.5 second gap between each, however, I want the player to get walk across the room, being scared of these sounds, but as he reaches the far side of the room, i want them to stop, so it feels like the creature has noticed him and gone quiet. However, due to the way i am making the two sounds play one after another in a timer loop, i am not sure what function to use to cut the sounds out.
I know i will need to add another AddEntityCollideCallback at the far side of the room which will call some sort of function to break the loop of sounds, however i am not sure what function to use,
Please can somebody help me =)
Thank you =)
Edd,
Please read the below mock up script; (Bear in mind it is a mock up and so this script is missing a few components that i deemed unnecessary for my example.
}
AddEntityCollideCallback("Player", "StartSoundsArea", "PlaySounds")
}
void PlaySounds(Parent, Child, State)
{
PlaySoundAtEntity("EnemyGrunting", "Player");
AddTimer( 1.5f, "PlaySounds2");
}
void PlaySounds2( Timer)
{
PlaySoundAtEntity("EnemyGrowling", "Player");
AddTimer( 1.5f, "PlaySounds3");
}
voidPlaySounds3( Timer)
{
PlaySoundAtEntity("EnemyGrunting", "Player");
AddTimer( 1.5f, "PlaySounds2");
}
Ok, so above we now have a timer that starts when i enter the area, and it plays two different sounds, one after the other, with a 1.5 second gap between each, however, I want the player to get walk across the room, being scared of these sounds, but as he reaches the far side of the room, i want them to stop, so it feels like the creature has noticed him and gone quiet. However, due to the way i am making the two sounds play one after another in a timer loop, i am not sure what function to use to cut the sounds out.
I know i will need to add another AddEntityCollideCallback at the far side of the room which will call some sort of function to break the loop of sounds, however i am not sure what function to use,
Please can somebody help me =)
Thank you =)
Edd,