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.

[Request]Very Basic hud and unsellable items

i need a hud that looks like this
http://img108.imageshack.us/img108/1664/examplepb7.png[/IMG]
http://img108.imageshack.us/img108/1664/examplepb7.png

info:
translucent
face file /characters/faces/
96x96 .bmp pictures
windowskin : parchment.bmp
status windowskin: 002-Purple02.bmp

And can i get a script where you can't sell an item armor or weapon?
lets say i found a cursed skull and with the skull you get a -10% str Bonus and you can't sell it

Thanks! -deon204
i hope im not asking for too much
 
Alright. Done.
In Window_Base right under
Code:
#--------------------------------------------------------------------------
  # * Draw Level
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_level(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, 32, "Lv")
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
  end

Add this

Code:
#=====================================
#Gradient Bars with customizable lengths, thicknesses, types and Colors
#By AcedentProne
#=====================================
 def draw_normal_barz(x, y, type, length, thick, e1, e2, c1 = Color.new(153,238,153,255), c2 = Color.new(0,0,0,255))
   if type == "horizontal"
     width = length
     height = thick
     self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
     self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
     w = width * e1 / e2
     for i in 0..height
     r = c1.red + (c2.red - c1.red)   * (height -i)/height  + 0   * i/height
     g = c1.green + (c2.green - c1.green) * (height -i)/height  + 0 * i/height
     b = c1.blue + (c2.blue - c1.blue)  * (height -i)/height  + 0 * i/height
     a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height  + 255 * i/height
     self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
   end
 elsif type == "vertical"
   width = thick
   height = length
     self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
     self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
   h = height * e1 / e2
   for i in 0..width
     r = c1.red + (c2.red - c1.red)   * (width -i)/width  + 0   * i/width
     g = c1.green + (c2.green - c1.green) * (width -i)/width  + 0 * i/width
     b = c1.blue + (c2.blue - c1.blue)  * (width -i)/width  + 0 * i/width
     a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width  + 255 * i/width
     self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
   end
 end
end
def draw_actor_barz(actor,x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
   if type == "horizontal"
     width = length
     height = thick
     self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
     self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
     w = width * e1 / e2
     for i in 0..height
     r = c1.red + (c2.red - c1.red)   * (height -i)/height  + 0   * i/height
     g = c1.green + (c2.green - c1.green) * (height -i)/height  + 0 * i/height
     b = c1.blue + (c2.blue - c1.blue)  * (height -i)/height  + 0 * i/height
     a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height  + 255 * i/height
     self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
   end
 elsif type == "vertical"
   width = thick
   height = length
     self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
     self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
   h = height * e1 / e2
   for i in 0..width
     r = c1.red + (c2.red - c1.red)   * (width -i)/width  + 0   * i/width
     g = c1.green + (c2.green - c1.green) * (width -i)/width  + 0 * i/width
     b = c1.blue + (c2.blue - c1.blue)  * (width -i)/width  + 0 * i/width
     a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width  + 255 * i/width
     self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
   end
 end
end

Next, replace Scene_Map with this

Code:
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make sprite set
    @spriteset = Spriteset_Map.new
    # Make message window
    @message_window = Window_Message.new
    # Make hud window
    @hud = Window_Map.new
    @hud2 = Window_Map2.new
    @hud3 = Window_Map3.new
    @hud.opacity = 160
    @hud2.opacity = 160
    @hud3.opacity = 160
    # Transition run
    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 sprite set
    @spriteset.dispose
    # Dispose of message window
    @message_window.dispose
    # Dispose of hud
    @hud.dispose
    @hud2.dispose
    @hud3.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Loop
    loop do
      # Update map, interpreter, and player order
      # (this update order is important for when conditions are fulfilled 
      # to run any event, and the player isn't provided the opportunity to
      # move in an instant)
      $game_map.update
      $game_system.map_interpreter.update
      $game_player.update
      # Update system (timer), screen
      $game_system.update
      $game_screen.update
      # Abort loop if player isn't place moving
      unless $game_temp.player_transferring
        break
      end
      # Run place move
      transfer_player
      # Abort loop if transition processing
      if $game_temp.transition_processing
        break
      end
    end
    # Update sprite set
    @spriteset.update
    # Update message window
    @message_window.update
    # Update hud window
    @hud.update
    @hud2.update
    @hud3.update
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Change to title screen
      $scene = Scene_Title.new
      return
    end
    # If transition processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If showing message window
    if $game_temp.message_window_showing
      return
    end
    # If encounter list isn't empty, and encounter count is 0
    if $game_player.encounter_count == 0 and $game_map.encounter_list != []
      # If event is running or encounter is not forbidden
      unless $game_system.map_interpreter.running? or
             $game_system.encounter_disabled
        # Confirm troop
        n = rand($game_map.encounter_list.size)
        troop_id = $game_map.encounter_list[n]
        # If troop is valid
        if $data_troops[troop_id] != nil
          # Set battle calling flag
          $game_temp.battle_calling = true
          $game_temp.battle_troop_id = troop_id
          $game_temp.battle_can_escape = true
          $game_temp.battle_can_lose = false
          $game_temp.battle_proc = nil
        end
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # If event is running, or menu is not forbidden
      unless $game_system.map_interpreter.running? or
             $game_system.menu_disabled
        # Set menu calling flag or beep flag
        $game_temp.menu_calling = true
        $game_temp.menu_beep = true
      end
    end
    # If debug mode is ON and F9 key was pressed
    if $DEBUG and Input.press?(Input::F9)
      # Set debug calling flag
      $game_temp.debug_calling = true
    end
    # If player is not moving
    unless $game_player.moving?
      # Run calling of each screen
      if $game_temp.battle_calling
        call_battle
      elsif $game_temp.shop_calling
        call_shop
      elsif $game_temp.name_calling
        call_name
      elsif $game_temp.menu_calling
        call_menu
      elsif $game_temp.save_calling
        call_save
      elsif $game_temp.debug_calling
        call_debug
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Battle Call
  #--------------------------------------------------------------------------
  def call_battle
    # Clear battle calling flag
    $game_temp.battle_calling = false
    # Clear menu calling flag
    $game_temp.menu_calling = false
    $game_temp.menu_beep = false
    # Make encounter count
    $game_player.make_encounter_count
    # Memorize map BGM and stop BGM
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    # Play battle start SE
    $game_system.se_play($data_system.battle_start_se)
    # Play battle BGM
    $game_system.bgm_play($game_system.battle_bgm)
    # Straighten player position
    $game_player.straighten
    # Switch to battle screen
    $scene = Scene_Battle.new
  end
  #--------------------------------------------------------------------------
  # * Shop Call
  #--------------------------------------------------------------------------
  def call_shop
    # Clear shop call flag
    $game_temp.shop_calling = false
    # Straighten player position
    $game_player.straighten
    # Switch to shop screen
    $scene = Scene_Shop.new
  end
  #--------------------------------------------------------------------------
  # * Name Input Call
  #--------------------------------------------------------------------------
  def call_name
    # Clear name input call flag
    $game_temp.name_calling = false
    # Straighten player position
    $game_player.straighten
    # Switch to name input screen
    $scene = Scene_Name.new
  end
  #--------------------------------------------------------------------------
  # * Menu Call
  #--------------------------------------------------------------------------
  def call_menu
    # Clear menu call flag
    $game_temp.menu_calling = false
    # If menu beep flag is set
    if $game_temp.menu_beep
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Clear menu beep flag
      $game_temp.menu_beep = false
    end
    # Straighten player position
    $game_player.straighten
    # Switch to menu screen
    $scene = Scene_Menu.new
  end
  #--------------------------------------------------------------------------
  # * Save Call
  #--------------------------------------------------------------------------
  def call_save
    # Straighten player position
    $game_player.straighten
    # Switch to save screen
    $scene = Scene_Save.new
  end
  #--------------------------------------------------------------------------
  # * Debug Call
  #--------------------------------------------------------------------------
  def call_debug
    # Clear debug call flag
    $game_temp.debug_calling = false
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Straighten player position
    $game_player.straighten
    # Switch to debug screen
    $scene = Scene_Debug.new
  end
  #--------------------------------------------------------------------------
  # * Player Place Move
  #--------------------------------------------------------------------------
  def transfer_player
    # Clear player place move call flag
    $game_temp.player_transferring = false
    # If move destination is different than current map
    if $game_map.map_id != $game_temp.player_new_map_id
      # Set up a new map
      $game_map.setup($game_temp.player_new_map_id)
    end
    # Set up player position
    $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
    # Set player direction
    case $game_temp.player_new_direction
    when 2  # down
      $game_player.turn_down
    when 4  # left
      $game_player.turn_left
    when 6  # right
      $game_player.turn_right
    when 8  # up
      $game_player.turn_up
    end
    # Straighten player position
    $game_player.straighten
    # Update map (run parallel process event)
    $game_map.update
    # Remake sprite set
    @spriteset.dispose
    @spriteset = Spriteset_Map.new
    # If processing transition
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      Graphics.transition(20)
    end
    # Run automatic change for BGM and BGS set on the map
    $game_map.autoplay
    # Frame reset
    Graphics.frame_reset
    # Update input information
    Input.update
  end
end

Finally, add the following into a new script below, all the Window scripts so its below Window_DebugRight or whatever's the last one in that list

Code:
#==============================================================================
# ** Window_Map
#------------------------------------------------------------------------------
#  This window displays HP, SP, Status Effect, a Hero's Face, and Gold
#==============================================================================

class Window_Map < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 220, 130)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.size = 18
    @hp_text = "HP"
    @sp_text = "MP"
    self.contents.draw_text(114, 0, 120, 32, @hp_text.to_s)
    self.contents.draw_text(114, 40, 120, 32, @sp_text.to_s)
    draw_normal_barz(110, 27, "horizontal", 60, 8, $game_actors[1].hp.to_i, $game_actors[1].maxhp.to_i, Color.new (225, 0, 0, 225))
    draw_normal_barz(110, 67, "horizontal", 60, 8, $game_actors[1].sp.to_i, $game_actors[1].maxsp.to_i, Color.new (0,0,255,255))
    face = RPG::Cache.picture("hero_face")
    face2 = Rect.new(0, 0, face.width, face.height)
    self.contents.blt(0, 0, face, face2)
  end
end

class Window_Map2 < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(10, 135, 200, 50)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.size = 18
    self.contents.draw_text(0, -10, 120, 32, "Status:")
    draw_actor_state($game_actors[1], 64, -10)
  end
end

class Window_Map3 < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(440, 430, 200, 50)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.size = 18
    cx = contents.text_size($data_system.words.gold).width
    self.contents.draw_text(75, -10, 120-cx-2, 32, $game_party.gold.to_s, 2)
    self.contents.draw_text(0, -10, cx+12, 32, ($data_system.words.gold + ":"), 2)
  end
end

Oh, and for the face, it needs to be saved as hero_face in the pictures folder.

Here's a screenshot
http://img55.imageshack.us/img55/4329/pictureiv0.th.png[/IMG]

Credits to me for the HUD and AcedentProne for the gradient bars.
 

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