A tweak needed to a script made by G_G

Started by MarkHest, September 19, 2015, 05:01:11 am

Previous topic - Next topic

MarkHest

September 19, 2015, 05:01:11 am Last Edit: September 19, 2015, 05:02:18 am by MarkHest
Hey! A while ago G_G made a script for me that adds the "map music" option to the stormtronics custom menu system. It looks like this:


class Game_System
 
 #SWITCH_MAP = 8

 
   
   
   
 def reset_battle_bgm
   bgm = BlizzCFG::BATTLE_BGMS[$game_variables[BlizzCFG::BGM_Variable]]
   if bgm[3].downcase == "map"
     $game_system.battle_bgm = nil
   else
     $game_system.battle_bgm = RPG::AudioFile.new(bgm[0], bgm[1], bgm[2])
   end
   return true
 end

 alias gg_update_bgm_stuff_lat battle_bgm
 def battle_bgm
   if @battle_bgm == nil
     return @playing_bgm
   end
   return gg_update_bgm_stuff_lat
 end

 def real_battle
   return @battle_bgm
 end

end


class Scene_Map

 alias gg_reset_system_bgm_lat main
 def main
   $game_system.reset_battle_bgm
   gg_reset_system_bgm_lat
 end

 def call_battle
   $game_temp.battle_calling = false
   $game_temp.menu_calling = false
   $game_temp.menu_beep = false
   $game_player.make_encounter_count
   $game_temp.map_bgm = $game_system.playing_bgm
   $game_system.se_play($data_system.battle_start_se)
   if $game_system.real_battle != nil
     $game_system.bgm_stop
     $game_system.bgm_play($game_system.battle_bgm)
   end
   $game_player.straighten
   $scene = Scene_Battle.new
 end
 
end



I need something that keeps track of whether the map music is chosen or not, probably a switch..
I need this because when I switch to a boss music I need to revert the battle theme after the boss fight and then I need to know if the player has the map music option on or not.
So, basically a switch or something that turns on and off depending on what option you chose in the menu. Something like:

pseudo code...

if map-music
Switch 8 = true
else
Switch 8 = false
   

KK20

Because not all of the script is posted, I'm going to infer that this so-called map music selection somehow interferes with setting the battle music. That doesn't sound right to me.

If G_G's add-on followed like how the battle music is assigned to a game variable, you could easily check that variable to see if it is assigned a value or not. I would assume that the music selections would include a "None" option designated as the very first selection, meaning the variable would be assigned to 0. So it's just a matter of "if game_variable[ID] != 0, then player selected map music".

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

MarkHest

I don't understand what you mean :p
Also, this script is an addon to the Stormtronics CMS. I can't remember if I did actual tweaks to the main script itself but the one I posted is the only script.
   

G_G

These two lines.
bgm = BlizzCFG::BATTLE_BGMS[$game_variables[BlizzCFG::BGM_Variable]]
    if bgm[3].downcase == "map"


This is how I check if it's a map music apparently. I can hardly remember the add-on and if I had modified the main script or not. But you could use this in a conditional branch.

BlizzCFG::BATTLE_BGMS[$game_variables[BlizzCFG::BGM_Variable]][3].downcase == "map"



KK20

Quote from: gameus on September 27, 2015, 12:09:54 pm
I can hardly remember the add-on and if I had modified the main script or not.

You had to. I didn't see anything different happen by just putting Stormtronics and the script post into an empty project. I changed the configuration to

  BATTLE_BGMS = [
  #             ['BGM_NAME', VOLUME, PITCH, 'DISPLAY_NAME']
                ['001-Battle01', 100, 100, 'BGM 1'],
                ['002-Battle02', 100, 100, 'BGM 2'],
                ['003-Battle03', 100, 100, 'BGM 3'],
                ['004-Battle04', 100, 100, 'Map']]

And all that did was make the battle music the same as the map's music.

Quote from: MarkHest on September 27, 2015, 08:30:27 am
I don't understand what you mean :p

In Stormtronics, BGM music has a game variable attached to it. In the default configuration, it is

  BGM_Variable = 49

You could use a conditional branch to check what battle music the player has chosen by looking at $game_variables[49] in this case. So, if the player's battle music was 'BGM 1' (which is the first option in BATTLE_BGMS), $game_variables[49] would be 0. 'BGM 2' would give us 1. And so on...

The point I was making was that G_G's add-on could have made it so that "BGM 1" would return 1 instead of 0. Then, you modify Stormtronics to include a "None" or "Default" option for Battle BGM, which we would assign a value of 0. Thus, if $game_variables[49] is 0, we know the player did NOT select a map background music.

This was just my hypothesis.

Quote from: MarkHest on September 27, 2015, 08:30:27 am
Also, this script is an addon to the Stormtronics CMS. I can't remember if I did actual tweaks to the main script itself but the one I posted is the only script.

You could compare the original script with your current script using something like Text-Compare. And if you don't remember, what's the danger in just posting your Stormtronics script?

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

G_G

September 30, 2015, 09:39:57 am #5 Last Edit: September 30, 2015, 09:43:56 am by gameus
Yes, I think I remember now. It's supposed to change the Battle Music to the Map's music. I'm almost positive that's the add-on he had me write. And if that's the case, I think he's just wanting to revert it back to map music after a boss fight. Which you could do by eventing.

This is the variable in mind.
$game_variables[BlizzCFG::BGM_Variable]


I dunno what you have it set to, but let's just say it's variable 6. And let's copy KK's config.

  BATTLE_BGMS = [
  #             ['BGM_NAME', VOLUME, PITCH, 'DISPLAY_NAME']
               ['001-Battle01', 100, 100, 'BGM 1'],
               ['002-Battle02', 100, 100, 'BGM 2'],
               ['003-Battle03', 100, 100, 'BGM 3'],
               ['004-Battle04', 100, 100, 'Map']]


The "Map" option is the last in the array. So in this case, it's the 4th option, so to change it to back to that, all you'd do is set variable 6 to 3.
$game_variables[6] = 3

MarkHest

YES! I got it to work!  :haha:
This adds a lot more quality in the game. Thanks a lot for helping me. Level++ to both of you!
   

KK20

Oh I misunderstood the script then. I thought it was a "play any song you want on the map instead of the default map music".

It confused me since this

['004-Battle04', 100, 100, 'Map']

does not care about the first three elements at all.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

G_G

Right, I think I wanted to make it so the original menu system still functioned with the configuration options. Didn't want it to encounter any errors when Stormtronics was trying to cycle through the song list.