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
Texture, Model & Animation Help Music "Lower" if player enters area
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#10
RE: Music "Lower" if player enters area

The issue might be your priority. Remember that the priority must be higher than the currently music playing if you want it to override. If it isn't, nothing will happen.
Also, since this script runs multiple times, I think you need to create an ever-increasing value for it, unless you stop the previous (though this might disrupt the flow).

PHP Code: (Select All)
void OnStart()
{
    
PlayMusic("SnowStorm"true101true); //prio 1
    
AddEntityCollideCallback("Player""Mlow""Lower"false0);
    
SetLocalVarInt("MusicPrio"1); //set priority variable to 1
}

void Lower(string &in asParentstring &in asChildint alState)
{
    
AddLocalVarInt("MusicPrio"1); //add to the variable every time this code runs

    
if(alState == 1//entering area
    

        
PlayGuiSound("quest_completed"5);
        
PlayMusic("SnowStorm"true0.51GetLocalVarInt("MusicPrio"), true); //sets priority higher than before.
    
}

    if(
alState == -1//exiting area
    
{
        
PlayMusic("SnowStorm"true10GetLocalVarInt("MusicPrio"), true); //sets priority even higher because the AddLocalVarInt has now run once again.
    
}


Hope this makes sense. If I understand you correctly, you want this to keep turning up or down in volume as you enter this area. If you only want it to happen once each time, then the variable is unnecessary. If that's the case, just make the last one 3 instead of 1.

(This post was last modified: 10-07-2015, 07:05 PM by Mudbill.)
10-07-2015, 07:05 PM
Find


Messages In This Thread
RE: Music "Lower" if player enters area - by Mudbill - 10-07-2015, 07:05 PM



Users browsing this thread: 1 Guest(s)