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
Script Help Music reverting upon death/map change
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#1
Music reverting upon death/map change

I'm currently working on a scene where the player enters a room that spawns a monster. At the moment he enters, suspenseful music starts playing. When he is killed by the monster, the music changes to a sad piece, and is meant to play throughout the death hint, and keep playing as he changes maps and respawns in a previous map. However, for some reason, the sad music abruptly reverts to a previous ambient as soon as the map starts changing.

Before the scene, the music playing is this one:

PlayMusic("ACD_03_amb", true, 0.5f, 5, 0, true);

When the player enters the room where the monster is activated, I set a check point, and play some event music:

PHP Code: (Select All)
void EnterMaster(string &in asParentstring &in asChildint alState)
{
    
CheckPoint ("third""PlayerStartArea_1""reset3""""");
    
PlayMusic("music_reactor_pre_kyrie.ogg"false0.7f010false);
}

void reset3(string &in asNameint alCount)
{
    
ChangeMap("chateau1.map""PlayerStartArea_1""""");


I have a timer checking the player's HP, and when it drops below 1, I use the following script:

PHP Code: (Select All)
void BellMusic(string &in asTimer)
{
    
PlayMusic("music_reactor_children_temp.ogg"false0.7f10false);


Now, when the player dies and the death hint plays, the "music_reactor_children_temp.ogg" music is still playing. But when the death hint fades away and the map starts changing, the music abruptly changes back to "ACD_03_amb." There is nothing under OnLeave for this map or OnStart/OnEnter for the map it's changing to, so I don't know what's causing the music to suddenly end. Can anyone help me with this?

(This post was last modified: 03-01-2014, 10:18 AM by Damascus.)
03-01-2014, 10:12 AM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#2
RE: Music reverting upon death/map change

Try putting StopMusic(0.0f, 0) in the timer. It might make the script understand to not use the ACD_03_amb music again. At least until you enter this map again.
(This post was last modified: 03-01-2014, 02:27 PM by Neelke.)
03-01-2014, 02:24 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#3
RE: Music reverting upon death/map change

Didn't work. I even tried stopping both 0 and 10 priority to make sure nothing should be scripted to play except the "music_reactor_children_temp.ogg" music, but as soon as the map loading screen comes up it immediately switches back to "ACD_03_amb."

03-02-2014, 05:37 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: Music reverting upon death/map change

One idea to do this is to assign different priorities to it. Stop the music that has the lowest priority. This should let your earlier music to stop, and newest to begin.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-02-2014, 08:39 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#5
RE: Music reverting upon death/map change

Update: The only thing I got to work was by stopping ACD_03_amb in the PREVIOUS map, in which case the music plays through the death as intended. But if I stop it IN the map where the death occurs, the music will revert. Of course, that solution doesn't work for me, as I have to play with no ambient music for the entire map.

03-03-2014, 07:56 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
RE: Music reverting upon death/map change

Your ACD and temp music lines both use '0' as the priority. This could perhaps cause problems.
Also, did you try playing the temp music within the reset3 block, which is ran when you respawn?

03-03-2014, 10:02 AM
Find




Users browsing this thread: 3 Guest(s)