Frictional Games Forum (read-only)

Full Version: Sounds and messages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've got a script:

void Scared_9(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("DeadFour_9", true);
SetEntityActive("DeadFour_10", true);
GiveSanityDamage(99, true);
PlaySoundAtEntity("", "24_iron_maiden.snt", "Scary_9", 0, false);
}

After activation this script, I would like to:
1) The player saw the message on the screen (for example, "RUN!")
2) Two seconds after activation of the script there was a sound (different than in script above)
How to do it? Smile

I'm sorry if somewhere there is a spelling mistake, charms of use google translator xD
Jumpscares...

I'll help you anyway:

void Scared_9(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("DeadFour_9", true);
SetEntityActive("DeadFour_10", true);
GiveSanityDamage(99, true);
PlaySoundAtEntity("", "24_iron_maiden.snt", "Scary_9", 0, false);

AddTimer("", 0, "Scared_9Timer");
AddTimer("", 2, "Scared_9SoundAfter");
}


void Scared_9Timer(string &in asTimer)
{
SetMessage("Category", "Entry", 5);
}

void Scared_9SoundAfter(string &in asTimer)
{
PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);



Creates a sound on an entity.



asSoundName - internal name
asSoundFile - the sound to use + extension .snt
asEntity - the entity to create the sound at, can be “Player”
afFadeTime - time in seconds the sound needs to fade. Avoids enemies hearing the sound if afFadeTime is at least 0.1f
abSaveSound - if true, a looping sound will “remember” its playback state (currently playing/stopped), and that state will be restored the next time the level is entered. If true, the sound is never attached to the entity! Note that saving should only be used on looping sounds!


OR



PlayGuiSound(string& asSoundFile, float afVolume);


Plays a sound, not using 3D.
asSoundFile - the sound to play (extension is .snt)
afVolume - the volume of the sound

}
What I must put in "Category" and "Entry"? Smile
In your lang file, you should have a category and an entry.


<CATEGORY Name="CATEGORY_NAME_IT_WHATEVER_YOU_WANT">
<Entry Name="ENTRY_NAME_IT_WHATEVER_YOU_WANT">RUN!</Entry>
</CATEGORY>
Thank You, it's working Smile I have another question about sounds: I make custom sound file: duration is 1-2 sec, but game still repeats this sound, and I want to play it once. What should I do? This is script ("girl_laugh.snt" is my custom sound):

void Scared_9SoundAfter(string &in asTimer)
{
PlaySoundAtEntity("", "girl_laugh.snt", "Scary_8", 0, false);
}
You have to edit the .snt file.
There must be an attribute saying: Loop: true
You need to change it to false
Thanks You for help, now everything is working Big Grin