Save-Point
Separate Sounds for Menu Scene - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Separate Sounds for Menu Scene (/thread-13285.html)



Separate Sounds for Menu Scene - Solitaire - 10-13-2025

Hi all! A very happy Monday to you :D

I was wondering if different sounds could be specified in the menu scene, and item scene scripts for the cursor, cancel and decision.
I don't want to use those specified in the system, and "window selection". I want them to be different than the other generic choice selection boxes in the game, and stuff.

I tried copying the SE playing bits from Window Selection, and using them in "Scene_Menu", but they didn't change anything. I even tried copying the whole "Window Selection" script and altering it!! ...But that lead to errors, and probably wasn't a good idea. So I stopped fooling with that   Laughing + Tongue sticking out

I also tried using this FancyChoices [link] (should be named "FancyKhoices") script from Kyonides, which *seems* like it may use different sounds for the choice options, but when I edited that bit, it didn't change the sounds.

Anywho! I hope someone can help :D I can explain more if anything isn't clear. Thank you, to any possible replies <3 Blushing + Cheery

EDIT: 
Ah! Okay, for some reason it seems that the choices script effects left/right movements, but not up/down ones.
EDIT2:
I tried to add the call to play the audio for all movements, but now *both* the system audio and my system audio play. Okay, this isn't right I don't think lol

EDIT3:
AH! I THINK I FIGURED IT OUT!

In "window_selectable" under line 140, I just added an "if" statement for the cursor!

Code:
          # Move cursor down
          if $scene.is_a?(Scene_Menu)                    #<-------
            Audio.se_play("Audio/SE/ba", 100, 50)        #<-------
            @index = (@index + @column_max) % @item_max  #<-------
          else
          $game_system.se_play($data_system.cursor_se)
          @index = (@index + @column_max) % @item_max
        end
      end
    end

And I'll just repeat that for each direction...
I hope this won't cause any problems later  Happy with a sweat But it looks good to me!! Maybe this can help someone else too ;D


RE: Separate Sounds for Menu Scene - DerVVulfman - 10-13-2025

I have you one that might be a little more... fun.

Code:
          # Move cursor down

          # We branch on each type of 'Scene'
          case $scene
          when Scene_Menu ; $game_system.se_play($data_system.shop_se)
          when Scene_Equip ; $game_system.se_play($data_system.escape_se)
          else ; $game_system.se_play($data_system.cursor_se)
          end
         
          @index = (@index + @column_max) % @item_max
Here, I put use the CASE...END block

Each time it runs, it checks what type of $scene is running, ergo:  when (THIS) ; SE_play this  Laughing

But the last part of the case block is the 'else' ... in here basically saying "I got nothing else, do the default fx"

Do know that your option to change SFX based on the SCENE is interesting, but... 

You do get the same audio cues in both  windows within Scene_Equip, the window where you can see what you have equipped and can remove, and the window at the bottom where you can choose replacements.  So let's expand that, shall we????

First, add either:
Code:
class Scene_Equip
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :right_window             # Currently equipped gear window
end
or
Code:
class Scene_Equip
  #--------------------------------------------------------------------------
  # * Get the Right Window data
  #--------------------------------------------------------------------------
  def right_window
    @right_window
  end
end
I would prefer a separate outside script rather than direct inserts.  That way, you can find such changes with more ease. Direct edits to the default scripts are usually the last straw in the opinion of seasoned scripters.

The 'Right Window' instance variable in Scene_Equip is essentially the selectable display window of what you have equipped.  And  it is essentially NOT designed to give any information outside of Scene_Equip.  For that, you need to have SOME means to read this thing outside of the Scene_Equip class.

But with THAT out of the way (and inserted), consider THIS tidbit:
Code:
          # Move cursor down

          # We branch on each type of 'Scene'
          case $scene
         
            # If we branch on the main menu
            when Scene_Menu
              $game_system.se_play($data_system.shop_se)
             
            # If we branch on the Equip Menu
            when Scene_Equip
              # We decide if its the gear menu or not
              if $scene.right_window.active == true
                $game_system.se_play($data_system.escape_se)
              else
                $game_system.se_play($data_system.load_se)
              end
           
            # If we branch on any OTHER menu...
            else
            $game_system.se_play($data_system.cursor_se)
            #
          end
         
          @index = (@index + @column_max) % @item_max

I broke it down in a more plebian style to make it more digestible.  Do note in the center area how I added:
Code:
              # We decide if its the gear menu or not
              if $scene.right_window.active == true
                $game_system.se_play($data_system.escape_se)
              else
                $game_system.se_play($data_system.load_se)
              end
It allows for different audio depending on WHICH window you are in within Scene_Equip.  And it would not be possible to test that window without the prior inclusions I noted above.

This covers the use of SFX that are defined by the $game_system.se_play($data_system.AUDIO HERE) command.  You could go more advanced by setting up other SFX outside whats covered in the System class.  

[Image: Screen%20Shot%202023-04-09%20at%207.24.27%20PM.jpeg]