Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: RPGManiac3030 on March 24, 2011, 10:51:11 pm

Title: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on March 24, 2011, 10:51:11 pm
Blizz ABS Weapon Equip HUD for Z-HUD
Authors: RPGManiac3030
Version: 1.6
Type: Blizz-ABS Plugin/ Z-HUD addon
Key Term: Blizz-ABS Plugin



Introduction

(My first script post)
This addon/edit basically adds an equipped weapon HUD to the Z-HUD.
I've now edited the script so the weapon, skill, AND item hotkeys all appear on the screen (if you're not using direct hotkeys, of course)
I've also added a background picture to the weapon HUD. You can enable/disable this feature and change the picture in the config area of the script.
Features




Screenshots

Spoiler: ShowHide

(http://i499.photobucket.com/albums/rr358/kevin7571/Hotkey.png)



Demo

N/A


Script

Spoiler: ShowHide

#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Weapon Equip HUD for Z-HUD
# By RPGManiac3030
# Version 1.6
# www.chaos-project.com
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Version History:
#   v.1.0
#    -Original Release
#   v.1.1
#    -Removed direct hotkey code
#   v.1.2
#    -Added compatibility for no weapon equipped
#   v.1.3
#    -Added weapon background that displays when no weapon is equipped
#   v.1.4
#    -Added option to change order of the icons via config.
#   v.1.5
#    -Removed edits in v.1.4, and added a background to the weapon icon if desired
#   v.1.5.5
#    -Added option to change location of hotkeys/weapon HUD.
#   v.1.6
#    -Background images for weapon graphic can now be larger than 24x24.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Features:
#   -Adds the player's equipped weapon to the HUD.
#   -Displays a graphic for when no weapon is equipped.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Instructions:
# -Instructions for editing the config are located in that section.
# -Place this script right under Z-HUD and above main.
# -Place all graphics in your game's pictures folder.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Improvements/ Things to change for next version:
# -Spread out icons to it doesn't look cluttered.
# -Improve efficiency of the code.
# -Return layout options?
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
if !$BlizzABS || BlizzABS::VERSION < 2.7
  raise 'Error: Weapon Equip Hud needs Blizz-ABS of version 2.7 or higher.'
end

#BEGIN CONFIGURATION
#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
 
  #Set to false to show a picture behind the equipped weapon, and true for none
  DISABLE_WEAPON_BACK = false
 
 
  Z_WEAPON_BACK = ''              #image to be displayed behind the weapon
 
 
  WEAPON_EMPTY = 'Weapon'        #image file for when no weapon is equipped
 
  HUD_X = 632                  #Horizontal location of HUD.
                               #This is where the right side of the hud will be!
                               #Take into effect the width of your 3 pictures
                               #in order to set this properly.
                               #The formula is: HUD's left side = HUD_X - width of 3 graphics
                               
  HUD_Y = 4                   #Vertical location of HUD.
 
#END CONFIGURATION
end
#==============================================================================
# DO NOT EDIT ANYTHING BELOW UNLESS YOU KNOW WHAT YOU'RE DOING!!!
#==============================================================================


#==============================================================================
# Hud
#------------------------------------------------------------------------------
#  This class was modified to support SR display and modify the number of
#  skills left to use.
#==============================================================================
class Hud
  #----------------------------------------------------------------------------
  # update
  #  Checks if HUD needs refreshing.
  #----------------------------------------------------------------------------
  def update
    # if actor doesn't exist
    if actor == nil
      # unless already drawn empty HUD
      unless @empty_hud_drawn
        # draw HUD template
        draw_basic
        # draw empty HP, SP and EXP bars
        draw_empty
        # empty HUD was drawn
        @empty_hud_drawn = true
      end
    else
      # if HUD needs refresh
      if $game_temp.hud_refresh
        # draw all data about actor
        draw_name
        draw_level
        draw_hp
        draw_sp
        draw_equip
        draw_hitem
        draw_litem
        unless BlizzABS::Config::DIRECT_HOTKEYS
          draw_hskill
          draw_lskill
        end
        # remove flag
        $game_temp.hud_refresh = nil
      else
        # draw data that needs to ve updated
        test_name
        test_level
        test_hp
        test_sp
        test_equip
        test_hitem
        test_litem
        unless BlizzABS::Config::DIRECT_HOTKEYS
          test_hskill
          test_lskill
        end
      end
      # empty HUD wasn't drawn
      @empty_hud_drawn = false
    end
  end
  #-------------------------------------------------------------------
  # draw_equip
  #  Draws the equipped weapon on the screen.
  #----------------------------------------------------------------------------
  def draw_equip
      b0 = RPG::Cache.picture(BlizzCFG::Z_WEAPON_BACK)
    if BlizzCFG::DISABLE_WEAPON_BACK == true
      @hotkey_sprite.bitmap.fill_rect(0, 0, 24, 24, Color.new(0, 0, 0, 0))
    else
      @hotkey_sprite.bitmap.fill_rect(0, 0, b0.width, b0.height, Color.new(0, 0, 0, 0))
      @hotkey_sprite.bitmap.blt(0, 0, b0, Rect.new(0, 0, b0.width, b0.height))
    end
    wpn = $data_weapons[$game_party.actors[0].weapon_id]
    if wpn != nil
      b1 = RPG::Cache.icon(wpn.icon_name)
      x, y = (b0.width - 24) / 2, (b0.height - 24) / 2
      @hotkey_sprite.bitmap.blt(x, y, b1, Rect.new(0, 0, 24, 24))
    else
       b1 = RPG::Cache.picture(BlizzCFG::WEAPON_EMPTY)
      x, y = (b0.width - 24) / 2, (b0.height - 24) / 2
      @hotkey_sprite.bitmap.blt(x, y, b1, Rect.new(0, 0, 24, 24))
    end
  end
  #----------------------------------------------------------------------------
  # draw_hskill
  #  Draws the skill hotkey on the screen.
  #---------------------------------------------------------------------------- 
  def draw_hskill
      @skill = actor.skill
      b1 = RPG::Cache.picture(BlizzCFG::Z_WEAPON_BACK)
      b2 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
      x = b1.width + 4
      @hotkey_sprite.bitmap.fill_rect(x, 0, b2.width, b2.height, Color.new(0, 0, 0, 0))
      @hotkey_sprite.bitmap.blt(x, 0, b2, Rect.new(0, 0, b2.width, b2.height))
      if @skill != 0
        bitmap = RPG::Cache.icon($data_skills[@skill].icon_name)
        x, y = b1.width + 4 + (b2.width - 24) / 2, (b2.height - 24) / 2
        @hotkey_sprite.bitmap.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
      end
    draw_lskill
  end
  #----------------------------------------------------------------------------
  # draw_lskill
  # Draws the number of skills left to use.
  #----------------------------------------------------------------------------
  def draw_lskill
     b1 = RPG::Cache.picture(BlizzCFG::Z_WEAPON_BACK)
      x = b1.width + 4
      @hotkey_sprite.bitmap.fill_rect(x, @left_y, @left_x, 16, Color.new(0, 0, 0, 0))
      @skills_left = get_skills_left
      if @skill != nil && @skill > 0
        if @skills_left >= 0
          if @skills_left == 0
            @hotkey_sprite.bitmap.font.color = Color.new(255, 0, 0)
          elsif @skills_left <= 5
            @hotkey_sprite.bitmap.font.color = Color.new(255, 255, 0)
          else
            @hotkey_sprite.bitmap.font.color = normal_color
          end
          @hotkey_sprite.bitmap.font.size -= 2
          @hotkey_sprite.bitmap.draw_text_full(x, @left_y - 4, @left_x, 20, @skills_left.to_s, 1)
          @hotkey_sprite.bitmap.font.size += 2
        elsif @skills_left == -1
          @hotkey_sprite.bitmap.font.color = Color.new(0, 255, 0)
          @hotkey_sprite.bitmap.font.size += 4
          @hotkey_sprite.bitmap.draw_text_full(x, @left_y - 4, @left_x, 20, '∞', 1)
          @hotkey_sprite.bitmap.font.size -= 4
        end
      end
    end
 
  #----------------------------------------------------------------------------
  # draw_hitem
  # Draws the item hotkey on the screen.
  #----------------------------------------------------------------------------
  def draw_hitem
    @item = actor.item
    b1 = RPG::Cache.picture(BlizzCFG::Z_WEAPON_BACK)
    b2 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
    b3 = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
    x = b1.width + b2.width + 4
    @hotkey_sprite.bitmap.fill_rect(x, 0, b3.width, b3.height, Color.new(0, 0, 0, 0))
    @hotkey_sprite.bitmap.blt(x, 0, b3, Rect.new(0, 0, b3.width, b3.height))
    if @item != 0
      bitmap = RPG::Cache.icon($data_items[@item].icon_name)
      x, y = b1.width + b2.width + 4 + (b3.width - 24) / 2, (b3.height - 24) / 2
      @hotkey_sprite.bitmap.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
    end
    draw_litem
  end
 
  #----------------------------------------------------------------------------
  # draw_litem
  # Draws the number of items left to use.
  #----------------------------------------------------------------------------
  def draw_litem
    @items_left = $game_party.item_number(@item)
    b1 = RPG::Cache.picture(BlizzCFG::Z_WEAPON_BACK)
    b2 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
    x = b1.width + b2.width + 4
    @hotkey_sprite.bitmap.fill_rect(x, @left_y, @left_x, 16, Color.new(0, 0, 0, 0))
    if @item != nil && @item > 0
      if $data_items[@item] != nil && !$data_items[@item].consumable
        @hotkey_sprite.bitmap.font.color = Color.new(0, 255, 0)
        @hotkey_sprite.bitmap.font.size += 4
        @hotkey_sprite.bitmap.draw_text_full(x, @left_y - 4, @left_x, 20, '∞', 1)
        @hotkey_sprite.bitmap.font.size -= 4
      else
        if @items_left == 0
          @hotkey_sprite.bitmap.font.color = Color.new(255, 0, 0)
        elsif @items_left <= 10
          @hotkey_sprite.bitmap.font.color = Color.new(255, 255, 0)
        else
          @hotkey_sprite.bitmap.font.color = normal_color
        end
        @hotkey_sprite.bitmap.font.size -= 2
        @hotkey_sprite.bitmap.draw_text_full(x, @left_y - 4, @left_x, 20, @items_left.to_s, 1)
        @hotkey_sprite.bitmap.font.size += 2
      end
    end
  end
 
  #----------------------------------------------------------------------------
  # test_equip
  #  Tests and draws the equipment.
  #----------------------------------------------------------------------------
  def test_equip
    # tests if the weapon was changed
    draw_equip if actor.weapon_id != nil
  end
 
  #----------------------------------------------------------------------------
  # init_hotkey_sprite(viewport)
  # Sets up the area where the hotkey icons and equipped weapon will be drawn.
  #----------------------------------------------------------------------------
  def init_hotkey_sprite(viewport)
    b1 = RPG::Cache.picture(BlizzCFG::Z_WEAPON_BACK)
    b2 = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
    b3 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
    width = b1.width + b2.width + b3.width
    @hotkey_sprite = Sprite.new(viewport)
    @hotkey_sprite.x = BlizzCFG::HUD_X - width
    @hotkey_sprite.y = BlizzCFG::HUD_Y
    @hotkey_sprite.bitmap = Bitmap.new(width + 4, b1.height + 24)
    @hotkey_sprite.bitmap.font.name = 'Times New Roman'
    @hotkey_sprite.bitmap.font.size = 16
    @hotkey_sprite.bitmap.font.bold = true
  end
end
$BlizzABS = BlizzABS::Processor.new




Instructions

Put the script below Blizz-ABS and BELOW the Z-HUD. Set DISABLE_WEAPON_BACK to false to allow a picture to be displayed behind the weapon graphic (set what picture will display in the script!), or set to true to disable this picture. You also need to create an "empty weapon" file, which should be the same dimensions as the item and skill back pictures. Name it Weapon and place it in the pictures folder, or name it anything you want and edit the appropriate place in the script. It would be a fist or anything you want that will show when the player is unarmed. You can either make your own, or use this one. I got this graphic from http://www.pixeljoint.com/files/icons/full/34x34icons.png (http://www.pixeljoint.com/files/icons/full/34x34icons.png) Place all graphics in your game's pictures folder!

Spoiler: ShowHide
(http://i499.photobucket.com/albums/rr358/kevin7571/Weapon.png)



Compatibility



Credits and Thanks





Author's notes
I kind of just did this version and didn't test it yet...if anyone has a problem, please let me know!
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: AliveDrive on March 25, 2011, 01:13:50 am
Do not listen to spammer,

I like your script quite a bit! ^.^
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Blizzard on March 25, 2011, 02:33:05 am
Quote from: RPGManiac3030 on March 24, 2011, 10:51:11 pm
Key Term: Blizz-ABS Plugin Z-HUD


That key term doesn't exist. Please make sure you are using only key terms that exist.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on March 25, 2011, 03:52:19 pm
Quote from: Blizzard on March 25, 2011, 02:33:05 am
Quote from: RPGManiac3030 on March 24, 2011, 10:51:11 pm
Key Term: Blizz-ABS Plugin Z-HUD


That key term doesn't exist. Please make sure you are using only key terms that exist.


Sorry about that, Blizz!
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Blizzard on March 25, 2011, 04:13:49 pm
Thank you. Now your topic can be moved into the database and will appear in the database index.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on March 25, 2011, 10:23:45 pm
I looked through again...and I realized that an error will appear if you try to use an item. I originally edited the different parts of Blizz-ABS directly which made it work. I then put my edits into a separate script and posted it here to make it convenient for others.


You need to find this part in PART 2 of the Blizz-ABS:
Spoiler: ShowHide
    #--------------------------------------------------------------------------
   # check_item_condition?
   #  Checks whether a item should be executed or not.
   #--------------------------------------------------------------------------
   def check_item_condition?
     # disallow usage if item button disabled
     return false if !$game_system.item_button
     # disallow usage
     item_condition = false
     # if using direct hotkeys
     if BlizzABS::Config::DIRECT_HOTKEYS
       # check direct hotkeys
       item_condition = self.item_hotkeys?
     # if item button pressed
     elsif Input.trigger?(Input::Item)
       # allow usage
       item_condition = true
     end
     # return result
     return item_condition
   end



and replace it with the code found in my script:
Spoiler: ShowHide
    #--------------------------------------------------------------------------
   # check_item_condition?
   #  Checks whether a item should be executed or not.
   #--------------------------------------------------------------------------
   def check_item_condition?
     # disallow usage if item button disabled
     return false if !$game_system.item_button
     # disallow usage
     item_condition = false
     # if using direct hotkeys
     if BlizzABS::Config::DIRECT_HOTKEYS
       if Input.trigger?(Input::Item)
         # allow usage
         item_condition = true
       end
     end
     # return result
     return item_condition
   end


After this, you need to remove this part from my script:
Spoiler: ShowHide
module BlizzABS
 #============================================================================
 # BlizzABS::Controls
 #----------------------------------------------------------------------------
 #  This class handles player input for battle on the map.  Some input is
 #  processed instantly, while some is converted into commands to be given to
 #  the player character.
 #============================================================================
 
 class Controls
   #--------------------------------------------------------------------------
   # check_item_condition?
   #  Checks whether a item should be executed or not.
   #--------------------------------------------------------------------------
   def check_item_condition?
     # disallow usage if item button disabled
     return false if !$game_system.item_button
     # disallow usage
     item_condition = false
     # if using direct hotkeys
     if BlizzABS::Config::DIRECT_HOTKEYS
       if Input.trigger?(Input::Item)
         # allow usage
         item_condition = true
       end
     end
     # return result
     return item_condition
   end
 end
end


I'll edit the script and add another spoiler for the code. I'm new to scripting, so I'm not completely sure how to get all of this to work how I originally had it in the script.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Blizzard on March 26, 2011, 03:09:05 am
Actually you don't have to do that. You can simply add that part in your script and if it is put below Blizz-ABS and Z-HUD (which it should since it's a plugin for both), it will simply override the original code.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on March 26, 2011, 09:32:01 pm
Doing that still gets the same error. I don't remember seeing this before taking my edits and putting it into this script. I'm trying to look into this.

(http://i499.photobucket.com/albums/rr358/kevin7571/Error.png)
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Blizzard on March 27, 2011, 05:10:45 am
Change in the error giving line item_number to $game_party.item_number.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on April 10, 2011, 01:33:57 pm
Version 1.1 is now out

Improvments/Changes:

-All 3 icons will appear in the hud (weapon, skill, and item)
-My edits to the direct hotkeys have been REMOVED for the purposes of posting this script


For the next version:
-I need to learn how to make the script shorter...
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on April 14, 2011, 06:48:52 pm
Great! I'll try it out.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on April 16, 2011, 07:09:01 am
So what do I need to name the Equip hotkey background?
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Kagutsuchi on April 17, 2011, 01:03:36 pm
I just want to point out that the game crashed when I unequipped my weapon

Great work btw, I would have to do this myself for TES, and go through the painfull process of learning ruby and finding out what I need to do with blizz abs, but now I dont have to =D Thanks!
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: ForeverZer0 on April 17, 2011, 02:50:43 pm
The "draw_equip" method has no way to compensate for no weapon equipped.

This should fix it (untested):
  def draw_equip
    wpn = $data_weapons[$game_party.actors[0].weapon_id]
    @hotkey_sprite.bitmap.fill_rect(0, 0, 24, 24, Color.new(0, 0, 0, 0))
    @hotkey_sprite.bitmap.font.color = normal_color
    @hotkey_sprite.bitmap.font.size = 14
    if wpn != nil
      icon = RPG::Cache.icon(wpn.name)
      x, y = (icon.width - 24) / 2, (icon.height - 24) / 2
      @hotkey_sprite.bitmap.blt(x, y, icon, Rect.new(0, 0, 24, 24))
    end
  end
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on May 05, 2011, 12:54:05 am
Sorry, guys, I've been on vacation for the past month...

I never noticed that problem before, but I'll post up an updated version soon!

Quote from: Boba Fett Link on April 16, 2011, 07:09:01 am
So what do I need to name the Equip hotkey background?


The background is simply the icon of the weapon you have equipped. To be safe, I would name the icon graphic the same as the weapon name in the database.

EDIT:

Version 1.2 is now out!

New features:
-The no weapon problem has now been fixed.
-You need to specify a graphic for the "Weapon Back", similar to the skill and item backs. Simply make an image the same size as the other backs, save it in your pictures folder as "Weapon", and you're done! It should be preferably empty since it won't show up on screen anyway. I had to do this so that the bitmap can always draw itself without relying on the player's equipped weapon since he/she may not always have one.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: ForeverZer0 on May 05, 2011, 01:02:06 am
Just use
RPG::Cache.icon(weapon.icon_name)


As long as you have it set right in the editor, it will get the right graphic.

I also just noticed that I made the error in my above post by using "wpn.name".
It should be "wpn.icon_name"

Oops.  :P
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on May 05, 2011, 01:20:27 am
Maybe, but I tried using the code and I still got an error since I had previously set it so that the weapon icon graphic is being used to set the position of the next hotkey graphic. If you have no weapon equipped, there wouldn't be a graphic to use...
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: ForeverZer0 on May 05, 2011, 01:21:19 am
Quote from: ForeverZer0 on April 17, 2011, 02:50:43 pm
The "draw_equip" method has no way to compensate for no weapon equipped.

This should fix it (untested):
  def draw_equip
   wpn = $data_weapons[$game_party.actors[0].weapon_id]
   @hotkey_sprite.bitmap.fill_rect(0, 0, 24, 24, Color.new(0, 0, 0, 0))
   @hotkey_sprite.bitmap.font.color = normal_color
   @hotkey_sprite.bitmap.font.size = 14
   if wpn != nil
     icon = RPG::Cache.icon(wpn.icon_name)
     x, y = (icon.width - 24) / 2, (icon.height - 24) / 2
     @hotkey_sprite.bitmap.blt(x, y, icon, Rect.new(0, 0, 24, 24))
   end
 end



Hence I posted this.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on May 05, 2011, 01:22:41 am
Yeah, I took that and placed it right into my code, and I still got errors.

EDIT: I'll leave it the way it is for now, since it works, but if I can get the code to work without needing that graphic, I'll post it as another update.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: ForeverZer0 on May 05, 2011, 01:26:23 am
What errors?
I can say with pretty much 100% certainty that the error is not in that method.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on May 05, 2011, 01:27:03 am
True, it's with every other method in the script that calls for the weapon icon graphic. Sorry if I wasn't clear about that.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: ForeverZer0 on May 05, 2011, 01:31:42 am
You should be able to do the tiny little edit the above method throughout the script. Just do a "if weapon != nil" branch before tou try to actually reference any parameters of the weapon. You can have the "else" branches draw a default graphic, like fists or something to that it is not empty.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on May 05, 2011, 01:39:06 am
Well since the weapon icons should be the same size anyway, I don't see how it would really make a difference to keep changing the icon graphic used to set up the dimensions...

What if I use the fist icon as the graphic that sets up the bitmap, and only draw it if the actor has no weapon equipped?
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: ForeverZer0 on May 05, 2011, 01:53:05 am
I am not talking about the icon dimensions. That's not what is crashing your game. Traditionally icon graphics are the same size anyway. You need to make sure that the weapon is never nil when you try to reference it. You are literally trying to invoke these calls:

nil.width
nil.name
nil.icon_name


That doesn't work obviously.

But anyways, "No", you should attempt to draw the weapon first. It is going to be more common to have a weapon equipped. If you draw the fist first, 99% of the time you will be drawing the bitmap twice, which is not very efficient coding. If it is only an alternative branch after first attempting the weapon, then no matter what, the bitmap will only be drawn once.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on May 05, 2011, 01:58:41 am
Well I checked it, and it works perfectly fine. The fist shows up when I have no weapon equipped, and it's not there when I have my weapons equipped. Since I'm new to coding, I'm guessing that the first fill_rect line sets up the position where the graphic will be drawn. Then the blt actually draws the graphic.

For drawing the actual weapon sprite, I'm using the weapon icon graphic, and drawing it if the weapon is equipped. If there's no weapon, the fist graphic is drawn. I'm then using the fist graphic as a reference to place the spell and item hotkey graphics, since it should be located in the same spot always whether or not it's actually drawn.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: ForeverZer0 on May 05, 2011, 02:06:13 am
A lot of the being highly efficient with coding comes with experience. It is important, but when you are learning, it is much more important to learn how to code something that actually works. Worry about making it better after that.

Anyways, good job! I'm glad you got if figured out. Its always a good feeling when you get a script you've been working on to run without bugs.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on May 05, 2011, 02:09:01 am
Thanks! I really appreciate your help and suggestions. I believe that's key in getting better.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on August 28, 2011, 04:25:10 pm
Hey for a next version, could you make it like the Z-hud where the skill icon is placed over another icon, like in Loz Ocarina of Time, where the sword graphic is centered in front of the B-button icon?
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on August 28, 2011, 05:28:07 pm
So you want the weapon icon in the center of the 3 icons? Yeah, I think I can get that done, and I'll provide a config where you can set which order you want them in.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on August 28, 2011, 06:41:25 pm
Updated to 1.4

Now you can change the layout of the HUD. I only have 2 options, either having the weapon first and skill second, or skill first and weapon second (The item stays third). I might add more options later, though.

I just finished it and don't have time to test it, so if anyone runs into problems please let me know!
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on August 30, 2011, 04:57:46 pm
 :facepalm: Sorry for confusing you, I probably should have been more specific. Like this is what I mean (link), like a sword in the center of the B-button image on the N64 controller, like so that the icon of the sword is placed on top of a separate picture of the B-button in the graphic picture folder. I wanted you to create the option for an "icon-back". I meant centered like centered vertically or like having the ability to set up x and y coordinates instead of being right up to the top of the screen.

The order was fine, but the option to change it is a nice touch and I may use it in my game.

follow this link

http://ui22.gamefaqs.com/821/gfs_14052_1_2.jpg
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on August 31, 2011, 08:15:55 am
 :^_^': Ok, I understand now. As for the option to move the actual HUD...I'm going to look into that for a future update. I think I know how to do it, but I won't have time to try it until tonight.

Update to v.1.5.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on August 31, 2011, 06:50:11 pm
Hey thanks, this looks sounds exactly what I wanted!



There is a syntax error on line 206.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on September 01, 2011, 08:18:06 am
Ok, I'll look into it. Bear with me, since I'll probably update it tomorrow  :D
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on September 02, 2011, 10:08:00 am
Ok, everything's updated and it worked fine when I tested it with only Blizz-ABS and the Z-HUD, so it should work.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on September 13, 2011, 06:10:18 pm
 :) Thanks, it is great.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on December 31, 2011, 02:54:46 pm
Hey, I've noticed if the weapon back graphic is larger than 24x24 it gets cut off.

Here's an example:



The weapon back is the same exact picture as the skill and item backs.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on January 02, 2012, 10:04:28 pm
I'll see what I can do about that.


EDIT: Ok, I fixed it. It was an error on my part: I set the size of the drawing region to 24x24, instead of the graphic's width - which is how the others are set up. I think it should work now.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on January 03, 2012, 08:10:46 am
Thanks, works great now!

EDIT: I now notice that the weapon graphic is not centered over the weapon back.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on January 06, 2012, 11:57:14 pm
Should be fixed. If it's not, I think I know what else is wrong.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on January 07, 2012, 11:44:12 am
Nope, that didn't fix it.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on January 13, 2012, 10:39:04 pm
Ok, I really think it should work now  :^_^':
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on January 16, 2012, 08:38:26 pm
Still no.

Maybe you should check in the Z-HUD script to see how Blizzard made it work.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on January 18, 2012, 03:22:04 pm
I've been using the Z-HUD as a reference since I first made the script...

I think it should work now, though.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on January 19, 2012, 05:50:32 pm
Now it makes the weapon back display weird.

Here's a screenshot to define what I mean by weird:
Spoiler: ShowHide

The weapon back is the same exact image as the skill and item backs

See the little triangles underneath and to the right of the back? Its like the weapon back is being tiled.


And the item is not centered still.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: RPGManiac3030 on January 21, 2012, 11:32:17 pm
Ok, there were some things I found on my part that weren't right, so I fixed them to mimic the other skill things.

I tried it on my game and it looks fine, so I hope this one works now  :^_^':
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: Boba Fett Link on January 22, 2012, 02:24:08 pm
 :D It works great! Thanks!
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: danleon950410 on August 29, 2016, 11:23:48 am
For anyone that wants to use this script:
It works wonderfully and as planned, BUT it has an issue that collides with the Blizz ABS.
Using the Blizz's $game_system.hotkeys = false command to Hide either the HUD or the Hotkeys breaks the game. It doesn't even crash, it completeley freezes.
Weirdly enough, it doesn't happen by using the Hud and Hotkeys key to toggle their display.
I'm trying to fix this issue but i haven't been able to achieve it yet. I'm really unexperienced at this.

If i find the solution i'll post it ASAP. If anyone more experienced than me has some free time (i'm not asking for miracles, this post's been dead for like 4 years) any hand will be more than welcome.
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: LiTTleDRAgo on August 29, 2016, 11:34:36 am
Quote from: danleon950410 on August 29, 2016, 11:23:48 am
For anyone that wants to use this script:
It works wonderfully and as planned, BUT it has an issue that collides with the Blizz ABS.
Using the Blizz's $game_system.hotkeys = false command to Hide either the HUD or the Hotkeys breaks the game. It doesn't even crash, it completeley freezes.
Weirdly enough, it doesn't happen by using the Hud and Hotkeys key to toggle their display.
I'm trying to fix this issue but i haven't been able to achieve it yet. I'm really unexperienced at this.

If i find the solution i'll post it ASAP. If anyone more experienced than me has some free time (i'm not asking for miracles, this post's been dead for like 4 years) any hand will be more than welcome.


RMXP script call bug, to fix that you can modify your script call :

from this :

$game_system.hotkeys = false


into this :

$game_system.hotkeys = 
false


or using one of the following script (just select one) :

Interpreter Script Call Fix (http://forum.chaos-project.com/index.php/topic,938.0.html)
Longer Script Call (http://forum.chaos-project.com/index.php/topic,13324.0.html)
Drago Core Engine (http://forum.chaos-project.com/index.php/topic,13476.0.html)
Title: Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
Post by: danleon950410 on August 29, 2016, 02:16:12 pm
Quote from: LiTTleDRAgo on August 29, 2016, 11:34:36 am
Quote from: danleon950410 on August 29, 2016, 11:23:48 am
For anyone that wants to use this script:
It works wonderfully and as planned, BUT it has an issue that collides with the Blizz ABS.
Using the Blizz's $game_system.hotkeys = false command to Hide either the HUD or the Hotkeys breaks the game. It doesn't even crash, it completeley freezes.
Weirdly enough, it doesn't happen by using the Hud and Hotkeys key to toggle their display.
I'm trying to fix this issue but i haven't been able to achieve it yet. I'm really unexperienced at this.

If i find the solution i'll post it ASAP. If anyone more experienced than me has some free time (i'm not asking for miracles, this post's been dead for like 4 years) any hand will be more than welcome.


RMXP script call bug, to fix that you can modify your script call :

from this :

$game_system.hotkeys = false


into this :

$game_system.hotkeys = 
false


or using one of the following script (just select one) :

Interpreter Script Call Fix (http://forum.chaos-project.com/index.php/topic,938.0.html)
Longer Script Call (http://forum.chaos-project.com/index.php/topic,13324.0.html)
Drago Core Engine (http://forum.chaos-project.com/index.php/topic,13476.0.html)

I wasn't aware of that. I feel really dumb now...Well, it's true:every day is school day...
Thank you very much for saving me, i was stuck and going crazy around this error.
You have my infinite gratitude,man