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
I can never get sounds to work correctly! help me!
tyranius Offline
Junior Member

Posts: 23
Threads: 6
Joined: May 2011
Reputation: 0
#1
I can never get sounds to work correctly! help me!

After a certain event happens I want to play a sound but it's not working at all. If I create a sound in the level editor it will play straight away even if I set it to not active, so I tried another approach and it's not working as well.

void OnStart()
{
SetEntityCallbackFunc("display_1", "MonsterAppear");
AddEntityCollideCallback("servant_grunt_1", "MonsterDisa", "MonsterGone", true, 1);
}

void MonsterAppear(string &in entity, string &in type)
{
GiveSanityDamage(30, true);
PlaySoundAtEntity("Sound_2", "react_scare4.ogg", "Player", 0.1f, false);
SetLightVisible("SpotLight_1", false);
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 2, "");
AddTimer("Timer1", 60, "MonsterGone");
}

void MonsterGone(string &in asTimer)
{
FadeEnemyToSmoke("servant_grunt_1", false);
}

Please help!
05-12-2011, 07:52 PM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#2
RE: I can never get sounds to work correctly! help me!

Replace: PlaySoundAtEntity("Sound_2", "react_scare4.ogg", "Player", 0.1f, false);
With: PlayGuiSound("react_scare.snt", 1.0);

[Image: mZiYnxe.png]


05-12-2011, 07:55 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#3
RE: I can never get sounds to work correctly! help me!

(05-12-2011, 07:55 PM)Acies Wrote: Replace: PlaySoundAtEntity("Sound_2", "react_scare4.ogg", "Player", 0.1f, false);
With: PlayGuiSound("react_scare.snt", 1.0);

PlayGuiSound can only play .ogg files, no? I might be mistaken.
05-12-2011, 07:56 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#4
RE: I can never get sounds to work correctly! help me!

If you create a sound into the level editor, it works the same way as lights. Meaning you have to use:
StopSound(string& asSoundName, float afFadeTime);
at OnStart to mute the sound. Then to start it use:
FadeInSound(string& asSoundName, float afFadeTime, bool abPlayStart);
05-12-2011, 08:02 PM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#5
RE: I can never get sounds to work correctly! help me!

PlayGuiSound can play .snt files too Smile
I actually believe that the react_scare is a meant to be a gui sound and.. erm, a sound played as part of the player interface - such as the fall sounds, breathing, reactions etc.

[Image: mZiYnxe.png]


05-12-2011, 08:11 PM
Find
tyranius Offline
Junior Member

Posts: 23
Threads: 6
Joined: May 2011
Reputation: 0
#6
RE: I can never get sounds to work correctly! help me!

Using PlayGuiSound worked thanks!
05-12-2011, 09:11 PM
Find




Users browsing this thread: 1 Guest(s)