Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help PlaySoundAtEntity is not working
Author Message
Odin0181 Offline
Junior Member

Posts: 4
Joined: Oct 2011
Reputation: 0
Post: #1
PlaySoundAtEntity is not working
Hello I have just started making my own custom story, and i have a problem with scripting.
I just want to make so that a sound plays on a entity (player in this case) when i pick up a key, but nothing happens!
Here is the code:


void OnStart()
{
SetEntityCallbackFunc("key_study_1", "Break");
}

void Break(string &in asEntity, string &in type)
{
SetPropHealth("barrel01_2", 0.0f);
SetPropHealth("barrel01_3", 0.0f);
SetPropHealth("barrel01_4", 0.0f);
SetPropHealth("barrel01_1", 0.0f);
StartPlayerLookAt("human_skull_1", 5, 5, "Break2");
PlaySoundAtEntity("", "react_scare.snt", "Player", 2, false);
}


Thanks for your help Smile
10-19-2011 05:13 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 868
Joined: Aug 2011
Reputation: 26
Post: #2
RE: PlaySoundAtEntity is not working
Nothing happens at all? That means your key name might be something different or maybe your hps isn't even loaded.

Make sure to make sure key name is EXACTLY same.

The Interrogation
Chapter 1

My tutorials
10-19-2011 08:20 PM
Find all posts by this user Quote this message in a reply
Odin0181 Offline
Junior Member

Posts: 4
Joined: Oct 2011
Reputation: 0
Post: #3
RE: PlaySoundAtEntity is not working
No, I mean, all the other events happen, only the Sound event doesn't. =(
10-19-2011 08:24 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 868
Joined: Aug 2011
Reputation: 26
Post: #4
RE: PlaySoundAtEntity is not working
Try without .snt, even tho it shouldn't affect it at all :/

I gonna try it quickly in my story, if it works

EDIT: Okay, soundentity worked for me. Make sure your volume and everything is working, if others scripts work.

The Interrogation
Chapter 1

My tutorials
(This post was last modified: 10-19-2011 08:34 PM by Elven.)
10-19-2011 08:32 PM
Find all posts by this user Quote this message in a reply
Odin0181 Offline
Junior Member

Posts: 4
Joined: Oct 2011
Reputation: 0
Post: #5
RE: PlaySoundAtEntity is not working
ok thanks...i will try

EDIT: No it's not working for me anyway, but i noticed that all the other sound events happen and only the sound events related to the player doesn't...maybe the game doesn't find the files?
(This post was last modified: 10-19-2011 08:45 PM by Odin0181.)
10-19-2011 08:33 PM
Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,233
Joined: Jul 2011
Reputation: 215
Post: #6
RE: PlaySoundAtEntity is not working
Maybe the fade time is longer than the sound itself. Try changing it to 0 instead of 2.

Tutorials: From Noob to Pro
10-19-2011 08:49 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 868
Joined: Aug 2011
Reputation: 26
Post: #7
RE: PlaySoundAtEntity is not working
I am surprised that I didn't notice that Tongue. Good point!

The Interrogation
Chapter 1

My tutorials
10-19-2011 09:10 PM
Find all posts by this user Quote this message in a reply
Odin0181 Offline
Junior Member

Posts: 4
Joined: Oct 2011
Reputation: 0
Post: #8
RE: PlaySoundAtEntity is not working
(10-19-2011 08:49 PM)Your Computer Wrote:  Maybe the fade time is longer than the sound itself. Try changing it to 0 instead of 2.
Thank you so much, it worked =)
10-19-2011 09:14 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 868
Joined: Aug 2011
Reputation: 26
Post: #9
RE: PlaySoundAtEntity is not working
Aww, In the end Your Computer gets all reputation xD

The Interrogation
Chapter 1

My tutorials
10-19-2011 09:27 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)