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.

Help with scripting

Hey everyone,

I'm busy making a RPG Maker project for a school project, which concludes game design on a basic way. Anyway, I've worked with RPG Maker for quite a time now, but I'd like to edit some things in the scripts, to satisfy my needs with the game.

So here's my questions:
- How do you edit the menu button's to get to another direction.
( like i've edited the list, and placed equipment on the second spot instead of the standard third spot, but it still redirects to the skills window. I want this because I remove the skills option out of it, and added a quest log option in. I've already got the script for the quest log but I only need to redirect it. )
- I'd like to implement a basic thing which makes all the other menu windows go transparant.
( but I can't seem to find out where to do this. )

Thanks already...
 
1) This really belongs in the "RGSS Support" Forum. so if it gets moved, you'll understand. http://home.comcast.net/~bridge161/scruffy.png[/img]

Look further down in the Scene_Menu script to the "update_command" method.

Look for "case @command_window.index"

The first option in your menu will execute the section that starts with:
when 0  # item

Since you removed "skill" from the menu, change the next "when" statement to:
when 99  # skill

This way you don't need to remove it, it will just get ignored.

Now, since "equipment" is the 2nd option in your menu, change the 3rd "when" statement to:
when 1  #equipment

Get it?

They should all line up with the options in your "@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])" statement from above in the "main" method.
Indexes always start with '0' instead of '1', so the numbers in the case statement will be one less than the "S1, S2..." numbers used above.

So, if your quest menu option is in the S5 slot, your case statement would look like:
Code:
when 4  # quest log
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to journal scene
        $scene = Scene_Quest.new      # or whatever the call to your quest scene requires

To make the windows transparent, there are 3 properties of each window: opacity, back_opacity, & contents_opacity.
You want 'back_opacity'.  So, in Scene_Menu, in the "main" method, in the section that makes the playtime window...
add the last line....
Code:
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 252
    @playtime_window.back_opacity = 100

You can add the same property to the other windows anywhere between where they're created (Window_PlayTime.new), and where they're disposed (@playtime_window.dispose)



Now, I know your next question will be, "Why can't I see my map through the transparent windows?"

Because your Menu is a completely new "Scene", with a black background.

To "capture" your current map scene, Add this line right below "def main"

    @spriteset = Spriteset_Map.new

And, add this line at the bottom of the "main" method, right below "@status_window.dispose"

    @spriteset.dispose


Code:
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Capture map background
    @spriteset = Spriteset_Map.new
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Journal"
    s6 = "Save"
    s7 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end
    @command_window.back_opacity = 100
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 252
    @playtime_window.back_opacity = 100
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 334
    @steps_window.back_opacity = 100
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    @gold_window.back_opacity = 100
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    @status_window.back_opacity = 100
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
    # Dispose of sprite set
    @spriteset.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @playtime_window.update
    @steps_window.update
    @gold_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # journal
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to journal scene
        $scene = Scene_Journal.new
      when 5  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 6  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        if $game_party.actors[@status_window.index].restriction >= 2
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to skill screen
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end

Be Well
 
Ah thank you very much! This really helped me out with all the questions, thanks for explaining it very detailed..
And sorry, for posting in the wrong forum, didn't find the RGSS support section. My mistake.
 

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