///////////////////////////////////////////////////////// ///// - CUSTOM AMBIENT MAP SCARES - ///// ///// - CREATED BY WAPEZ - ///// ////////// - STARTS HERE - ////////// void RandomWindSound(string &in asTimer) { //-----------------------------------||-----------------------------------// // Plays a random WIND sound on one of the specified areas. // Timer is originally set between float values 5.0 and 20.0 seconds. // Timer: AmbientWindSoundsTimer //-----------------------------------||-----------------------------------// if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_1"){ //FINDS OUT WHICH PART OF THE MAP THE PLAYER IS LOCATED IN SetLocalVarInt("WS_AreaNumber", RandInt( 1, 7 )); //DEPENDING ON WHERE THE PLAYER IS, PLAY SOUNDS ON DIFFERENT AREAS AddDebugMessage("Playing sounds in CAMS_1", false); //ADD DEBUG MESSAGE FOR TESTING PURPOSES } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_2"){ //FINDS OUT WHICH PART OF THE MAP THE PLAYER IS LOCATED IN SetLocalVarInt("WS_AreaNumber", RandInt( 8, 13 )); //DEPENDING ON WHERE THE PLAYER IS, PLAY SOUNDS ON DIFFERENT AREAS AddDebugMessage("Playing sounds in CAMS_2", false); //ADD DEBUG MESSAGE FOR TESTING PURPOSES } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_3"){ //FINDS OUT WHICH PART OF THE MAP THE PLAYER IS LOCATED IN SetLocalVarInt("WS_AreaNumber", RandInt( 14, 19 )); //DEPENDING ON WHERE THE PLAYER IS, PLAY SOUNDS ON DIFFERENT AREAS AddDebugMessage("Playing sounds in CAMS_3", false); //ADD DEBUG MESSAGE FOR TESTING PURPOSES } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_4"){ //FINDS OUT WHICH PART OF THE MAP THE PLAYER IS LOCATED IN SetLocalVarInt("WS_AreaNumber", RandInt( 20, 27 )); //DEPENDING ON WHERE THE PLAYER IS, PLAY SOUNDS ON DIFFERENT AREAS AddDebugMessage("Playing sounds in CAMS_4", false); //ADD DEBUG MESSAGE FOR TESTING PURPOSES } int WS_CountNumber = RandInt( 1, 2 ); if( WS_CountNumber == 1 ) PlaySoundAtEntity( "", "general_wind_blow.snt", "WindSoundArea_" + GetLocalVarInt("WS_AreaNumber"), 0, false); // PLAYS SOUND if( WS_CountNumber == 2 ) PlaySoundAtEntity( "", "general_wind_whirl.snt", "WindSoundArea_" + GetLocalVarInt("WS_AreaNumber"), 0, false); // PLAYS SOUND AddDebugMessage("Played sound at WindSoundArea_" + GetLocalVarInt("WS_AreaNumber"), false); float AmbientWindSoundsTimerNumber = RandFloat( 10.0f, 25.0f ); //CALCULATES NEW TIMER VALUE AddTimer("aw_soundstimer", AmbientWindSoundsTimerNumber, "RandomWindSound"); //ACTIVATES NEW TIMER } void RandomStepsSound(string &in asTimer) { //-----------------------------------||-----------------------------------// // Plays a random STEPS sound on one of the specified areas. // Timer is originally set between float values 10.0 and 25.0 seconds. // Timer: AmbientStepsSoundsTimer //-----------------------------------||-----------------------------------// if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_1"){ SetLocalVarInt("SS_AreaNumber", RandInt( 1, 12 )); AddDebugMessage("Playing sounds in CAMS_1", false); } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_2"){ SetLocalVarInt("SS_AreaNumber", RandInt( 13, 20 )); AddDebugMessage("Playing sounds in CAMS_2", false); } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_3"){ SetLocalVarInt("SS_AreaNumber", RandInt( 21, 31 )); } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_4"){ SetLocalVarInt("SS_AreaNumber", RandInt( 32, 44 )); } int SS_CountNumber = RandInt( 1, 3 ); if( SS_CountNumber == 1 ) PlaySoundAtEntity( "", "step_run_rock_rev.snt", "StepsSoundArea_" + GetLocalVarInt("SS_AreaNumber"), 0, false); if( SS_CountNumber == 2 ) PlaySoundAtEntity( "", "step_sneak_rock_rev.snt", "StepsSoundArea_" + GetLocalVarInt("SS_AreaNumber"), 0, false); if( SS_CountNumber == 3 ) PlaySoundAtEntity( "", "step_walk_rock_rev.snt", "StepsSoundArea_" + GetLocalVarInt("SS_AreaNumber"), 0, false); AddDebugMessage("Played sound at StepsSoundArea_" + GetLocalVarInt("SS_AreaNumber"), false); float AmbientStepsSoundsTimerNumber = RandFloat( 10.0f, 25.0f ); AddTimer("as_soundstimer", AmbientStepsSoundsTimerNumber, "RandomStepsSound"); } void RandomScrapeSound(string &in asTimer) { //-----------------------------------||-----------------------------------// // Plays a random SCRAPE sound on one of the specified areas. // Timer is originally set between float values 3.0 and 15.0 seconds. // Timer: AmbientStepsSoundsTimer //-----------------------------------||-----------------------------------// if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_1"){ SetLocalVarInt("ScS_AreaNumber", RandInt( 1, 10 )); AddDebugMessage("Playing sounds in CAMS_1", false); } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_2"){ SetLocalVarInt("ScS_AreaNumber", RandInt( 11, 20 )); AddDebugMessage("Playing sounds in CAMS_2", false); } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_3"){ SetLocalVarInt("ScS_AreaNumber", RandInt( 21, 33 )); } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_4"){ SetLocalVarInt("ScS_AreaNumber", RandInt( 34, 45 )); } PlaySoundAtEntity("scrape_sound" + GetLocalVarInt("ScS_AreaNumber"), "scare_wall_crawl_single.snt", "ScrapeSoundArea_" + GetLocalVarInt("ScS_AreaNumber"), 0.0f, false); AddDebugMessage("Played sound at ScrapeSoundArea_" + GetLocalVarInt("ScS_AreaNumber"), false); float AmbientScrapeSoundsTimerNumber = RandFloat( 3.0f, 15.0f ); AddTimer("as_soundstimer", AmbientScrapeSoundsTimerNumber, "RandomScrapeSound"); } void RandomVoiceSound(string &in asTimer) { //-----------------------------------||-----------------------------------// // Plays a random VOICE sound on one of the specified areas. // Timer is originally set between float values 30.0 and 120.0 seconds. // Timer: AmbientVoiceSoundsTimer //-----------------------------------||-----------------------------------// /* ACTIVATE FOR PLAYING SOUNDS AT RANDOM AREAS INSTEAD OF AT THE PLAYER if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_1"){ SetLocalVarInt("VS_AreaNumber", RandInt( 1, 7 )); AddDebugMessage("Playing sounds in CAMS_1", false); } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_2"){ SetLocalVarInt("VS_AreaNumber", RandInt( 8, 13 )); AddDebugMessage("Playing sounds in CAMS_2", false); } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_3"){ SetLocalVarInt("VS_AreaNumber", RandInt( 14, 19 )); } if(GetLocalVarString("CAMS_State") == "CustomAmbientMapScares_4"){ SetLocalVarInt("VS_AreaNumber", RandInt( 20, 27 )); } */ int VS_CountNumber = RandInt( 1, 2 ); if( VS_CountNumber == 1 ) PlaySoundAtEntity( "", "insanity_whisper.snt", "Player", 0, false); if( VS_CountNumber == 2 ) PlaySoundAtEntity( "", "scare_baby_cry.snt", "Player", 0, false); AddDebugMessage("Played voice sound at Player", false); float AmbientVoiceSoundsTimerNumber = RandFloat( 30.0f, 120.0f ); //CALCULATE NEW TIMER VALUE AddTimer("av_soundstimer", AmbientVoiceSoundsTimerNumber, "RandomVoiceSound"); //ACTIVATE NEW TIMER } void RandomObjectPushFunction(string &in asTimer) { //-----------------------------------||-----------------------------------// // Adds a pushing force to one of the specified entities by a random amount. // Uses categories to select which kind of entity to be pushed. // The chance of every category to trigger is different. // Strength of push is randomized within the assigned values. // Timer is originally set between float values 30.0 and 60.0 seconds. // Timer: AmbientObjectFallFunctionTimer //-----------------------------------||-----------------------------------// int OP_CategoryNumber = RandInt( 1, 100 ); // GENERATES A RANDOM NUMBER BETWEEN 1 AND 100. if( OP_CategoryNumber <= 40 ) // THE NUMBER REPRESENTS THE PERCENTAGE CHANCE OF THIS CATEGORY BEING TRIGGERED. ONLY USES ONE VALUE SINCE IT'S THE FIRST CATEGORY. { //-----------------------------------||-----------------------------------// // Book category. // Mainly used for pushing down books from shelves. // Default chance on trigger: 40% // Default pushing values: 75 - 150 //-----------------------------------||-----------------------------------// int Book_CategoryNumber = RandInt( 1, 4 ); // DECIDES WHICH DIRECTION-CATEGORY TO CHOOSE int PushAmount = RandInt( 75, 150 ); // DECIDES THE STRENGTH OF THE PUSH ///// - PUSH X DIRECTION - ///// if( Book_CategoryNumber == 1){ int Book_Number = RandInt( 1, 3 ); // FIRST VALUE ALWAYS 1, SECOND VALUE IS AMOUNT OF BOOKS AddPropForce("push_book_x_" + Book_Number, PushAmount, 0, 0, "world"); // PUSHES THE BOOK } ///// - PUSH Z DIRECTION - ///// if( Book_CategoryNumber == 2){ int Book_Number = RandInt( 1, 3 ); // FIRST VALUE ALWAYS 1, SECOND VALUE IS AMOUNT OF BOOKS AddPropForce("push_book_z_" + Book_Number, 0, 0, -PushAmount, "world"); // PUSHES THE BOOK } ///// - PUSH NEGATIVE X DIRECTION - ///// if( Book_CategoryNumber == 3){ int Book_Number = RandInt( 1, 4 ); // FIRST VALUE ALWAYS 1, SECOND VALUE IS AMOUNT OF BOOKS AddPropForce("push_book_-x_" + Book_Number, -PushAmount, 0, 0, "world"); // PUSHES THE BOOK } ///// - PUSH NEGATIVE Z DIRECTION - ///// if( Book_CategoryNumber == 4){ int Book_Number = RandInt( 1, 3 ); // FIRST VALUE ALWAYS 1, SECOND VALUE IS AMOUNT OF BOOKS AddPropForce("push_book_-z_" + Book_Number, 0, 0, PushAmount, "world"); // PUSHES THE BOOK } } if( OP_CategoryNumber > 40 && OP_CategoryNumber <= 60 ) // DECIDES TRIGGER CHANCE. (SECOND VALUE) - (FIRST VALUE) = PERCENTAGE CHANCE OF CATEGORY BEING TRIGGERED. { //-----------------------------------||-----------------------------------// // Container category. // Mainly used to push containers over ledges. // Default chance on trigger: 20% // Default pushing values: 400 - 500 //-----------------------------------||-----------------------------------// int Container_CategoryNumber = RandInt( 1, 4 ); int PushAmount = RandInt( 400, 500 ); ///// - PUSH X DIRECTION - ///// if( Container_CategoryNumber == 1){ int Container_Number = RandInt( 1, 1 ); //ONLY USE ONE CONTAINER AddPropForce("push_container_x_" + Container_Number, PushAmount, 0, 0, "world"); } ///// - PUSH Z DIRECTION - ///// if( Container_CategoryNumber == 2){ int Container_Number = RandInt( 1, 3 ); AddPropForce("push_container_z_" + Container_Number, 0, 0, PushAmount, "world"); } ///// - PUSH NEGATIVE X DIRECTION - ///// if( Container_CategoryNumber == 3){ int Container_Number = RandInt( 1, 3 ); AddPropForce("push_container_-x_" + Container_Number, -PushAmount, 0, 0, "world"); } ///// - PUSH NEGATIVE Z DIRECTION - ///// if( Container_CategoryNumber == 4){ int Container_Number = RandInt( 1, 3 ); AddPropForce("push_container_-z_" + Container_Number, 0, 0, -PushAmount, "world"); } } if( OP_CategoryNumber > 60 && OP_CategoryNumber <= 80 ) { //-----------------------------------||-----------------------------------// // Bottle category. // Mainly used for pushing bottles, glasses and goblets off of tables. // Default chance on trigger: 20% // Default pushing values: 75 - 150 //-----------------------------------||-----------------------------------// int Bottle_CategoryNumber = RandInt( 1, 4 ); int PushAmount = RandInt( 75, 150 ); ///// - PUSH X DIRECTION - ///// if( Bottle_CategoryNumber == 1){ int Bottle_Number = RandInt( 1, 5 ); AddPropForce("push_bottle_x_" + Bottle_Number, PushAmount, 0, 0, "world"); } ///// - PUSH Z DIRECTION - ///// if( Bottle_CategoryNumber == 2){ int Bottle_Number = RandInt( 1, 3 ); AddPropForce("push_bottle_z_" + Bottle_Number, 0, 0, PushAmount, "world"); } ///// - PUSH NEGATIVE X DIRECTION - ///// if( Bottle_CategoryNumber == 3){ int Bottle_Number = RandInt( 1, 3 ); AddPropForce("push_bottle_-x_" + Bottle_Number, -PushAmount, 0, 0, "world"); } ///// - PUSH NEGATIVE Z DIRECTION - ///// if( Bottle_CategoryNumber == 4){ int Bottle_Number = RandInt( 1, 3 ); AddPropForce("push_bottle_-z_" + Bottle_Number, 0, 0, -PushAmount, "world"); } } if( OP_CategoryNumber > 80 && OP_CategoryNumber <= 90 ) { //-----------------------------------||-----------------------------------// // Lamp category. // Mainly used to give chandeliers a light push. // Chance on trigger: 10% // Default pushing values: (-500) - 500 //-----------------------------------||-----------------------------------// int PushAmount = RandInt( -500 , 500 ); int Lamp_Number = RandInt( 1, 4 ); AddPropForce("push_lamp_" + Lamp_Number, PushAmount, 0, PushAmount, "world"); } if( OP_CategoryNumber > 90 && OP_CategoryNumber <= 100 ) { //-----------------------------------||-----------------------------------// // "Other" category. // Remaining entities may be placed in this category. // Chance on trigger: 10% // Default pushing values: 200 - 300 //-----------------------------------||-----------------------------------// int Other_CategoryNumber = RandInt( 1, 4 ); int PushAmount = RandInt( 200, 300 ); ///// - PUSH X DIRECTION - ///// if( Other_CategoryNumber == 1){ int Other_Number = RandInt( 1, 2 ); AddPropForce("push_other_x_" + Other_Number, PushAmount, 0, 0, "world"); } ///// - PUSH Z DIRECTION - ///// if( Other_CategoryNumber == 2){ int Other_Number = RandInt( 1, 3 ); AddPropForce("push_other_z_" + Other_Number, 0, 0, PushAmount, "world"); } ///// - PUSH X DIRECTION - ///// if( Other_CategoryNumber == 3){ int Other_Number = RandInt( 1, 1 ); AddPropForce("push_other_-x_" + Other_Number, -PushAmount, 0, 0, "world"); } ///// - PUSH Z DIRECTION - ///// if( Other_CategoryNumber == 4){ int Other_Number = RandInt( 1, 3 ); AddPropForce("push_other_-z_" + Other_Number, 0, 0, -PushAmount, "world"); } } AddDebugMessage("Pushed an object!", false); float AmbientObjectPushFunctionTimerNumber = RandFloat( 30.0f, 60.0f ); AddTimer("aof_functiontimer", AmbientObjectPushFunctionTimerNumber, "RandomObjectPushFunction"); } void RandomPlayerScareFunction(string &in asTimer) { //-----------------------------------||-----------------------------------// // Starts an event that is based on and affects the player. // Timer is originally set between float values 60.0 and 300.0 seconds. // Timer: AmbientPlayerScareFunctionTimer //-----------------------------------||-----------------------------------// } void ChangeCAMSState(string &in asParent, string &in asChild, int alState) { SetLocalVarString("CAMS_State", asChild); AddDebugMessage("Changed CAMS_State to " + asChild, false); } void StartCustomAmbientMapScares() { //////////////////////////////////////////////////// // GENERATE RANDOM VALUE FOR TIMERS // float AmbientWindSoundsTimerNumber = RandFloat( 10.0f, 25.0f ); float AmbientStepsSoundsTimerNumber = RandFloat( 10.0f, 25.0f ); float AmbientVoiceSoundsTimerNumber = RandFloat( 30.0f, 120.0f ); float AmbientScrapeSoundsTimerNumber = RandFloat( 3.0f, 15.0f ); float AmbientObjectPushFunctionTimerNumber = RandFloat( 30.0f, 60.0f ); float AmbientPlayerScareFunctionTimerNumber = RandFloat( 60.0f, 300.0f ); ////////////////////////////////////////////////////////////////////////// // ADD THE COUNTING TIMERS WITH THE RANDOMLY GENERATED VALUE // AddTimer("aw_soundstimer_first", AmbientWindSoundsTimerNumber, "RandomWindSound"); AddTimer("as_soundstimer_first", AmbientStepsSoundsTimerNumber, "RandomStepsSound"); AddTimer("av_soundstimer_first", AmbientVoiceSoundsTimerNumber, "RandomVoiceSound"); AddTimer("asc_soundstimer_first", AmbientScrapeSoundsTimerNumber, "RandomScrapeSound"); AddTimer("aof_functiontimer_first", AmbientObjectPushFunctionTimerNumber, "RandomObjectPushFunction"); AddTimer("aps_functiontimer_first", AmbientPlayerScareFunctionTimerNumber, "RandomPlayerScareFunction"); ////////////////////////////////////////////////////////////////////////// // INITIATE STATE-CHANGING FUNCTIONS AND SET DEFAULT TO 1 // AddEntityCollideCallback("Player", "CustomAmbientMapScares_1", "ChangeCAMSState", false, 1); AddEntityCollideCallback("Player", "CustomAmbientMapScares_2", "ChangeCAMSState", false, 1); AddEntityCollideCallback("Player", "CustomAmbientMapScares_3", "ChangeCAMSState", false, 1); AddEntityCollideCallback("Player", "CustomAmbientMapScares_4", "ChangeCAMSState", false, 1); SetLocalVarString("CAMS_State", "CustomAmbientMapScares_1"); } ////////// - CUSTOM AMBIENT MAP SCARES - ////////// ///// - CREATED BY WAPEZ - ///// ///// - ENDS HERE - ///// ///////////////////////////////////////////////////////////