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


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Activate Sound entity
Author Message
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #1
Activate Sound entity

Here is code considering sounds:
void CollidePianoArea(string &in asParent, string &in asChild, int alState)
{
  SetEntityActive("SoundPiano", true);
  AddTimer("", 45.0f, "EndPiano");
}

void EndPiano(string &in asTimer)
{
  SetEntityActive("SoundPiano", false);
}
And this is in void OnStart:
AddEntityCollideCallback("Player", "PianoArea", "CollidePianoArea", true, 1);

However it does not trigger when it should but instead it plays the sound right in the beginning. Also I have other similiar sound and it does the same.

Plus I have simple shelf that is set to inactive,(as all those sounds) but yet it is active right in the start of the map...

Edit: But few other entities are inactive as they should Confused

[Image: 2qnr5av.png]
10-18-2010 12:11 PM
Find all posts by this user Quote this message in a reply
jens Offline
Frictional Games

Posts: 4,095
Joined: Apr 2006
Reputation: 202
Post: #2
RE: Activate Sound entity

You should only place sound entities with the level editor that loops and should be played all the time or until you want to stop them with StopSound.

You use PlaySoundAtEntity to play sounds when you like them to play. So remove SetEntityActive("SoundPiano", true); and do a PlaySoundAtEntity in its place.
10-18-2010 12:55 PM
Visit this user's website Find all posts by this user Quote this message in a reply
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #3
RE: Activate Sound entity

Thank's Jens, but that does not explain why my shelf is active even though it is set inactive. There is not even any script considering that...

[Image: 2qnr5av.png]
10-18-2010 01:25 PM
Find all posts by this user Quote this message in a reply
jens Offline
Frictional Games

Posts: 4,095
Joined: Apr 2006
Reputation: 202
Post: #4
RE: Activate Sound entity

Could be a staticprop, which is a limited form of entity that is more like a static object than an entity.
10-18-2010 01:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #5
RE: Activate Sound entity

(10-18-2010 01:47 PM)jens Wrote:  Could be a staticprop, which is a limited form of entity that is more like a static object than an entity.

Yeah, got it working with another entity.

[Image: 2qnr5av.png]
10-19-2010 10:49 AM
Find all posts by this user Quote this message in a reply
Post Reply 




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