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.

Vampyr SBABS 12

Sorry for the double post but 2 scripts for some reason wouldn't fit and it would cut off. This is yet ANOTHER one of my scripts and is complet plug and play! It draws the normal MP and HP bars also including numbers. see picture below.

http://i281.photobucket.com/albums/kk22 ... eofHUD.jpg[/img]

It is also compatable with COGS custom bars.

Here's the script... Simply replace your normal HUD script with this one!


Necro_100000's Classic Number Display Addon

#==============================================================================
# Necro_100000's Classic Number Display Script
#
# Version 1.0
#==============================================================================
module Crissaegrim_Hud

Background = "HUD-Background" # Imagem de fundo da hud
 
# This part dosn't even matter any more... Just simply make sure you have the
# Pictures in your think to avoid glitches.

HP_Bar = "HP-Bar" # Imagem da barra de HP

MP_Bar = "MP-Bar" # Imagem da barra de MP

Base = "Bars-Base" # Imagm do fundo das barras

OnOff_Hud_Switch = 1 # Switch que ativa / desativa a HUD

Show_Hide_Button = Input::Tab # Tecla que mostra / esconde a HUD

end
#------------------------------------------------------------------------------
class Window_CrissaegrimHud < Window_Base
  def initialize
    super(0,0,544,416)
    self.opacity = 0
  end
  def update
    @actor = $game_party.members[0]
    self.contents.font.size = 16
    self.contents.clear
    skill_count = 0
    if Crissaegrim_ABS::Skill_Button[@actor.id] != nil
      for button in Crissaegrim_ABS::Skill_Button[@actor.id].keys
        next if button == nil
        x = 432
        skill = $data_skills[Crissaegrim_ABS::Skill_Button[@actor.id][button]]
        next if skill == nil
        show_icon(skill, (29 * skill_count) + x, 0)
        skill_count += 1
      end
    end
    item_count = 0
    for btn in Crissaegrim_ABS::Item_Button.keys
      next if btn == nil
      item = $data_items[Crissaegrim_ABS::Item_Button[btn]]
      next if item == nil
      x = 432
      show_icon(item, (29 * item_count) + x, 356)
      item_count += 1
      self.contents.font.size = 18
      self.contents.font.color = text_color(15)
      self.contents.draw_text((29 * item_count) + x-32, 364, 32, 28, $game_party.item_number(item),1)
      self.contents.font.size = 16
      self.contents.font.color = text_color(0)
      self.contents.draw_text((29 * item_count) + x-32, 365, 32, 28, $game_party.item_number(item),1)
    end
    refresh
  end
  def refresh
    actor = $game_party.members[0]
    draw_actor_hp(@actor, 0, 0)
    draw_actor_mp(@actor, 0, 24)
    show_state(@actor, 130, 0)
    if Crissaegrim_ABS::Distance_Weapons.has_key?(@actor.weapon_id)
      if Crissaegrim_ABS::Distance_Weapons[@actor.weapon_id][5] > 0
        show_icon($data_items[Crissaegrim_ABS::Distance_Weapons[@actor.weapon_id][5]], 0, 356)
        self.contents.font.size = 18
        self.contents.font.color = text_color(15)
        self.contents.draw_text(-3, 364, 24, 28, $game_party.item_number($data_items[Crissaegrim_ABS::Distance_Weapons[@actor.weapon_id][5]]),1)
        self.contents.font.size = 16
        self.contents.font.color = text_color(0)
        self.contents.draw_text(-2, 365, 24, 28, $game_party.item_number($data_items[Crissaegrim_ABS::Distance_Weapons[@actor.weapon_id][5]]),1)
      end
      if Crissaegrim_ABS::Distance_Weapons[@actor.weapon_id][6] > 0
        show_icon($data_items[Crissaegrim_ABS::Distance_Weapons[@actor.weapon_id][6]], 44, 356)
        self.contents.font.size = 18
        self.contents.font.color = text_color(15)
        self.contents.draw_text(43, 364, 24, 28, $game_party.item_number($data_items[Crissaegrim_ABS::Distance_Weapons[@actor.weapon_id][6]]),1)
        self.contents.font.size = 16
        self.contents.font.color = text_color(0)
        self.contents.draw_text(44, 365, 24, 28, $game_party.item_number($data_items[Crissaegrim_ABS::Distance_Weapons[@actor.weapon_id][6]]),1)
      end
    end
  end
  def show_state(actor, x, y)
    count = 0
    for state in actor.states
      draw_icon(state.icon_index, x, y + 24 * count)
      count += 1
      break if (24 * count > 76)
    end
  end
  def show_icon(item, x, y)
    if item != nil
      draw_icon(item.icon_index, x, y)
    end
  end
  def draw_hp(actor, x, y)
    back = Cache.system(Crissaegrim_Hud::Base)
    cw = back.width
    ch = back.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x, y-ch+24, back, src_rect)
    meter = Cache.system(Crissaegrim_Hud::HP_Bar)
    cw = meter.width  * actor.hp / actor.maxhp
    ch = meter.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x+5, y-ch+17, meter, src_rect)
  end 
  def draw_mp(actor, x, y)
    back = Cache.system(Crissaegrim_Hud::Base)   
    cw = back.width
    ch = back.height
    src_rect = Rect.new(0, 0, cw, ch)   
    self.contents.blt(x, y-ch+24, back, src_rect)
    meter = Cache.system(Crissaegrim_Hud::MP_Bar)   
    cw = meter.width  * actor.mp / actor.maxmp
    ch = meter.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x+5, y-ch+17, meter, src_rect)
  end
end

#------------------------------------------------------------------------------
class Scene_Map
  alias crissaegrim_abs_hud_start start
  alias crissaegrim_abs_hud_update update
  alias crissaegrim_abs_hud_terminate terminate
  def start
    crissaegrim_abs_hud_start
    if Crissaegrim_Hud::Background != ""
      @bg = Sprite.new
      @bg.bitmap = Cache.system(Crissaegrim_Hud::Background)
    end
    @hud = Window_CrissaegrimHud.new
    showing_hud
    @show = true
  end
  def update
    crissaegrim_abs_hud_update
    @bg.update if Crissaegrim_Hud::Background != ""
    @hud.update
    showing_hud
  end
  def terminate
    crissaegrim_abs_hud_terminate
    @bg.dispose if Crissaegrim_Hud::Background != ""
    @hud.dispose
  end
  def showing_hud
    if Input.trigger?(Crissaegrim_Hud::Show_Hide_Button)
      if @show == true
        @show = false
      else
        @show = true
      end
    end
    if Crissaegrim_Hud::OnOff_Hud_Switch == 0 or $game_switches[Crissaegrim_Hud::OnOff_Hud_Switch] == true
      if @show == true
        @hud.visible = true
        @bg.visible = true if Crissaegrim_Hud::Background != ""
      elsif @show == false
        @hud.visible = false
        @bg.visible = false if Crissaegrim_Hud::Background != ""
      end
    else
      @hud.visible = false
      @bg.visible = false if Crissaegrim_Hud::Background != ""
    end
  end
end

-Necro_100000

Satasfying your ABS Needs.
 
Glad I could help. If you want a script that changes the color of the bars just give me,

Color,
Style, (I.E. Gradianted and slanted ends)
Size,
and placement.
 
Ya... I'm not realy offering much help with this script anymore... My version of it is done and not manypeople want my help. I'll leave my script edits here for all who wish to use them!

If you have issues with them, post a line at my Script help forum and I'll get them back up for ya.'


Glad I could help anyone I did

-Necro_100000
 
class Window_CrissaegrimHud < Window_Base
  def initialize
    super(0,0,544,416)
    self.opacity = 0
  end
   def update
     self.contents.font.size = 16
     self.contents.clear

try looking for the start of class window_crissaegrimHUD and replace the first few lines with this. You might have it so the self.opacity is messed up. Again, I offer some help for this but I'v realy moved on to working on my own time... Hard to work and post stuff here at the same time.


http://dark-crissaegrim.spaces.live.com/

you can get the SBABS there. Not going to do any work on it though...
 

anakol

Member

im using the ABS script fot a little game i am making and anytime i add a character ot the party, the game shuts down and this happens :

Script 'Crissaegrim ABS line 458 NoMethodError occured.
undefined method 'dead?' for nil: NilClass.

and line 458 says 'return if ally.dead?'

does anyone know how to fix this?

also, i need help making a boss battle scene..how do i make the boss HUD appear for the boss fight, then disappear when its over?

also, its the ABS script used for SBABS
 
My HUD is acting a little funny. My BG is moved to the right one pixel and down one pixel. Screen:
http://www.mundanescorner.com/HUDerror.jpg[/img]

The top left corner is the best example of it...

I have modified the HUD script slightly to remove the ammunition section. Here is my updated script:
Code:
#==============================================================================
# Window Hud
#==============================================================================
module Crissaegrim_Hud
  
Background = "HUD-Background" # Image name for HUD background

HP_Bar = "HP-Bar" # HP bar image name

MP_Bar = "MP-Bar" # MP bar image name

Base = "Bars-Base" # Image name for bar backgrounds

OnOff_Hud_Switch = 1 # HUD Control Switch ID

Show_Hide_Button = Input::Letters["H"] # Key for HUD control

end
#------------------------------------------------------------------------------
class Window_CrissaegrimHud < Window_Base
  def initialize
    super(0,0,544,416)
    self.opacity = 0
  end
   def update
     self.contents.font.size = 16
     self.contents.clear
skill_count = 0
for button in Crissaegrim_ABS::Skill_Button.keys
  next if button == nil
  x = 432
  skill = $data_skills[Crissaegrim_ABS::Skill_Button[button]]
  next if skill == nil
  show_icon(skill, (29 * skill_count) + x, 0)
  skill_count += 1
end
item_count = 0
for btn in Crissaegrim_ABS::Item_Button.keys
  next if btn == nil
  item = $data_items[Crissaegrim_ABS::Item_Button[btn]]
  next if item == nil
  x = 432
  show_icon(item, (29 * item_count) + x, 356)
  item_count += 1
  self.contents.font.size = 18
  self.contents.font.color = text_color(15)
  self.contents.draw_text((29 * item_count) + x-32, 364, 32, 28, $game_party.item_number(item),1)
  self.contents.font.size = 16
  self.contents.font.color = text_color(0)
  self.contents.draw_text((29 * item_count) + x-32, 365, 32, 28, $game_party.item_number(item),1)
end
refresh
end
def refresh
  actor = $game_party.members[0]
  draw_hp(actor, 0, 0)
  draw_mp(actor, 0, 24)
  show_state(actor, 130, 0)
end
end
def show_state(actor, x, y)
  count = 0
  for state in actor.states
    draw_icon(state.icon_index, x, y + 24 * count)
    count += 1
    break if (24 * count > 76)
  end
end
def show_icon(item, x, y)
  if item != nil
    draw_icon(item.icon_index, x, y)
  end
end
def draw_hp(actor, x, y)
  back = Cache.system(Crissaegrim_Hud::Base)
  cw = back.width
  ch = back.height
  src_rect = Rect.new(0, 0, cw, ch)
  self.contents.blt(x, y-ch+24, back, src_rect)
  meter = Cache.system(Crissaegrim_Hud::HP_Bar)
  cw = meter.width  * actor.hp / actor.maxhp
  ch = meter.height
  src_rect = Rect.new(0, 0, cw, ch)
  self.contents.blt(x+5, y-ch+17, meter, src_rect)
end  
def draw_mp(actor, x, y)
  back = Cache.system(Crissaegrim_Hud::Base)    
  cw = back.width
  ch = back.height
  src_rect = Rect.new(0, 0, cw, ch)    
  self.contents.blt(x, y-ch+24, back, src_rect)
  meter = Cache.system(Crissaegrim_Hud::MP_Bar)    
  cw = meter.width  * actor.mp / actor.maxmp
  ch = meter.height 
  src_rect = Rect.new(0, 0, cw, ch)
  self.contents.blt(x+5, y-ch+17, meter, src_rect)
end
#------------------------------------------------------------------------------
class Scene_Map
  alias hud_start start
  alias hud_update update
  alias hud_terminate terminate
  def start
    super
    if Crissaegrim_Hud::Background != ""
    @bg = Sprite.new
    @bg.bitmap = Cache.system(Crissaegrim_Hud::Background)
    @bg.x = 1
    @bg.y = 1
    end
    @hud = Window_CrissaegrimHud.new
    @hud.x = 0
    @hud.y = 0
    hud_properties
    hud_start
  end
  def update
    super
    @bg.update if Crissaegrim_Hud::Background != ""
    @hud.update
    hud_properties
    hud_update
  end
  def hud_properties
    if Crissaegrim_Hud::OnOff_Hud_Switch == 0 or $game_switches[Crissaegrim_Hud::OnOff_Hud_Switch] == true
      if @hud.visible == true and Input.trigger?(Crissaegrim_Hud::Show_Hide_Button)
        @hud.visible = false
        @bg.visible = false if Crissaegrim_Hud::Background != ""
      elsif @hud.visible == false and Input.trigger?(Crissaegrim_Hud::Show_Hide_Button)
        @hud.visible = true
        @bg.visible = true if Crissaegrim_Hud::Background != ""
      end
     else
       @hud.visible = false
       @bg.visible = false if Crissaegrim_Hud::Background != ""
     end
   end
  def terminate
    super
    @bg.dispose if Crissaegrim_Hud::Background != ""
    @hud.dispose
    hud_terminate
  end
end

Thanks in advance.
 
It dose this just this. If you set it to 0,0  then the bitmap dosn't show up. It's not all that noticeable... Like your HUD btw! Very nice job on it!  :thumb:
 
Actually the reason why ur bg is moved over and down is because u have 2 lines of code in there: @bg.x = 1, @bg.y=1. That is where the shift is coming from.
 
Yes, and when I change them to 0, the BG just vanishes. I know it's not that noticeable, but it peeves me. So if anyone can try and figure out why this is happening, it would be greatly appreciated.
 
It has to do with the bitmap as I said. It dose this naturaly becuse if its 0,0 it will vanish. So crissagrim set it to 1,1. This is becuse 0,0 dosn't regester for the bitmap becuse it starts at 0,0 basicly hes making an invisable box 1x by 1x then puting a picture over it. this is why it moves down one pixle. If you set it to 0,0 its not in this box anymore... I'll look but you need to also find were he makes the box to draw the bit map on and change it to (0,0,x end, y end) insted of (1,1, x end, y end) if you do this it will move the boxes starting position up and over 1. get it?  :huh: scripting is a hard concept (I guess...) but since I just started 2 months ago I'm having issues articulating what you have to do. Bussy with games so can't spend to much time on this. If you need something scripted just ask!  :thumb:

*Edit
super(0,0,544,416)
self.opacity = 0

Hmmm seems the super is already set to 0,0... So this means the invisable border is getting in the way -.- had this issue with mog menus... Let me try to make it -1 lol.

*Edit2

DAMN! That didn't work.. Oh well...
 

Khoa

Member

The HUD Background disappear when I transfer hero to another location on the same map, can you tell me how to fix this, please (><)
 
Personaly I'm surprised this topic is still up.  :shock: Anyway Do you trun the HUD trigger off during the event that teleprots you? I know this might sound silly but it happens. Besides that I don't know what could have happend. I mean nothing in the script should be causing in any issues. It most likely has to do with the event and not the script.
 
Ahh, sorry I logged off right after my post. Late night. Anyway I'm glad I could help. I love to help! Saidly no one seems to be on the script analysis anymore so I only pop in so offten to help. So sorry It took so long to get to you.  :dead:

As for the script... I don't quite have it... It's been moulded into my game and ummm... I added some functions to it. I could post a demo for ya if you want! But I might just make a new topic since it seems that Vlad has droped this one. I can show you how to make reloading weapons, reduced damage, hit miss, blind effect and a few other if you want. If you can't seem to get the script I think a demo is the easiest way to go, but since I'm working on my game and I'm about to release it (It's a full like 18 hour gameplay game so I'm preaty excited) So I don't know how much help I could offer.

Well I'm starting to make tangents and rambling on. If you need something done just ask. As for the script just type in the 3 numbers up top in the input box on the top right.
:thumb:
 

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