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
Activate Sound entity
anzki Offline
Member

Posts: 88
Threads: 6
Joined: Apr 2010
Reputation: 1
#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 :S

[Image: 2qnr5av.png]
10-18-2010, 12:11 PM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#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
Website Find
anzki Offline
Member

Posts: 88
Threads: 6
Joined: Apr 2010
Reputation: 1
#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
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#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
Website Find
anzki Offline
Member

Posts: 88
Threads: 6
Joined: Apr 2010
Reputation: 1
#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




Users browsing this thread: 2 Guest(s)