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
Script Help How to play sound and area?
MaksoPL Offline
Member

Posts: 51
Threads: 26
Joined: Mar 2014
Reputation: 0
#1
How to play sound and area?

I want to play sound, when player goes to area. How I can do that?
01-15-2015, 11:32 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: How to play sound and area?

Where do you want to play this sound? Is it ambient or on the player? If it's a sound on the player, like a gasp or reaction, you usually play it on the player using PlayGuiSound. Otherwise, if the sound has a source in the level, use PlaySoundAtEntity. Use either one along with a collision callback to trigger it when the player enters an area.

PHP Code: (Select All)
AddEntityCollideCallback("Player""AreaName""FuncName"true1);
PlaySoundAtEntity("SoundName""SoundFile.snt""EntityName"0false); 

(This post was last modified: 01-15-2015, 10:01 PM by Mudbill.)
01-15-2015, 11:51 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#3
RE: How to play sound and area?

PlaySoundAtEntity("12_girl_scream", "12_girl_scream.snt", "GirlScream01", 1.0f, true);
Why not just as above...
Entity is also an area...
THink it could become a bit confucing for starters Mud, don't you think?
I think its best to keep starters on the PlaySoundAtEntity function.. Always works!
01-15-2015, 02:31 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: How to play sound and area?

My bad, I typo'ed Area instead of Entity. Slipped my mind. The correct function is called PlaySoundAtEntity, not PlaySoundAtArea, but it works just like I explained above.

Edited my post.

(This post was last modified: 01-15-2015, 10:01 PM by Mudbill.)
01-15-2015, 10:00 PM
Find




Users browsing this thread: 2 Guest(s)