Frictional Games Forum (read-only)
Activate Sound entity - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Activate Sound entity (/thread-5097.html)



Activate Sound entity - anzki - 10-18-2010

Here is code considering sounds:
Code:
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:
Code:
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


RE: Activate Sound entity - jens - 10-18-2010

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.


RE: Activate Sound entity - anzki - 10-18-2010

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...


RE: Activate Sound entity - jens - 10-18-2010

Could be a staticprop, which is a limited form of entity that is more like a static object than an entity.


RE: Activate Sound entity - anzki - 10-19-2010

(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.