Chaos Project

RPG Maker => General Discussion => Topic started by: icecold49 on February 05, 2008, 06:22:39 pm

Title: Help: Want BGM to continue playing after map transfer.
Post by: icecold49 on February 05, 2008, 06:22:39 pm
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. :)
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: winkio on February 05, 2008, 07:10:02 pm
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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: icecold49 on February 05, 2008, 07:28:55 pm
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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: winkio on February 05, 2008, 07:47:21 pm
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 (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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: Blizzard on February 05, 2008, 08:07:10 pm
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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: icecold49 on February 05, 2008, 08:29:54 pm
 :) 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).
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: winkio on February 05, 2008, 08:32:17 pm
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?
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: icecold49 on February 05, 2008, 08:46:19 pm
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
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: Blizzard on February 05, 2008, 08:49:10 pm
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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: winkio on February 05, 2008, 08:57:28 pm
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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: Blizzard on February 05, 2008, 09:05:04 pm
Actually calling Audio.bgm_play('NAME', VOLUME, PITCH) doesn't start over if it is the same file. >_>
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: icecold49 on February 05, 2008, 09:06:28 pm
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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: Blizzard on February 05, 2008, 09:11:44 pm
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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: winkio on February 05, 2008, 09:19:44 pm
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 (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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: Blizzard on February 06, 2008, 07:26:54 am
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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: winkio on February 06, 2008, 05:29:07 pm
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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: Blizzard on February 06, 2008, 05:42:25 pm
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.
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: winkio on February 06, 2008, 05:56:53 pm
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
Title: Re: Help: Want BGM to continue playing after map transfer.
Post by: Blizzard on February 06, 2008, 06:43:17 pm
I know, I'm just putting it into less words. :P