Author Topic: [XP] Blizz-ABS weapon equip HUD for Z-HUD  (Read 17525 times)

Offline RPGManiac3030

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 4
  • Gender: Male
    • View Profile
[XP] Blizz-ABS weapon equip HUD for Z-HUD
« on: March 25, 2011, 05:51:11 AM »
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

(click to show/hide)

Demo

N/A

Script

(click to show/hide)


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!

(click to show/hide)

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!
« Last Edit: January 22, 2012, 06:31:09 AM by RPGManiac3030 »


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

Offline AliveDrive

  • Astral Trancist
  • *****
  • Posts: 690
  • LV: 17
  • Gender: Male
  • Nyah!
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #1 on: March 25, 2011, 08:13:50 AM »
Do not listen to spammer,

I like your script quite a bit! ^.^
The permanent solution for your problem would be to stop hanging out with stupid people.

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19930
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #2 on: March 25, 2011, 09:33:05 AM »
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      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Offline RPGManiac3030

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 4
  • Gender: Male
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #3 on: March 25, 2011, 10:52:19 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)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19930
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #4 on: March 25, 2011, 11:13:49 PM »
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      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Offline RPGManiac3030

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 4
  • Gender: Male
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #5 on: March 26, 2011, 05:23:45 AM »
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:
(click to show/hide)


and replace it with the code found in my script:
(click to show/hide)

After this, you need to remove this part from my script:
(click to show/hide)

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)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19930
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #6 on: March 26, 2011, 10: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.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Offline RPGManiac3030

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 4
  • Gender: Male
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #7 on: March 27, 2011, 04:32:01 AM »
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.

« Last Edit: March 27, 2011, 04:42:58 AM by RPGManiac3030 »


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

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19930
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #8 on: March 27, 2011, 11:10:45 AM »
Change in the error giving line item_number to $game_party.item_number.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Offline RPGManiac3030

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 4
  • Gender: Male
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #9 on: April 10, 2011, 07: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...
« Last Edit: April 10, 2011, 07:56:24 PM by RPGManiac3030 »


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

Offline Boba Fett Link

  • Enterbrain Spy
  • Ethereal Devastator
  • ****
  • Posts: 298
  • LV: 4
  • Gender: Male
  • DANGER ZONE!
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #10 on: April 15, 2011, 12:48:52 AM »
Great! I'll try it out.
This post will self-destruct in 30 seconds.

Offline Boba Fett Link

  • Enterbrain Spy
  • Ethereal Devastator
  • ****
  • Posts: 298
  • LV: 4
  • Gender: Male
  • DANGER ZONE!
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #11 on: April 16, 2011, 01:09:01 PM »
So what do I need to name the Equip hotkey background?
This post will self-destruct in 30 seconds.

Offline Kagutsuchi

  • Ethereal Devastator
  • ****
  • Posts: 468
  • LV: 2
  • Gender: Male
  • The God of .. eating souls?
    • View Profile
    • University Hosted Web Page - In Norwegian
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #12 on: April 17, 2011, 07: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!

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3247
  • LV: 294
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #13 on: April 17, 2011, 08:50:43 PM »
The "draw_equip" method has no way to compensate for no weapon equipped.

This should fix it (untested):
Code: [Select]
  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.

Offline RPGManiac3030

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 4
  • Gender: Male
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #14 on: May 05, 2011, 06: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!

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.
« Last Edit: May 05, 2011, 07:13:54 AM by RPGManiac3030 »


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

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3247
  • LV: 294
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #15 on: May 05, 2011, 07:02:06 AM »
Just use
Code: [Select]
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.

Offline RPGManiac3030

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 4
  • Gender: Male
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #16 on: May 05, 2011, 07: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...


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

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3247
  • LV: 294
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #17 on: May 05, 2011, 07:21:19 AM »
The "draw_equip" method has no way to compensate for no weapon equipped.

This should fix it (untested):
Code: [Select]
 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.

Offline RPGManiac3030

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 4
  • Gender: Male
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #18 on: May 05, 2011, 07: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.
« Last Edit: May 05, 2011, 07:26:24 AM by RPGManiac3030 »


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

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3247
  • LV: 294
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Blizz-ABS weapon equip HUD for Z-HUD
« Reply #19 on: May 05, 2011, 07:26:23 AM »
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.