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.

Show Variable in Main Menu

This is a request for an edit of the default menu script for RMXP.

Script Title:
Show Variable in Menu
Detailed Description:
I would like to be able to remove the "Total Steps" section of the main menu and replace it with something that will show a variable. In this case I am using it with an achievements system in my game and for every achievement you earn, you earn points. Those points will be kept track with a variable. I would appreciate it if someone could edit the menu script (or re-write the part I need, if possible, in another script) so that the Title would be "Achievement Points" (and make it easy to change if I ever have another use for it) and make it so I can use a customizable variable as the number displayed (also easy to change if I need to change it to another variable). I'm assuming this shouldn't be too hard for a skilled scripter and i would greatly appreciate the help.
Other Scripts I am using :
None that should interfere with a simple script like this (I am using SDK 1.5 though, if that changes anything)
 
Ok, I just copied the Window_Steps class & modified it. Lines 22 & 25 are the original code. The lines below them are the changes. To make your edits, change "Achievement Points" in line 23, or "[1]" in line 26 to the variable number you want.

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

# ** Window_Steps

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

#  This window displays step count on the menu screen.

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

 

class Window_Steps < Window_Base

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

  # * Object Initialization

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

  def initialize

    super(0, 0, 160, 96)

    self.contents = Bitmap.new(width - 32, height - 32)

    refresh

  end

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

  # * Refresh

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

  def refresh

    self.contents.clear

    self.contents.font.color = system_color

    #self.contents.draw_text(4, 0, 120, 32, "Step Count")

    self.contents.draw_text(4, 0, 120, 32, "Achievement Points")

    self.contents.font.color = normal_color

    #self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)

    self.contents.draw_text(4, 32, 120, 32, $game_variables[1].to_s, 2)

  end

end
 
Thanks alot, exactly what i needed. I really gotta learn to pick up some scripting so I can do something like this on my own, cause this seemed pretty easy. Thanks again.

One more question. Is it possible to show a variable in the text like say if the variable is 100, the text would Say you have 100 points, or if it was 200 it would show 200 etc. I know there is a code for showing actor name so I would assume there is one for variables, I just don't know it, if it does exist.
 

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