//==============================================================================================================
// TriggerAmbientSound
// This class allows you to make your AmbientSound "triggerable" using the normal trigger method
// Created by Mitchell "[~]RUFX[~]RoninMastaFX" LeBlanc with the help of BlackCheetah
// Code is based from TriggerWaterZone, created by Scott 'Slasher IV' Kircher, couldn't have done it without him
//==============================================================================================================
class TriggerAmbientSound extends AmbientSound;
var(TriggerSound) sound TRAmbientSound; //Import your triggered sound here
var(TriggerSound) bool PowerStatus; //Status of the switch: True=On while False=Off
var(TriggerSound) byte TRSoundPitch,TRSoundVolume,TRSoundRadius; //The main batch of new sound properties
var(TriggerSound) float TRTransientSoundVolume; //Transient sound volume property
var(TriggerSound) float TRTransientSoundRadius; //Transient sound radius property
//
// NOTE: The TriggerAmbientSound uses a totally new sound system...however, the old AmbientSound properties
// are still included, just in case. However, for triggered sounds, use the TriggerAmbientSound menu
//
function PostBeginPlay()
{
Super.PostBeginPlay();
if(!PowerStatus) //What the trigger will turn off if false, or on if true
{
SoundRadius=64;
SoundVolume=190;
}
}
function Trigger( actor Other, pawn EventInstigator ) //Trigger properties - adds trigger code to make it switch on/off
{
local Actor A;
local Pawn P;
local Decoration D;
local TriggerAmbientSound oldself;
oldself=self;
//
// If the TriggerAmbientSound is set to OFF at the start, the trigger can turn it on, and back to off, and back and forth
// If the TriggerAmbientSound is set to ON at the start, the trigger will turn it off, and back to on, and back and forth
//
if(PowerStatus) //Setting the rules for the triggering
{
PowerStatus=false; //TriggerAmbientSound is switched off
SoundRadius=0;
SoundVolume=0;
AmbientSound=none;
}
else
{
PowerStatus=true; //TriggerAmbientSound is switched on
TransientSoundRadius=TRTransientSoundRadius; //Transient radius property
TransientSoundVolume=TRTransientSoundVolume; //Transient volume property
SoundPitch=TRSoundPitch; //Pitch property
SoundRadius=TRSoundRadius; //Radius property
SoundVolume=TRSoundVolume; //Volume property
AmbientSound=TRAmbientSound; //Sound import property
}
}
defaultproperties
{
TRSoundRadius=64
TRSoundVolume=190
TRSoundPitch=64
TRTransientSoundVolume=1.00
}