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:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Changing music mid level
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#1
Changing music mid level

The scenario; a scream is heard, the normal level music stops and goes silent, then when the player interacts with a script area a monster noise plays and different (tense) music plays, then once the tense music has finished the normal music comes back on.

Now I have already done most of this, the only bit im having trouble with is making the normal music start playing again, here is my current script:

{
AddEntityCollideCallback("Player", "ScriptArea_1", "LoudNoise", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_5", "SuddenScare", true, 1);
}

void LoudNoise(string &in asParent, string &in asChild, int alState)
    
                         {
                             PlaySoundAtEntity("", "05_event_door_bang", "ScriptArea_3", 0, false);
                             StartPlayerLookAt("ScriptArea_3", 3, 1, "");
                             SetPlayerMoveSpeedMul(0);
                             SetPlayerRunSpeedMul(0);
                             SetPlayerLookSpeedMul(0);
                             AddTimer("Murder", 3, "Murder");
                             StopMusic(1, 1);
                            
                         }
                        
                     void Murder(string &in asTimer)
                        
                         {
                             PlaySoundAtEntity("", "react_scare", "Player", 0.0f, false);
                             StopPlayerLookAt();
                             SetPlayerMoveSpeedMul(1);
                             SetPlayerRunSpeedMul(1);
                             SetPlayerLookSpeedMul(1);
                            
                         }
                        
                     void SuddenScare(string &in asParent, string &in asChild, int alState)
                    
                         {
                             PlaySoundAtEntity("", "04_break", "ScriptArea_4", 0, false);
                             PlaySoundAtEntity("", "04_break02", "ScriptArea_4", 0, false);
                             StartPlayerLookAt("ScriptArea_4", 5, 5, "");
                             SetPlayerMoveSpeedMul(0);
                             SetPlayerRunSpeedMul(0);
                             SetPlayerLookSpeedMul(0);
                             AddTimer("ScarySound", 3, "ScarySound");
                            
                         }
                        
                     void ScarySound(string &in asTimer)
                    
                         {
                             PlayMusic("01_event_dust", false, 2, 4, 0, true);
                             StopPlayerLookAt();
                             SetPlayerMoveSpeedMul(1);
                             SetPlayerRunSpeedMul(1);
                             SetPlayerLookSpeedMul(1);
}

As it stands if I try to add the level music in it will start playing at the same time as the tense music, is there anyway to delay it with a timer or something?

02-10-2013, 05:07 PM
Find


Messages In This Thread
Changing music mid level - by serbusfish - 02-10-2013, 05:07 PM
RE: Changing music mid level - by serbusfish - 02-11-2013, 01:08 AM



Users browsing this thread: 1 Guest(s)