[XP] Blizz-ABS weapon equip HUD for Z-HUD

Started by RPGManiac3030, March 24, 2011, 10:51:11 pm

Previous topic - Next topic

RPGManiac3030

March 24, 2011, 10:51:11 pm Last Edit: January 21, 2012, 11:31:09 pm by RPGManiac3030
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


  • Adds the player's/party leader's equipped weapon to the screen




Screenshots

Spoiler: ShowHide





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 Place all graphics in your game's pictures folder!

Spoiler: ShowHide



Compatibility

  • Requires Blizz ABS and Z-HUD to work.

  • Any other script that modifies the Z-HUD may not be compatible.

  • Works with the Quick weapon switch addon by Blizzard perfectly.


Credits and Thanks


  • Blizzard

  • Winkio

  • ForeverZer0 (For help with fixing the no weapon problem)





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!


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

AliveDrive

Do not listen to spammer,

I like your script quite a bit! ^.^
Quote from: Blizzard on September 09, 2011, 02:26:33 am
The permanent solution for your problem would be to stop hanging out with stupid people.

Blizzard

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.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

RPGManiac3030

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!


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Blizzard

Thank you. Now your topic can be moved into the database and will appear in the database index.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

RPGManiac3030

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.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Blizzard

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.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

RPGManiac3030

March 26, 2011, 09:32:01 pm #7 Last Edit: March 26, 2011, 09:42:58 pm by RPGManiac3030
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.



Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Blizzard

Change in the error giving line item_number to $game_party.item_number.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

RPGManiac3030

April 10, 2011, 01:33:57 pm #9 Last Edit: April 10, 2011, 01:56:24 pm by RPGManiac3030
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...


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Boba Fett Link

This post will self-destruct in 30 seconds.

Boba Fett Link

So what do I need to name the Equip hotkey background?
This post will self-destruct in 30 seconds.

Kagutsuchi

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!

ForeverZer0

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
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

RPGManiac3030

May 05, 2011, 12:54:05 am #14 Last Edit: May 05, 2011, 01:13:54 am by RPGManiac3030
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.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

ForeverZer0

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
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

RPGManiac3030

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...


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

RPGManiac3030

May 05, 2011, 01:22:41 am #18 Last Edit: May 05, 2011, 01:26:24 am by RPGManiac3030
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.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

ForeverZer0

What errors?
I can say with pretty much 100% certainty that the error is not in that method.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

RPGManiac3030

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.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

RPGManiac3030

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?


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

RPGManiac3030

May 05, 2011, 01:58:41 am #24 Last Edit: May 05, 2011, 02:05:44 am by RPGManiac3030
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.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

RPGManiac3030

Thanks! I really appreciate your help and suggestions. I believe that's key in getting better.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Boba Fett Link

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?
This post will self-destruct in 30 seconds.

RPGManiac3030

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.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

RPGManiac3030

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!


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Boba Fett Link

August 30, 2011, 04:57:46 pm #30 Last Edit: August 30, 2011, 05:29:27 pm by Boba Fett Link
 :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
This post will self-destruct in 30 seconds.

RPGManiac3030

 :^_^': 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.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Boba Fett Link

Hey thanks, this looks sounds exactly what I wanted!



There is a syntax error on line 206.
This post will self-destruct in 30 seconds.

RPGManiac3030

Ok, I'll look into it. Bear with me, since I'll probably update it tomorrow  :D


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

RPGManiac3030

Ok, everything's updated and it worked fine when I tested it with only Blizz-ABS and the Z-HUD, so it should work.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Boba Fett Link

This post will self-destruct in 30 seconds.

Boba Fett Link

December 31, 2011, 02:54:46 pm #36 Last Edit: January 03, 2012, 05:34:16 pm by Boba Fett Link
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.
This post will self-destruct in 30 seconds.

RPGManiac3030

January 02, 2012, 10:04:28 pm #37 Last Edit: January 02, 2012, 10:14:23 pm by RPGManiac3030
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.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Boba Fett Link

January 03, 2012, 08:10:46 am #38 Last Edit: January 03, 2012, 05:34:00 pm by Boba Fett Link
Thanks, works great now!

EDIT: I now notice that the weapon graphic is not centered over the weapon back.
This post will self-destruct in 30 seconds.

RPGManiac3030

Should be fixed. If it's not, I think I know what else is wrong.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Boba Fett Link

This post will self-destruct in 30 seconds.

RPGManiac3030



Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Boba Fett Link

Still no.

Maybe you should check in the Z-HUD script to see how Blizzard made it work.
This post will self-destruct in 30 seconds.

RPGManiac3030

I've been using the Z-HUD as a reference since I first made the script...

I think it should work now, though.


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Boba Fett Link

January 19, 2012, 05:50:32 pm #44 Last Edit: January 22, 2012, 02:24:33 pm by Boba Fett Link
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.
This post will self-destruct in 30 seconds.

RPGManiac3030

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  :^_^':


Official Gio website:
gioadventures.freehostingcloud.com (under construction)

Boba Fett Link

January 22, 2012, 02:24:08 pm #46 Last Edit: January 22, 2012, 02:25:41 pm by Boba Fett Link
 :D It works great! Thanks!
This post will self-destruct in 30 seconds.

danleon950410

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.

LiTTleDRAgo

August 29, 2016, 11:34:36 am #48 Last Edit: August 29, 2016, 11:35:47 am by LiTTleDRAgo
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
Longer Script Call
Drago Core Engine

danleon950410

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
Longer Script Call
Drago Core Engine

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