The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
How to make things happen only in a certain area
MrWallas Offline
Junior Member

Posts: 2
Threads: 1
Joined: Jun 2015
Reputation: 0
#1
How to make things happen only in a certain area

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.
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");
    
}
(This post was last modified: 06-15-2015, 05:10 AM by MrWallas.)
06-15-2015, 05:09 AM
Find


Messages In This Thread
How to make things happen only in a certain area - by MrWallas - 06-15-2015, 05:09 AM



Users browsing this thread: 2 Guest(s)