06-15-2015, 05:09 AM
I'm using a script based off of Wapez's Custom Ambient Map Scares script. But one thing about the script that I'm finding is that the random things continue to happen even when you're outside of the area.
I have one area where I want there to be random breath sounds coming from the player but I want it to ONLY happen in that particular area, and stop outside of the area, but then start back up when you enter the area again.
Is there any way I can do that?
Here's the code, which works as it is right now, but it doesn't do exactly what I want it to do.
I have one area where I want there to be random breath sounds coming from the player but I want it to ONLY happen in that particular area, and stop outside of the area, but then start back up when you enter the area again.
Is there any way I can do that?
Here's the code, which works as it is right now, but it doesn't do exactly what I want it to do.
Code:
void OnStart()
{
float RandomBreathSoundsTimerNumber = RandFloat( 2.0f, 15.0f );
AddTimer("bs_soundstimer_first", RandomBreathSoundsTimerNumber, "RandomBreathSounds");
AddEntityCollideCallback("Player", "SlowMoveArea", "ChangeCAMSState", false, 1);
}
void RandomBreathSounds(string &in asTimer)
{
if(GetLocalVarString("CAMS_State") == "SlowMoveArea"){
SetLocalVarInt("BS_AreaNumber", RandInt( 1, 4 ));
AddDebugMessage("Playing sounds in SlowMoveArea", false);
}
int SS_CountNumber = RandInt( 1, 3 );
if( SS_CountNumber == 1 ) PlayGuiSound("react_breath.snt", 1.0f);
if( SS_CountNumber == 2 ) PlayGuiSound("react_sigh.snt", 1.0f);
if( SS_CountNumber == 3 ) PlayGuiSound("react_breath_slow.snt", 1.0f);
AddDebugMessage("Played sound at SlowMoveArea", false);
float RandomBreathSoundsTimerNumber = RandFloat( 2.0f, 15.0f );
AddTimer("bs_soundstimer", RandomBreathSoundsTimerNumber, "RandomBreathSounds");
}