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
RaideX Offline
Member

Posts: 212
Threads: 33
Joined: May 2013
Reputation: 7
#7
RE: Ambient Music/Sound Fix

(02-06-2014, 09:59 PM)MyRedNeptune Wrote:
(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
         }
      }
   }


Yes it's suppost to be -1, my bad. I've implemented the version you described, works pretty good. I still need to test it out a bit, will get back to it once i'm concerned that it doesnt work anymore Tongue Thanks.

If you don't draw first, you don't get to draw at all... -The False Shepherd
02-07-2014, 01:41 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: 1 Guest(s)