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
Ambient Music/Sound Fix
MyRedNeptune Offline
Senior Member

Posts: 553
Threads: 3
Joined: May 2012
Reputation: 33
#6
RE: Ambient Music/Sound Fix

(02-05-2014, 06:08 PM)RaideX Wrote:
PHP Code: (Select All)
if (alState == 1) {
         
StopSound("Ambience01"1.0f) }
   } 

I'm sure this is supposed to be:

PHP Code: (Select All)
if (alState == -1) {
         
StopSound("Ambience01"1.0f) }
   } 

?


Anyway, if I understood correctly every script area calls the same AmbienceHandler function?

If yes, you can try giving a number value to each area depending on what music it needs to trigger. It'll be assigned to a variable when an area is entered. The sound functions will not be called if the value of the int matches the value assigned to the area. The two areas that play the same ambience will have the same value.

PHP Code: (Select All)
int ambienceType 0;

AddEntityCollideCallback("Player""AmbientScriptAreaBlue1""AmbienceHandler"false0);

void AmbienceHandler (string &in asParentstring &in asChildint alState) {
   if (
asChild == "AmbientScriptAreaBlue1") {
      if (
ambienceType == 1) {
         return;
      }
      else {
         if (
alState == 1) {
            
ambienceType 1;
            
PlaySoundAtEntity("Ambience01""amb_xx_xx.snt""Player"1.0ftrue
         }
         if (
alState == -1) {
            
StopSound("Ambience01"1.0f
         }
      }
   }


^(;,;)^
02-06-2014, 09:59 PM
Find


Messages In This Thread
Ambient Music/Sound Fix - by RaideX - 02-05-2014, 06:08 PM
RE: Ambient Music/Sound Fix - by DreamScripters - 02-06-2014, 05:27 AM
RE: Ambient Music/Sound Fix - by RaideX - 02-06-2014, 07:38 AM
RE: Ambient Music/Sound Fix - by Daemian - 02-06-2014, 08:16 PM
RE: Ambient Music/Sound Fix - by RaideX - 02-06-2014, 09:45 PM
RE: Ambient Music/Sound Fix - by MyRedNeptune - 02-06-2014, 09:59 PM
RE: Ambient Music/Sound Fix - by RaideX - 02-07-2014, 01:41 PM



Users browsing this thread: 2 Guest(s)