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 PlaySoundAtEntity is not working
Odin0181 Offline
Junior Member

Posts: 4
Threads: 1
Joined: Oct 2011
Reputation: 0
#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 Reply
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#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 Reply
Odin0181 Offline
Junior Member

Posts: 4
Threads: 1
Joined: Oct 2011
Reputation: 0
#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 Reply
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#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 Reply
Odin0181 Offline
Junior Member

Posts: 4
Threads: 1
Joined: Oct 2011
Reputation: 0
#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 Reply
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#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
Website Find Reply
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#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 Reply
Odin0181 Offline
Junior Member

Posts: 4
Threads: 1
Joined: Oct 2011
Reputation: 0
#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 Reply
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#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 Reply




Users browsing this thread: 1 Guest(s)