Help: Want BGM to continue playing after map transfer.

Started by icecold49, February 05, 2008, 06:22:39 pm

Previous topic - Next topic

icecold49

I have a little problem regarding the BGM in RMXP. When i play a BGM, i want the song to continue playing (without it going back to start of song) when i transfer from one map to another. I know you can do this if both maps' auto-BGMs are set to the same song but i want the BGM to continue playing after triggering the BGM with an event. If there is anything that I can do to change this, please tell me. If there is a script for this, than that would be good too.
Thanks. :)

winkio

One option is to make a parallel process event that plays the bgm you want.  That is what I use in my game, although it can cause some lag.
Another option is to add a line that plays the bgm as the last line of the event that teleports you into the map.

but when you switch maps, if there is no auto change bgm, the bgm should just carry over and not restart...

Hope one of those works for you.

icecold49

Thanks for your suggestions but both of them don't work becuase once I transfer onto another map, the bgm still starts over again. I just want the bgm to continue playing without it starting over again after I transfer onto another map.

winkio

here, ill make a demo.  Wait a few minutes...

EDIT: okay here it is
it uses 3 options, and you can select witch one you want by changing the starting position.  hope this clears everything up.
http://www.sendspace.com/file/pb7ht2

EDIT#2: You can open up and edit this demo as you wish, to see how it works and change the starting position, so that you can see how each method works.

Blizzard

February 05, 2008, 08:07:10 pm #4 Last Edit: February 05, 2008, 08:08:53 pm by Blizzard
Or use this mini script. It won't restart the playing BGM or BGS if it is already playing.

class Game_System
 
  alias bgm_play_bgmcontinue_later bgm_play
  def bgm_play(bgm)
    if bgm == nil || @playing_bgm == nil || @playing_bgm.name != bgm.name ||
        @playing_bgm.volume != bgm.volume || @playing_bgm.pitch != bgm.pitch
      bgm_play_bgmcontinue_later(bgm)
    end
  end
 
  alias bgs_play_bgscontinue_later bgs_play
  def bgs_play(bgs)
    if bgs == nil || @playing_bgs == nil || @playing_bgs.name != bgs.name ||
        @playing_bgs.volume != bgs.volume || @playing_bgs.pitch != bgs.pitch
      bgs_play_bgscontinue_later(bgs)
    end
  end
 
end


Tell me if it work, I made this out of my head.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

icecold49

February 05, 2008, 08:29:54 pm #5 Last Edit: February 05, 2008, 08:36:26 pm by icecold49
 :) Thanks for the script Blizz. However I just tried the script out and it looks like it didn't work. The same thing was happening as before. I played the BGM through a parallel process, then transfered to another map with another parallel process playing the same BGM, and the song stopped for a second and then restarted as usual.  :-\ Really want this to work. Please help.

EDIT: Winkio, i didn't see your message. I'm going to try what you suggested first (the demo).

winkio

This sounds like a problem with your version of RPG Maker or a mod to the system.  Does the demo work?

Here, let me try Blizz's script real quick, and then we shall see if it is our fixes or your version of the program.

EDIT: the script works perfectly fine for me.

icecold, what version of RMXP are you using?

icecold49

February 05, 2008, 08:46:19 pm #7 Last Edit: February 05, 2008, 08:47:25 pm by icecold49
Your demo is exactly what I was looking for, Winkio. So, how did you set it up like that?
Where's the script in the demo?
Also - Using RMXP version: 1.0.2.0

Blizzard

I am using the same one and I don't have that problem... Are you using a differnt pitch than 100? It could also be that you are calling the same song with a different file name. Check if your folder has duplicates. It happened to me, too.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

I am not using ANY scripts in the demo.  Im also using the same version of RPG Maker as you.  That means that the error is probably with your scripts.  Might want to copy over Game_System from the demo to your game, in case part of that script was deleted.  Also, custom scripts should go below every other script except main.  Thats all the advice I can give you for now.

The demo was set up using EVENTS ONLY.  You can look at the events in the demo by opening up the project and looking at them.

Blizzard

Actually calling Audio.bgm_play('NAME', VOLUME, PITCH) doesn't start over if it is the same file. >_>
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

icecold49

February 05, 2008, 09:06:28 pm #11 Last Edit: February 05, 2008, 09:07:50 pm by icecold49
Hmmm, I see. The BGM actually did continue on when transfering to another map. However, when there were other auto-change BGMs on the maps, it didn't work. Is there any sollution to this? I need my auto-change BGMs. By "didn't work" I mean the BGM stopped for 1 second and then started it up again from the beginning.

Blizzard

Hm... Try getting another RGSS102E.dll. Yours could have an error.  You can try to google it or simply download a game from here that has it. I know that my CP has it for sure, I can't remember if CoSLAL had it, though.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

February 05, 2008, 09:19:44 pm #13 Last Edit: February 05, 2008, 10:40:41 pm by winkio
ohh, okay.  THAT makes more sense.

There is no way to do it with autochanging BGM.  There is still a way you can do it though:

1.  Create a switch (ill call it "DifBGM).
2.  turn the switch on before you transfer the player over to the second map if you want the different bgm to keep playing, off if you want the auto-start bgm to     
     play.
3.  Turn off the autostart bgm on the second map (uncheck the box).
4.  Create a paralell process that has 2 pages (on the second map):
     Page1 should just play the bgm you would normally have auto-start (this will function the same as an autostart)
     Page2 should have the condition of switch "DifBGM" being on, and play the different bgm from the event.
     Then, when you exit the map or want to switch the bgm back to normal, simply turn off the switch.

Here is a demo of what I mean:

http://www.sendspace.com/file/be49jf

EDIT:  There is no error with any file Blizz.  Its just how RPG Maker works.  I got the same thing he did.  This fix works tho.  Its what I use all the time in my game.

Blizzard

It doesn't restart the BGM when I use the same one in two maps. =/ I don't know why it doesn't work as it should.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

Blizz, thats not what he is talking about:

he is talking about BGM A being autostarted in Map1 and BGM B being autostarted in Map 2

then, an event in map 1 plays BGM C, and he wants BGM C to carry over to map two, without restarting or playing BGM B.

Blizzard

Ah, I see. Yes, you can't do that without a switch. You should use a parallel process for the BGM A instead of the usual autostarter and simply disable that one by switch when you start BGM C.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

yes, that it what I told him to do, and is what I did in the demo.

Wow, I came up with the exact same thing Blizz did, only 8 hours sooner! :P

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.