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 A HUD

Status
Not open for further replies.
http://i12.photobucket.com/albums/a229/meismeofcourse/RequestAHUDToday.png[/IMG]


This is a special script request station for HUDs(Heads Up Display). For a short time, I will script HUDs requested one at a time.

No more requests will be accepted from now on.

Current Requests:
MistTribe(Post #23) - Standby(Too vague)
zealex(Post #28) - Standby(Waiting for MistTribe's HUD)

Completed HUDs:
Code:
#==============================================================================
#  ** HUD for Sasame_Kiryu
#   * Made by MeisMe
#     September 2006
#==============================================================================

class Window_MapActor < Window_Base
  def initialize
    super(-16, 272, 672, 224)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.contents_opacity = $game_player.screen_y >= 292 ? 90 : 255
    @wait_count = Graphics.frame_rate * 3
    refresh
  end
  def refresh
    self.contents.clear
    for i in 0...8
      x = (i % 4) * 160
      y = (i / 4) * 96
      bitmap = RPG::Cache.picture('HUD Window')
      self.contents.blt(x, y, bitmap, Rect.new(0, 0, 160, 96))
      x += 4
      actor = $game_party.actors[i]
      if actor
        draw_actor_graphic(actor, x + 12, y + 92)
        draw_actor_state(actor, x, y, 156)
        draw_actor_hp(actor, x, y + 32, 156)
        draw_actor_sp(actor, x, y + 64, 156)
      else
        self.contents.draw_text(x, y + 32, 160, 32, 'No data', 1)
      end
    end
  end
  def update
    super
    if @wait_count == 0
      self.contents_opacity -= 16 if self.contents_opacity > 0
    else
      @wait_count -= 1
      if $game_player.screen_y >= 292
        self.contents_opacity -= 15 if self.contents_opacity > 90
      else
        self.contents_opacity += 15 if self.contents_opacity < 255
      end
    end
  end
end

class Scene_Map
  alias old_main main
  alias old_update update
  def main
    @mapactor_window = Window_MapActor.new
    old_main
    @mapactor_window.dispose
  end
  def update
    @mapactor_window.update
    old_update
  end
end
Required picture:
http://i12.photobucket.com/albums/a229/ ... Holder.png[/IMG]
Code:
#==============================================================================
#  ** HUD for Immortal
#   * Made by MeisMe
#     September 2006
#==============================================================================

#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------
SDK.log("ABS HUD", "MeisMe", 1, "Septemver 2006")

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if (SDK.state("ABS") == true && SDK.state("ABS HUD") == true)

  class Game_Actor
    #--------------------------------------------------------------------------
    # * Get the current EXP
    #--------------------------------------------------------------------------
    def now_exp
      return @level != $data_actors[@actor_id].final_level ? @exp - 
        @exp_list[@level] : 1
    end
    #--------------------------------------------------------------------------
    # * Get the next level's EXP
    #--------------------------------------------------------------------------
    def next_exp
      return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - 
        @exp_list[@level] : 1
    end
  end
  
  class Window_HUD < Window_Base
    def initialize
      super(-16, -16, 672, 128)
      self.contents = Bitmap.new(width - 32, height - 32)
      self.opacity = 0
      self.contents_opacity = $game_player.screen_y <= 112 ? 90 : 255
      self.contents.font.size = 14
      refresh
    end
    def refresh
      reset_variables
      self.contents.clear
      return if !@actor
      draw_actor_graphic(@actor, 16, 64)
      draw_actor_hpbar(@actor, 32, 0, 100, 6)
      draw_actor_spbar(@actor, 32, 24, 100, 6)
      draw_actor_expbar(@actor, 32, 48, 100, 6)
      bitmap = RPG::Cache.picture('Skill Holder')
      self.contents.blt(320, 0, bitmap, Rect.new(0, 0, 320, 32))
      for i in 0...$ABS.skills.size
        next if !$ABS.skills[i]
        if i == 0
          x = 608
        else
          x = (i - 1) * 32 + 320
        end
        y = 0
        skill = $data_skills[$ABS.skills[i]]
        bitmap = RPG::Cache.icon(skill.icon_name)
        self.contents.blt(x + 5, y + 5, bitmap, Rect.new(0, 0, 24, 24))
      end
    end
    def reset_variables
      @actor = $game_party.actors[0]
      @skills = $ABS.skills
      @old_hp = @actor ? @actor.hp : 0
      @old_mhp = @actor ? @actor.maxhp : 0
      @old_sp = @actor ? @actor.sp : 0
      @old_msp = @actor ? @actor.maxsp : 0
      @old_exp = @actor ? @actor.now_exp : 0
      @old_nextexp = @actor ? @actor.next_exp : 0
    end
    def draw_actor_hpbar(actor, x, y, length, height)
      percent = actor.hp * length / actor.maxhp
      self.contents.fill_rect(x, y + 14, length + 2, height + 2, 
        Color.new(255, 246, 229))
      self.contents.fill_rect(x + 1, y + 15, length, height,
        Color.new(0, 0, 0))
      self.contents.fill_rect(x + 1, y + 15, percent, height, 
        Color.new(200, 0, 0))
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 32, 16, $data_system.words.hp)
      self.contents.font.color = normal_color
      text = "#{actor.hp}/#{actor.maxhp}"
      self.contents.draw_text(x, y, length + 2, 16, text, 2)
    end
    def draw_actor_spbar(actor, x, y, length, height)
      percent = actor.sp * length / actor.maxsp
      self.contents.fill_rect(x, y + 14, length + 2, height + 2, 
        Color.new(255, 246, 229))
      self.contents.fill_rect(x + 1, y + 15, length, height,
        Color.new(0, 0, 0))
      self.contents.fill_rect(x + 1, y + 15, percent, height, 
        Color.new(0, 0, 200))
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 32, 16, $data_system.words.sp)
      self.contents.font.color = normal_color
      text = "#{actor.sp}/#{actor.maxsp}"
      self.contents.draw_text(x, y, length + 2, 16, text, 2)
    end
    def draw_actor_expbar(actor, x, y, length, height)
      percent = actor.now_exp * length / actor.next_exp
      self.contents.fill_rect(x, y + 14, length + 2, height + 2, 
        Color.new(255, 246, 229))
      self.contents.fill_rect(x + 1, y + 15, length, height,
        Color.new(0, 0, 0))
      self.contents.fill_rect(x + 1, y + 15, percent, height, 
        Color.new(0, 200, 0))
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 32, 16, 'EXP')
      self.contents.font.color = normal_color
      text = "#{actor.now_exp}/#{actor.next_exp}"
      self.contents.draw_text(x, y, length + 2, 16, text, 2)
    end
    def update
      super
      refresh if state_change?
      if $game_player.screen_y <= 112
        self.contents_opacity -= 15 if self.contents_opacity > 90
      else
        self.contents_opacity += 15 if self.contents_opacity < 255
      end
    end
    def state_change?
      if (@actor != $game_party.actors[0] or
          @skills != $ABS.skills or
          @old_hp != @actor ? @actor.hp : 0 or
          @old_mhp != @actor ? @actor.maxhp : 0 or
          @old_sp != @actor ? @actor.sp : 0 or
          @old_msp != @actor ? @actor.maxsp : 0 or
          @old_exp != @actor ? @actor.now_exp : 0 or
          @old_nextexp = @actor ? @actor.next_exp : 0)
        return true
      end
      return false
    end
  end
  
  class Scene_Map
    alias hud_main_draw main_draw
    def main_draw
      @HUD = Window_HUD.new
      hud_main_draw
    end
    alias hud_update_graphics update_graphics
    def update_graphics
      @HUD.update
      hud_update_graphics
    end
  end
  
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
Required Picture:
http://i12.photobucket.com/albums/a229/ ... eonHUD.png[/img]
Code:
#==============================================================================
#  ** HUD for Deon204
#   * Scripted by MeisMe
#     September 2006
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Get the current EXP
  #--------------------------------------------------------------------------
  def now_exp
    return @level != $data_actors[@actor_id].final_level ? @exp - 
      @exp_list[@level] : 1
  end
  #--------------------------------------------------------------------------
  # * Get the next level's EXP
  #--------------------------------------------------------------------------
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - 
      @exp_list[@level] : 1
  end
end

class Window_HUDMain < Window_Base
  def initialize
    super(-16, 358, 672, 138)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.contents.font.size = 16
    if (($game_player.screen_y >= 368 && $game_player.screen_x <= 288) ||
        ($game_player.screen_y >= 400 && $game_player.screen_x >= 480))
      self.contents_opacity = 90
    end
    refresh
  end
  def refresh
    reset_variables
    self.contents.clear
    background = RPG::Cache.picture('DeonHUD')
    self.contents.blt(0, 0, background, Rect.new(0, 0, 640, 106))
    if @actor
      bitmap = RPG::Cache.hudface(@actor.name)
      self.contents.blt(17, 15, bitmap, Rect.new(0, 0, 61, 74))
      draw_actor_hpbar(@actor, 85, 32, 75, 9)
      draw_actor_spbar(@actor, 85, 74, 75, 9)
      self.contents.draw_text(81, 5, 21, 27, $data_system.words.hp)
      text = "#{@actor.hp}/#{@actor.maxhp}"
      self.contents.draw_text(100, 5, 60, 27, text, 2)
      self.contents.draw_text(81, 47, 21, 27, $data_system.words.sp)
      text = "#{@actor.sp}/#{@actor.maxsp}"
      self.contents.draw_text(100, 47, 60, 27, text, 2)
      self.contents.draw_text(176, 15, 40, 27, 'Time:')
      self.contents.draw_text(176, 67, 40, 27, 'Status:')
      self.contents.draw_text(494, 39, 40, 27, $data_system.words.gold + ':')
      self.contents.draw_text(494, 39, 138, 27, @gold.to_s, 2)
      self.contents.draw_text(494, 77, 40, 24, 'EXP:')
      text = "#{@actor.now_exp}/#{@actor.next_exp}"
      self.contents.draw_text(494, 77, 138, 24, text, 2)
    end
  end
  def reset_variables
    @actor = $game_party.actors[0]
    @gold = $game_party.gold
    @hp = @actor ? @actor.hp : 0
    @mhp = @actor ? @actor.maxhp : 0
    @sp = @actor ? @actor.sp : 0
    @msp = @actor ? @actor.maxsp : 0
    @nowexp = @actor ? @actor.now_exp : 0
    @nextexp = @actor ? @actor.next_exp : 0
  end
  def draw_actor_hpbar(actor, x, y, width, height)
    percent = actor.hp * (width - 4) / actor.maxhp
    self.contents.fill_rect(x, y, width, height, Color.new(0, 0, 0))
    self.contents.fill_rect(x + 2, y + 2, percent, height - 4,
      Color.new(255, 0, 0))
  end
  def draw_actor_spbar(actor, x, y, width, height)
    percent = actor.sp * (width - 4) / actor.maxsp
    self.contents.fill_rect(x, y, width, height, Color.new(0, 0, 0))
    self.contents.fill_rect(x + 2, y + 2, percent, height - 4,
      Color.new(0, 0, 255))
  end
  def update
    super
    if (@actor != $game_party.actors[0] or
        @gold != $game_party.gold or
        @hp != @actor ? @actor.hp : 0 or
        @mhp != @actor ? @actor.maxhp : 0 or
        @sp != @actor ? @actor.sp : 0 or
        @msp != @actor ? @actor.maxsp : 0 or
        @nowexp != @actor ? @actor.now_exp : 0 or
        @nextexp != @actor ? @actor.next_exp : 0)
      refresh
    end
    if (($game_player.screen_y >= 368 && $game_player.screen_x <= 288) ||
        ($game_player.screen_y >= 400 && $game_player.screen_x >= 480))
      self.contents_opacity -= 15 if self.contents_opacity > 90
    else
      self.contents_opacity += 15 if self.contents_opacity < 255
    end
  end
end

class Window_HUDTS < Window_Base
  def initialize
    super(-16, 358, 672, 138)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.contents.font.size = 16
    @blink = 0
    if (($game_player.screen_y >= 368 && $game_player.screen_x <= 288) ||
        ($game_player.screen_y >= 400 && $game_player.screen_x >= 480))
      self.contents_opacity = 90
    end
    refresh
  end
  def refresh
    reset_variables
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(176, 15, 96, 27, @time, 2)
    self.contents.font.color = status_color
    text = @state ? $data_states[@state].name : 'Normal'
    self.contents.draw_text(176, 67, 96, 27, text, 2)
  end
  def reset_variables
    @actor = $game_party.actors[0]
    @time = $ats.clock
    @state = @actor ? @actor.states[0] : ''
  end
  def status_color
    case @state
    when 1
      return Color.new(255, 0, 0)
    when 2
      return Color.new(255, 0, 255)
    when 3
      return Color.new(160, 160, 160)
    when 4
      if @blink > 5
        return Color.new(255, 255, 255)
      else
        return Color.new(160, 160, 160)
      end
    when 5
      return Color.new(255, 255, 0)
    when 6
      return Color.new(160, 0, 0)
    end
    return Color.new(0, 255, 0)
  end
  def update
    super
    if (@actor != $game_party.actors[0] or
        @time != $ats.clock or
        @state != @actor ? @actor.states[@actor.states.size - 1] : '')
      refresh
    end
    if @state == 4
      @blink = (@blink + 1) % 10
      refresh if @blink == 0 or @blink == 5
    else
      @blink = 0
    end
    if (($game_player.screen_y >= 368 && $game_player.screen_x <= 288) ||
        ($game_player.screen_y >= 400 && $game_player.screen_x >= 480))
      self.contents_opacity -= 15 if self.contents_opacity > 90
    else
      self.contents_opacity += 15 if self.contents_opacity < 255
    end
  end
end

class Scene_Map
  alias hud_main main
  alias hud_update update
  def main
    @HUD = Window_HUDMain.new
    @HUD2 = Window_HUDTS.new
    hud_main
    @HUD.dispose
    @HUD2.dispose
  end
  def update
    @HUD.update
    @HUD2.update
    hud_update
  end
end

module RPG
  module Cache
    def self.hudface(filename)
      self.load_bitmap("Graphics/Characters/Hudface/", filename)
    end
  end
end
Sent by PM on a special request. HUD will be availiable from his Zombie Starter Pack
Code:
#==============================================================================
#  ** HUD for Zavoria
#   * Scripted by MeisMe
#     September 2006
#==============================================================================

class Game_Player
  attr_reader :sanity
  def initialize
    super
    @sanity = 100
    @frame_count = 0
  end
  def increase_steps
    super
    # If move route is not forcing
    unless @move_route_forcing
      # Increase steps
      $game_party.increase_steps
      # Number of steps are an even number
      if $game_party.steps % 2 == 0
        # Slip damage check
        $game_party.check_map_slip_damage
        @sanity -= 2 if @sanity > 0
        @sanity = 0 if @sanity < 0
      end
    end
  end
  def update
    @frame_count += 1
    # Remember whether or not moving in local variables
    last_moving = moving?
    # If moving, event running, move route forcing, and message window
    # display are all not occurring
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
      if (@frame_count % (Graphics.frame_rate / 2) == 0) && (@sanity < 100)
        @sanity += 1
      end
      # Move player in the direction the directional button is being pressed
      case Input.dir4
      when 2
        if @sanity != 0
          move_down
          @frame_count = 0
        end
      when 4
        if @sanity != 0
          move_left
          @frame_count = 0
        end
      when 6
        if @sanity != 0
          move_right
          @frame_count = 0
        end
      when 8
        if @sanity != 0
          move_up
          @frame_count = 0
        end
      end
    end
    # Remember coordinates in local variables
    last_real_x = @real_x
    last_real_y = @real_y
    super
    # If character moves down and is positioned lower than the center
    # of the screen
    if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
      # Scroll map down
      $game_map.scroll_down(@real_y - last_real_y)
    end
    # If character moves left and is positioned more let on-screen than
    # center
    if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
      # Scroll map left
      $game_map.scroll_left(last_real_x - @real_x)
    end
    # If character moves right and is positioned more right on-screen than
    # center
    if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
      # Scroll map right
      $game_map.scroll_right(@real_x - last_real_x)
    end
    # If character moves up and is positioned higher than the center
    # of the screen
    if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
      # Scroll map up
      $game_map.scroll_up(last_real_y - @real_y)
    end
    # If not moving
    unless moving?
      # If player was moving last time
      if last_moving
        # Event determinant is via touch of same position event
        result = check_event_trigger_here([1,2])
        # If event which started does not exist
        if result == false
          # Disregard if debug mode is ON and ctrl key was pressed
          unless $DEBUG and Input.press?(Input::CTRL)
            # Encounter countdown
            if @encounter_count > 0
              @encounter_count -= 1
            end
          end
        end
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Same position and front event determinant
        check_event_trigger_here([0])
        check_event_trigger_there([0,1,2])
      end
    end
  end    
  def update_sanity?
  end
end

class Window_HUD < Window_Base
  def initialize
    super(-16, -16, 128, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.size = 18
    self.opacity = 0
    refresh
  end
  def refresh
    reset_variables
    self.contents.clear
    self.contents.draw_text(5, 0, 64, 32, $data_system.words.hp)
    self.contents.draw_text(5, 32, 64, 32, 'Sanity')
    self.contents.fill_rect(5, 24, 64, 4, Color.new(0, 0, 0))
    p = @hp * 64 / @mhp
    self.contents.fill_rect(5, 24, p, 4, Color.new(255, 0, 0))
    self.contents.fill_rect(5, 56, 64, 4, Color.new(0, 0, 0))
    p = @sanity * 64 / 100
    self.contents.fill_rect(5, 56, p, 4, Color.new(128, 0, 128))
    draw_actor_graphic(@actor, 84, 64)
  end
  def reset_variables
    @actor = $game_party.actors[0]
    @hp = @actor ? @actor.hp : 0
    @mhp = @actor ? @actor.maxhp : 0
    @sanity = $game_player.sanity
  end
  def update
    super
    if (@actor = $game_party.actors[0] or
        @hp = @actor ? @actor.hp : 0 or
        @mhp = @actor ? @actor.maxhp : 0 or
        @sanity = $game_player.sanity)
      refresh
    end
  end
end

class Scene_Map
  alias hud_main main
  alias hud_update update
  def main
    @HUD = Window_HUD.new
    hud_main
    @HUD.dispose
  end
  def update
    @HUD.update
    hud_update
  end
end
Too vague of a description
Code:
#---------------
# Skills Window
#---------------
class Window_HudSkills < Window_Base
  def initialize
    super(8, 8, 80, 285)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 180
    self.opacity = 0
    refresh
  end
  def refresh
    self.contents.clear
    @bitmap1 = RPG::Cache.picture("skillsback.png")
    self.contents.blt(0, 0, @bitmap1, Rect.new(0, 0, @bitmap1.width, 
                      @bitmap1.height))
    @bitmap2 = RPG::Cache.picture("skillnums.png")
    self.contents.blt(0, 0, @bitmap2, Rect.new(0, 0, @bitmap2.width, 
                      @bitmap2.height))
    for i in 1..5
      next if !$ABS.skills[i]
      x = 12
      y = 12 + (i * 27)
      skill = $data_skills[$ABS.skills[i]]
      bitmap = RPG::Cache.icon(skill.icon_name)
      self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
    end
  end
end

Please note that ALL HUds that I make will be open source. Feel free to make edits to them as you please, as long as you credit the original version. If you don't like this, go and make your own HUD!
 
I wanted to make a request please.. I can't provide a picture because there really isnt one.. I just wanted a HUD for a mech game.. Like show the damage lvl with like shield bars in the lower right corner and I wanted the HUD to look sort of like a cockpit.. Im using SDK and Im using Prexus's ABS..
 
Hi,
This isn't er... a Hud request as such, just a part of a Hud. I've been searching for ages to have a way of showing the abs skills in my Hud (alas, everyone has copied my idea...) but I can't work out how to do it. I saw one of the Huds up there has it done, I tried looking in there to see what I needed to put but couldn't find it. (I was gonna give credit :/ ) Anyway, this is the window I have:

Code:
#---------------
# Skills Window
#---------------
class Window_HudSkills < Window_Base
  def initialize
    super(8, 8, 80, 285)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 180
    self.opacity = 0
    refresh
  end
  def refresh
    self.contents.clear
    @bitmap1 = RPG::Cache.picture("skillsback.png")
    self.contents.blt(0, 0, @bitmap1, Rect.new(0, 0, @bitmap1.width, @bitmap1.height), 255)
    @bitmap2 = RPG::Cache.picture("skillnums.png")
    self.contents.blt(0, 0, @bitmap2, Rect.new(0, 0, @bitmap2.width, @bitmap2.height), 255)
  end
end

I basically need the icons for the ABS skills going downwards (I only have 5 skills in mine through an edit) I need them starting at (12, 12) going down with a gap of 27 between each one.

Thanks if you do this.

The images are:

http://img.photobucket.com/albums/v108/ ... lsback.png[/img] http://img.photobucket.com/albums/v108/ ... llnums.png[/img]
 

$t3v0

Awesome Bro

Yesterday, 03:36 AM

Deon's HUD is up. Tomorrow afterschool, I'll start on $t3v0's.

Today, 03:20 AM


Did you make a start on it, Meis?

I didn't see anything posted from Meisme since he said that, do you?
 
Hello, i would also like a HUD please :)

This is what it should look like: (made it with paint..just for example how it should look like, so actually it should look a bit more stylish :D not like "made in paint" i hope u know what i mean ;))

http://img180.imageshack.us/img180/471/bnxw1.png[/IMG]

the pic says almost everything. and i dont want it to be very big, normal size :)

I'm using SDK, and Netplay+, and some more scripts, i hope they dont mess something up... ;)

thanks in advance, I'll be waiting :D
 
It's a special variable, becuse in the game the bad guys are trying to make your charcter go insane. When you stop walking the bar fills up 1% at a time every second. So ecery two steps the bar decreases by three.;) If you need anymore info just say so.
 
hi..

Uhm...I want to request a PART of a HUD

What i need is the Function, to save an Item ID into a variable. BUT, that should work in the Item-Menü, like this:

The player want´s to set a Hotkey. To do this, he opens my Item-menü, and choses the Item. But, to confirm, he doesn´t press Enter... He presses "E" or "R".
These two letters are the Hotkeys.

Here are the Scripts, you have to use..Because i edited them:
# Edit by Monsta 20.7.2006 #
# Edit by --==SLB==-- 23.7.2006 #
# (Auswahlfenster nicht Anzeigen) #

class Scene_Item
def main
@help_window = Window_Help.new
@item_window = Window_Item.new
@sprite = Spriteset_Map.new
@item_window.help_window = @help_window
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@item_window.dispose
@sprite.dispose
@target_window.dispose
end

def update
@help_window.update
@item_window.update
@target_window.update
if @item_window.active
update_item
return
end
if @target_window.active
update_target
return
end
end

def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.buzzer_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
@item = @item_window.item
unless @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @item.scope >= 3
@item_window.active = false
@target_window.active = true
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
$scene = Scene_Map.new
return
end
end
return
end
end

def update_target
if $game_party.item_number(@item.id) == 0
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
if used
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
@item_window.refresh
end
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
$scene = Scene_Item.new
return
end
$scene = Scene_Map.new
return
end
end

class Window_Item < Window_Selectable
def initialize
super(20, 290, 600, 190)
@column_max = 2
self.back_opacity = 190
self.z = 9999
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 190
end
end

def item
return @data[self.index]
end

def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items)
end
end
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons)
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors)
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end

def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 190, y, 16, 32, ":", 1)
self.contents.draw_text(x + 206, y, 24, 32, number.to_s, 2)
end

def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end


These two Scripts make, If the Player confirms an Item, he cannot choose a Charakter ( it´s a One player Item menu )

Here´s the Keyboard Skript i use:
#======================================
# â–  Keyboard Script
#---------------------------------------------------------------------------
#  By: Cybersam
# Date: 25/05/05
# Version 4
#======================================

module Kboard
#--------------------------------------------------------------------------
$RMouse_BUTTON_L = 0x01 # left mouse button
$RMouse_BUTTON_R = 0x02 # right mouse button
$RMouse_BUTTON_M = 0x04 # middle mouse button
$RMouse_BUTTON_4 = 0x05 # 4th mouse button
$RMouse_BUTTON_5 = 0x06 # 5th mouse button
#--------------------------------------------------------------------------
$R_Key_BACK = 0x08 # BACKSPACE key
$R_Key_TAB = 0x09 # TAB key
$R_Key_RETURN = 0x0D # ENTER key
$R_Key_SHIFT = 0x10 # SHIFT key
$R_Key_CTLR = 0x11 # CTLR key
$R_Key_ALT = 0x12 # ALT key
$R_Key_PAUSE = 0x13 # PAUSE key
$R_Key_CAPITAL = 0x14 # CAPS LOCK key
$R_Key_ESCAPE = 0x1B # ESC key
$R_Key_SPACE = 0x20 # SPACEBAR
$R_Key_PRIOR = 0x21 # PAGE UP key
$R_Key_NEXT = 0x22 # PAGE DOWN key
$R_Key_END = 0x23 # END key
$R_Key_HOME = 0x24 # HOME key
$R_Key_LEFT = 0x25 # LEFT ARROW key
$R_Key_UP = 0x26 # UP ARROW key
$R_Key_RIGHT = 0x27 # RIGHT ARROW key
$R_Key_DOWN = 0x28 # DOWN ARROW key
$R_Key_SELECT = 0x29 # SELECT key
$R_Key_PRINT = 0x2A # PRINT key
$R_Key_SNAPSHOT = 0x2C # PRINT SCREEN key
$R_Key_INSERT = 0x2D # INS key
$R_Key_DELETE = 0x2E # DEL key
#--------------------------------------------------------------------------
$R_Key_0 = 0x30 # 0 key
$R_Key_1 = 0x31 # 1 key
$R_Key_2 = 0x32 # 2 key
$R_Key_3 = 0x33 # 3 key
$R_Key_4 = 0x34 # 4 key
$R_Key_5 = 0x35 # 5 key
$R_Key_6 = 0x36 # 6 key
$R_Key_7 = 0x37 # 7 key
$R_Key_8 = 0x38 # 8 key
$R_Key_9 = 0x39 # 9 key
#--------------------------------------------------------------------------
$R_Key_A = 0x41 # A key
$R_Key_B = 0x42 # B key
$R_Key_C = 0x43 # C key
$R_Key_D = 0x44 # D key
$R_Key_E = 0x45 # E key
$R_Key_F = 0x46 # F key
$R_Key_G = 0x47 # G key
$R_Key_H = 0x48 # H key
$R_Key_I = 0x49 # I key
$R_Key_J = 0x4A # J key
$R_Key_K = 0x4B # K key
$R_Key_L = 0x4C # L key
$R_Key_M = 0x4D # M key
$R_Key_N = 0x4E # N key
$R_Key_O = 0x4F # O key
$R_Key_P = 0x50 # P key
$R_Key_Q = 0x51 # Q key
$R_Key_R = 0x52 # R key
$R_Key_S = 0x53 # S key
$R_Key_T = 0x54 # T key
$R_Key_U = 0x55 # U key
$R_Key_V = 0x56 # V key
$R_Key_W = 0x57 # W key
$R_Key_X = 0x58 # X key
$R_Key_Y = 0x59 # Y key
$R_Key_Z = 0x5A # Z key
#--------------------------------------------------------------------------
$R_Key_LWIN = 0x5B # Left Windows key (Microsoft Natural keyboard)
$R_Key_RWIN = 0x5C # Right Windows key (Natural keyboard)
$R_Key_APPS = 0x5D # Applications key (Natural keyboard)
#--------------------------------------------------------------------------
$R_Key_NUMPAD0 = 0x60 # Numeric keypad 0 key
$R_Key_NUMPAD1 = 0x61 # Numeric keypad 1 key
$R_Key_NUMPAD2 = 0x62 # Numeric keypad 2 key
$R_Key_NUMPAD3 = 0x63 # Numeric keypad 3 key
$R_Key_NUMPAD4 = 0x64 # Numeric keypad 4 key
$R_Key_NUMPAD5 = 0x65 # Numeric keypad 5 key
$R_Key_NUMPAD6 = 0x66 # Numeric keypad 6 key
$R_Key_NUMPAD7 = 0x67 # Numeric keypad 7 key
$R_Key_NUMPAD8 = 0x68 # Numeric keypad 8 key
$R_Key_NUMPAD9 = 0x69 # Numeric keypad 9 key
$R_Key_MULTIPLY = 0x6A # Multiply key (*)
$R_Key_ADD = 0x6B # Add key (+)
$R_Key_SEPARATOR = 0x6C # Separator key
$R_Key_SUBTRACT = 0x6D # Subtract key (-)
$R_Key_DECIMAL = 0x6E # Decimal key
$R_Key_DIVIDE = 0x6F # Divide key (/)
#--------------------------------------------------------------------------
$R_Key_F1 = 0x70 # F1 key
$R_Key_F2 = 0x71 # F2 key
$R_Key_F3 = 0x72 # F3 key
$R_Key_F4 = 0x73 # F4 key
$R_Key_F5 = 0x74 # F5 key
$R_Key_F6 = 0x75 # F6 key
$R_Key_F7 = 0x76 # F7 key
$R_Key_F8 = 0x77 # F8 key
$R_Key_F9 = 0x78 # F9 key
$R_Key_F10 = 0x79 # F10 key
$R_Key_F11 = 0x7A # F11 key
$R_Key_F12 = 0x7B # F12 key
#--------------------------------------------------------------------------
$R_Key_NUMLOCK = 0x90 # NUM LOCK key
$R_Key_SCROLL = 0x91 # SCROLL LOCK key
#--------------------------------------------------------------------------
$R_Key_LSHIFT = 0xA0 # Left SHIFT key
$R_Key_RSHIFT = 0xA1 # Right SHIFT key
$R_Key_LCONTROL = 0xA2 # Left CONTROL key
$R_Key_RCONTROL = 0xA3 # Right CONTROL key
$R_Key_L_ALT = 0xA4 # Left ALT key
$R_Key_R_ALT = 0xA5 # Right ALT key
#--------------------------------------------------------------------------
$R_Key_SEP = 0xBC # , key
$R_Key_DASH = 0xBD # - key
$R_Key_DOTT = 0xBE # . key
#--------------------------------------------------------------------------
GetKeyState = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
GetKeyboardState = Win32API.new("user32","GetKeyState",['i'],'i')
GetSetKeyState = Win32API.new("user32","SetKeyboardState",['i'],'i')
#--------------------------------------------------------------------------
module_function
#--------------------------------------------------------------------------
def keyb(rkey)
if GetKeyState.call(rkey) != 0
return 1
end
return 0
end
#--------------------------------------------------------------------------
def keyboard(rkey)
GetKeyState.call(rkey) & 0x01 == 1 #
end
#--------------------------------------------------------------------------
def key(rkey, key = 0)
GetKeyboardState.call(rkey) & 0x01 == key #
end
end



What should happen?

If the player set the Cursor over an Item with the Element named "Hot":
- And he presses "E", the variable[148] must set to the items´ -ID.
- And he presses "R", the variable[149] must set to the items´ -ID.





Hope you can help me to finish my HUD completely... A Big fat and 640x480 animated Credit Entri is my thanks to you....thx



*RmXP Rocks*
 
Status
Not open for further replies.

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