Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Continue Maps BGM into Battle

Ziack

Member

I figured out how to do this by making the maps BGM the same as the battle music and it works fine for the most part. The problem is, after i have killed all the enemies the battle end ME plays and disrupts the flow.
I have tried to turn it off but what happens is...the music is playing fine - i kill the enemies - then it kinda skips a bit, then starts the BGM all the way from the start. It sounds crappy and unprofessional.
Does anyone know a way to just make it so the maps BGM continues to play without interuptions during random battles with NO ME at the end of Battle.
 
I haven't really tested this out before, so I could be wrong. Couldn't you just turn off the ME via eventing (Changing the ME to "none" through event commands)? Or you could just have no ME at all.
As I said before, I haven't played with this before so I could be wrong.
 
Comment (Enter a # at the beginning of) the following lines:

Scene_Map
168
172
Scene_Battle 1
109
292
Scene_Battle 2
119
139

In the database, on the System tab, select "none" for both Battle BGM & Battle End ME
 

Ziack

Member

Hmm thanks Brewmeister but there seems to still be a problem. The music wont reset now which is all well and good but it still skips after i defeat the enemies like *tune - skip -Tune keeps going* almost sounds like when you have a scratch on a CD

P.S. Did you mean for me to do this WITHOUT an event that changes the battle BGM to the same as the maps? if i do that then there is no music in battle at all then when it returns to the map the music picks up from where it left off.

@Sechs - Yeah i did try that, the same thing happens XD

Edit: further experiements reveal that after killing the last enemy the BGM just seems to pick up from a pre-set spot XD I just want it to flow continuosly. If you want an example..im trying to get it like Final fantasy 7's intro ....is it even possible?
 
You see, that is why I prefer making illusion battle systems (Ones that are evented only) because you can get those types of effects just via event commands and switches. I have seen some indie game designers achieve the effect you are looking for just by eventing their battle systems.
 

Ziack

Member

Sechs":2ne0ahj4 said:
You see, that is why I prefer making illusion battle systems (Ones that are evented only) because you can get those types of effects just via event commands and switches. I have seen some indie game designers achieve the effect you are looking for just by eventing their battle systems.

What is this...illusion battle system? and how would you do what i am trying to do with events? maybe i can learn from you somehow lol
 
Ziack":ds1b555n said:
Sechs":ds1b555n said:
You see, that is why I prefer making illusion battle systems (Ones that are evented only) because you can get those types of effects just via event commands and switches. I have seen some indie game designers achieve the effect you are looking for just by eventing their battle systems.

What is this...illusion battle system? and how would you do what i am trying to do with events? maybe i can learn from you somehow lol
Illusion battle systems are battle systems that look custom and might have been done with scripts, but in fact they are made solely through event commands like switches, variables, etc. They are very hard to do and I cannot teach them to you; I've only seen them done before. Sorry.
 

Ziack

Member

Brewmeister":sdn9xp0u said:
Ziack, do you have any other customizations to your scripts?

Yeah i have some other scripts installed.

I am using a script that makes it so that in a normal random battle situation where the music changes from the maps BGM to the battle BGM... after the battle, the maps BGM wont start the tune from the beggining, it will remember where it was.

I did what you said on a new project and it worked great!... so now it seems i have to choose... do i want this thing you have taught me to continue the BGM into battle perfectly (which i would probably only use in the intro) or do i want the BGM to remember where it was at so it doesnt keep restarting after battles...

Too bad i cant have both...thanks for all your help!

Edit: So it seems what you have suggested i do changes it for good! like... the Maps BGM will play over to the battles all the time and i cant stop it from doing that XD i only wanted this feature for an intro and maybe certain other parts but most of the game would follow the traditional formula *map music -> Battle music -> fanfare -> map music (where it left off!)

Edit2: sorry i know this is now a long post... XD I figured out if i remove the # from line 172 of scene_map i now just need to use an event to change the Battle BGM to the same as the maps, this makes it flow. if i want to have normal battle music i just remove this event however.. the problem of the maps BGM starting all over again still persists. I know this has now turned into something else but you have helped me so far =D

P.S. i am no longer using the script to make the maps BGM continue from where it left off after battle because it conflicts with this method.
 
which script were you using to continue the map BGM where it left off? (link, or paste the script in code tags)
We should be able to modify that script to check a switch, and allow you to choose which method you want to use, and when.
 

Ziack

Member

Brewmeister":31jrobeb said:
which script were you using to continue the map BGM where it left off? (link, or paste the script in code tags)
We should be able to modify that script to check a switch, and allow you to choose which method you want to use, and when.

Awesome, that sounds promising here is the link to the page where i got the script, they request you to get it from the demo though, which is what i did.

viewtopic.php?t=55486.0

That should work...hopefully.

Just as i note...i am trying to have my maps bgm continue from where it left off after the battle is over AND be able to continue the maps BGM into battle at special times. Right now i can continue the Maps BGM into battle when i want but cant get the maps bgm to remember where it was. Sorry to repeat myself...just wanna clear up where i am at =D
 
Ok, first undo all of the edits from above (remove the comment '#' character)

Now, modify the following lines as such:

Scene_Battle 1, line 292

  • $game_system.bgm_play($game_temp.map_bgm) if $using_battle_bgm

Scene_Battle 2, line 119

  • $game_system.bgm_play($game_temp.map_bgm) if $using_battle_bgm

Other Classes *, add line 7 below line 6

  • $using_battle_bgm = false

line 28

  • $game_system.bgm_play($game_system.battle_bgm) if $using_battle_bgm

line 46

  • $game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos) if $using_battle_bgm

line 78

  • $game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos) if $using_battle_bgm

Turn it on/off

The game starts with $using_battle_bgm = false. Map music will continue to play right through battle.
To return to the default behavior (Map BGM -> Battle BGM -> Map BGM continue where left off), in an event
script command, enter:

  • $using_battle_bgm = true

To return to "Map BGM only"...

  • $using_battle_bgm = false


This has become a "Script Support" thread, so I'm moving it...

Be Well
 

Ziack

Member

Brewmeister":1dyjgli3 said:
Ok, first undo all of the edits from above (remove the comment '#' character)

Now, modify the following lines as such:

Scene_Battle 1, line 292

  • $game_system.bgm_play($game_temp.map_bgm) if $using_battle_bgm

Scene_Battle 2, line 119

  • $game_system.bgm_play($game_temp.map_bgm) if $using_battle_bgm

Other Classes *, add line 7 below line 6

  • $using_battle_bgm = false

line 28

  • $game_system.bgm_play($game_system.battle_bgm) if $using_battle_bgm

line 46

  • $game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos) if $using_battle_bgm

line 78

  • $game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos) if $using_battle_bgm

Turn it on/off

The game starts with $using_battle_bgm = false. Map music will continue to play right through battle.
To return to the default behavior (Map BGM -> Battle BGM -> Map BGM continue where left off), in an event
script command, enter:

  • $using_battle_bgm = true

To return to "Map BGM only"...

  • $using_battle_bgm = false


This has become a "Script Support" thread, so I'm moving it...

Be Well

Hmm so i did all the things you told me, although i was confused after the "Other Classes*" point. You meant for me to make totally new lines right? (i'm terrible with scripts) anyways, i did that and you said by default, the maps music was supposed to carry over into the battle? well that didnt happen...it changed to my battle theme.

"$using_battle_bgm = true" was weird... it made the battle end ME and the maps music play at the same time at the end of battle. So, not knowing what i am doing i just thought to do a script call of the other one "$using_battle_bgm = false".... this actually had the effect i wanted. Maps music was playing -> got into a battle -> end battle ME played -> Maps music played (from where it left off) hooray! BUT >_< like i said before, it didnt do the default behavior of the maps BGM continueing into Battle so i decided to try create that effect again with "change battle bgm" to the maps BGM....didnt work the way i hoped.
Pretty much i just get the same result as if i were using the script without having modified anything..

Just to make sure... When you got this working, you had all 3 scripts from that demo right? Game_System* Other_Classes* and FmodEX *

I just cant work out whats going on..

Edit: probably better if i just give up on this one. If you have it working fine and i don't then clearly i am doing something wrong lol. Thanks for all your help none the less =D
 
Nope, I just meant add the "if $using_battle_bgm" to the end of those lines.

$using_battle_bgm = true

means using a separate battle bgm. Set it to false to continue the map music through battle

You should not need to set the battle bgm the same as the map bgm in the database system page.
Set the battle bgm to the bgm you want to use when there is separate battle music.

Here, Download this demo

Enter battle with the ghost. The map bgm should continue through the battle.

Now touch the sign once to change $using_battle_bgm to true (no message, so only hit it once)

Battle the ghost again. Now the bgm changes to the battle bgm, and the map bgm picks up where it left off after battle.

Digg?
 

Ziack

Member

This post has been edited after i figured out what was wrong..

Theres just one thing i am left confused about... I noticed on the sign post it says "This TOGGLES $using_battle_bgm
If it's true, it becomes false
and vice versa" That isn't neccessary for me to write is it? sorry i really dont get commands and stuff yet

and earlier you said to use the script call "$using_battle_bgm = true" but on the sign post it says "$using_battle_bgm = !$using_battle_bgm"
Could you explain? XD

Edit: anyways i figured out you just put $using_battle_bgm = true lol. Its all working how i had hoped now, your a life saver, thanks!
 
I could've helped you earlier if I saw your post, I do have this (better than overwritting all your defaults), I'll go ahead and post it anyways just incase... you can save it and use it later in another project if you don't want to change everything back in your current one.

Code:
#===============================================================================

# ** Battle : Carry Over Map BGM 2 Battle

#===============================================================================

 

CarryOverMapBGM2Battle = 1

 

#-------------------------------------------------------------------------------

# * SDK Log

#-------------------------------------------------------------------------------

if Object.const_defined?(:SDK)

  SDK.log('Battle.CarryOverMapBGM2Battle?', 'Kain Nobel ©', 3.5, '2009.06.17')

end

 

#===============================================================================

# ** Game_Temp

#===============================================================================

 

class Game_Temp

  #-----------------------------------------------------------------------------

  # * Public Instance Variables

  #-----------------------------------------------------------------------------

  attr_accessor :battle_bgm_test

  attr_accessor :battle_me_test

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :btlcrryovermapbgm_gmtemp_initialize, :initialize

  #-----------------------------------------------------------------------------

  # * Object Initialization

  #-----------------------------------------------------------------------------

  def initialize

    btlcrryovermapbgm_gmtemp_initialize

    @battle_bgm_test = false

    @battle_me_test  = false

  end

end

 

#===============================================================================

# ** Game_System

#===============================================================================

 

class Game_System

  #-----------------------------------------------------------------------------

  # * Alias Listing

  #-----------------------------------------------------------------------------

  alias_method :btlcrryovermapbgm_gmsystem_bgmstop, :bgm_stop

  alias_method :btlcrryovermapbgm_gmsystem_bgmplay, :bgm_play

  alias_method :btlcrryovermapbgm_gmsystem_meplay,  :me_play

  #-----------------------------------------------------------------------------

  # * BGM Stop

  #-----------------------------------------------------------------------------

  def bgm_stop

    unless carry_map_bgm_2_battle?

      btlcrryovermapbgm_gmsystem_bgmstop

    end

  end

  #-----------------------------------------------------------------------------

  # * BGM Play

  #-----------------------------------------------------------------------------

  def bgm_play(bgm)

    unless carry_map_bgm_2_battle?

      btlcrryovermapbgm_gmsystem_bgmplay(bgm)

    end

  end

  #-----------------------------------------------------------------------------

  # * ME Play

  #-----------------------------------------------------------------------------

  def me_play(me)

    unless $game_temp.battle_me_test

      btlcrryovermapbgm_gmsystem_meplay(me)

    end

    $game_temp.battle_me_test = false

  end

  #-----------------------------------------------------------------------------

  # * Carry Over BGM

  #-----------------------------------------------------------------------------

  def carry_map_bgm_2_battle?

    return false if $game_temp.nil?

    return false if !$game_temp.battle_bgm_test

    return false if playing_bgm.nil?

    return false if playing_bgm.name   == ""

    return false if playing_bgm.volume == 0

    return true if battle_bgm.name     == ""

    return true if playing_bgm == battle_bgm

    return true if $game_switches[CarryOverMapBGM2Battle]

    return false

  end

end

 

#===============================================================================

# ** Scene_Map

#===============================================================================

 

class Scene_Map < SDK::Scene_Base

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :btlcrryovermapbgm_scnmap_callbattle, :call_battle

  #-----------------------------------------------------------------------------

  # * Call Battle

  #-----------------------------------------------------------------------------

  def call_battle

    $game_temp.battle_bgm_test = true

    $game_temp.battle_me_test  = true

    btlcrryovermapbgm_scnmap_callbattle

    $game_temp.battle_bgm_test = false

  end

end

Its a rather old script (one of my first from a couple years ago), but it checks if either a switch is on or if the battle BGM equals the map BGM, or if the battle BGM is nothing it'll play the Map BGM in battle... it'll also override the ME play at the end of battle too if you want it too. (I wrote this so long ago, I should probably re-code it again, PM me if you do have any issues).

BTW when you see something like...

variable = !variable

...It means variable equals NOT variable. How shall I explain it... something like this...

Code:
variable = true

variable = !variable

p variable # => false

variable = !variable

p variable # => true

...Its basically a quick way of toggling a true/false value back and forth. Its a nice shortcut so that you don't have to do...

Code:
if variable == true

  variable = false

elsif variable == false

  variable = true

end

Another thing to note would be if variable has a value other than false or nil it is automatically assumed true.
 
Kain, nice compact code!

I think he would have still had the same problem integrating it with the other script (FMOD & continuing map bgm where it left off.)

Yeh, I was a little lazy in modifying default scripts instead of keeping it all in "Other Classes*"

Ziack, sorry for the confusion on "var = !var", I just used that to test.

Be Well
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top