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
Sounds and messages
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#1
Sounds and messages

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
11-27-2012, 06:02 PM
Find
GoranGaming Offline
Member

Posts: 183
Threads: 30
Joined: Feb 2012
Reputation: 7
#2
RE: Sounds and messages

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

}

Current projects:

The Dark Prison 85 % (Stopped working on this one)

Unnamed Project 7 %
(This post was last modified: 11-27-2012, 06:19 PM by GoranGaming.)
11-27-2012, 06:10 PM
Website Find
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#3
RE: Sounds and messages

What I must put in "Category" and "Entry"? Smile
11-27-2012, 06:17 PM
Find
GoranGaming Offline
Member

Posts: 183
Threads: 30
Joined: Feb 2012
Reputation: 7
#4
RE: Sounds and messages

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>

Current projects:

The Dark Prison 85 % (Stopped working on this one)

Unnamed Project 7 %
11-27-2012, 06:21 PM
Website Find
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#5
RE: Sounds and messages

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);
}
11-27-2012, 07:19 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: Sounds and messages

You have to edit the .snt file.
There must be an attribute saying: Loop: true
You need to change it to false

Trying is the first step to success.
11-27-2012, 07:20 PM
Find
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#7
RE: Sounds and messages

Thanks You for help, now everything is working Big Grin
11-27-2012, 07:28 PM
Find




Users browsing this thread: 1 Guest(s)