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.

Small request - selectable window

Oke... I'm working on a "pets system" but cannot make a selectable window to save my life. ':|

I was wondering if someone could make one for me?

It just needs four options:

1. Change Name: Opens the enter hero name window for character #2 in the database

2. Pet Store: Opens the shop window for certain items (items 1, 2, 3, 4, 5 for now, I can change them later)

3. Battlegrounds: Teleports you to map #6

4. Back to Menu: Takes you to Scene_Menu

It needs to be 185 wide, and 257 tall... and be integrated into this script I am making:

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

class Scene_PetSystem
  #-----------------
  # Main processing
  #-----------------

  def main
    #Call windows
    @window1 = Window_Pets1.new
    @window2 = Window_Pets2.new
    @window3 = Window_Pets3.new
    #Transition
    Graphics.transition
    #Main loop
    loop do
    #Update game screen
    Graphics.update
    #Update input info
    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
  @window1.dispose
  @window2.dispose
  @window3.dispose
end

#-------------------
# Frame update
#-------------------

  def update
    #Update windows
    @window1.update
    @window2.update
    @window3.update
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to Menu screen
      $scene = Scene_Menu.new
      return
    end
  end
end

#===============================================================================
# Window_Pets1
# ------------------------------------------------------------------------------
# This is the status window
#===============================================================================

class Window_Pets1 < Window_Base
  #--------------------------------------------------------------------------
  # Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color  
    #---------------------------
    # Defines certain variables
    #---------------------------
    pet_level = $game_variables[8]   # Pet's current level
    pet_health = $game_variables[9]  # Pet's health variable
    pet_type = $game_variables[13]    # Pet type variable
    
    pet_name = $data_actors[2].name        # Pet Name
    #pet_real_level = $data_actors[2].lvl # Pet Level
    #pet_exp = $data_actors[2].exp          # Pet Exp
    
    #-----------------------------------------------------------------
    # Pet Health
    # Defines the pet_health2 variable, used to show the pet's health
    #-----------------------------------------------------------------
    if $game_variables[13] == 0
      pet_health2 = "You have no pet."
    else
      if pet_health == 0
        pet_health2 = "Excellent"
      else
        if pet_health == 1
          pet_health2 = "Very Good"
        else
          if pet_health == 2
            pet_health2 = "Good"
          else
            if pet_health == 3
              pet_health2 = "Poor"
            else
              if pet_health == 4
                pet_health2 = "Very Poor"
              end
            end
          end
        end
      end
    end
    
    #------------
    # Draws Text
    #------------
    self.contents.draw_text(0, 0, 120, 32, "Name:")       # NAME
    self.contents.draw_text(0, 32, 120, 32, "Type:")      # TYPE
    self.contents.draw_text(0, 64, 120, 32, "Level:")     # LEVEL
    self.contents.draw_text(0, 96, 120, 32, "Health:")    # HEALTH
    self.contents.draw_text(90, 0, 120, 32, "#{pet_name}")        # Pet_Name
    # Pet types are listed below 'Pet_Health'                # Pet_Types
    #self.contents.draw_text(90, 64, 120, 32, "#{pet_real_level}") # Pet_Real_Level
    self.contents.draw_text(90, 96, 120, 32, "#{pet_health2}")     # Pet_Health
    
    #-----------
    # Pet Types
    #-----------
    if $game_variables[13] == 0
      self.contents.draw_text(90, 32, 300, 32, "You have no pet.")
    else
      if $game_variables[13] == 1
        self.contents.draw_text(90, 32, 300, 32, "Alsatchie")
      else 
        if $game_variables[13] == 2
          self.contents.draw_text(90, 32, 300, 32, "Myainn")
        else 
          if $game_variables[13] == 3
            self.contents.draw_text(90, 32, 300, 32, "Tigra")
          else 
            if $game_variables[13] == 4
              self.contents.draw_text(90, 32, 300, 32, "Ephanti")
            end
          end
        end
      end
    end
  end
end

#===============================================================================
# Window_Pets2
# ------------------------------------------------------------------------------
# This is the random pet message window
#===============================================================================

class Window_Pets2 < Window_Base
  #--------------------------------------------------------------------------
  # Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 159, 640, 65)
    self.contents = Bitmap.new(width - 0, height - 0)
    refresh
  end
  #--------------------------------------------------------------------------
  # Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    #-------------------------
    #Random message generator
    #-------------------------
    if $game_variables[11] == 0
      self.contents.draw_text(0, 0, 500, 32, "Your pet is very happy to see you.")
    else 
      if $game_variables[11] == 1
        self.contents.draw_text(0, 0, 500, 32, "Your pet is feeling very lonely.")
      else 
        if $game_variables[11] == 2
          self.contents.draw_text(0, 0, 500, 32, "Your pet wants to fight someone!")
        else 
          if $game_variables[11] == 3
            self.contents.draw_text(0, 0, 500, 32, "Your pet thinks you should buy it a new toy.")
          else 
            if $game_variables[11] == 4
              self.contents.draw_text(0, 0, 500, 32, "Your pet is feeling hungry.")
            else 
              if $game_variables[11] == 5
                self.contents.draw_text(0, 0, 500, 32, "Your pet likes the name you chose them!")
              end
            end
          end
        end
      end
    end
  end
end

#===============================================================================
# Window_Pets3
# ------------------------------------------------------------------------------
# This is the status window
#===============================================================================

class Window_Pets3 < Window_Base
  #--------------------------------------------------------------------------
  # Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(185, 223, 455, 257)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    #-------------------------
    #Random message generator
    #-------------------------
    if $game_variables[12] == 0
      self.contents.draw_text(0, 0, 500, 32, "You can change your pet's name")
      self.contents.draw_text(0, 32, 500, 32, "at any time by choosing the 'change name'")
      self.contents.draw_text(0, 64, 500, 32, "option from the menu in this screen.")
      self.contents.draw_text(0, 128, 500, 32, "This will give your pet more originality !")
    else 
      if $game_variables[12] == 1
      self.contents.draw_text(0, 0, 500, 32, "Your pet's health is important!")
      self.contents.draw_text(0, 64, 500, 32, "Make sure you feed them often")
      self.contents.draw_text(0, 96, 500, 32, "enough to keep them fit and healthy.")
      else 
        if $game_variables[12] == 2
          self.contents.draw_text(0, 0, 500, 32, "Pets are noble fighters.")
          self.contents.draw_text(0, 64, 500, 32, "They will often fight in their owners'")
          self.contents.draw_text(0, 96, 500, 32, "honour in the pets battle ground!")
        else 
          if $game_variables[12] == 3
            self.contents.draw_text(0, 0, 500, 32, "Pets make good companions.")
            self.contents.draw_text(0, 64, 500, 32, "Make sure you look after your pet, and")
            self.contents.draw_text(0, 96, 500, 32, "feed it at the right times. Remember that")
            self.contents.draw_text(0, 128, 500, 32, "Your pet will want some rest after battling!")
          end
        end
      end
    end
  end
end

The script is no where near finished or perfect, but once I have a selectable window in there I will be able to finish it off.

Thanks very much, your name will be in the credits. Oh and this is for an MMORPG which may be for profit incase that is a problem.
 

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