[Resolved] Blizz ABS hotkeys + transparent picture

Started by Globock, May 29, 2013, 11:40:48 am

Previous topic - Next topic

Globock

May 29, 2013, 11:40:48 am Last Edit: May 31, 2013, 06:28:30 pm by Globock
I hope I don't spam too much with my problems ^^'

So first problem I have is position of hotkeys in Blizz ABS. I changed it's position in line 6053 of third part of the script and it worked fine. Problem is in hotkey assignment screen - arrow stayed in old position and I don't know how to move it.

My second problem is also about hotkeys, but in different matter. I want to put a picture behind Blizz hotkeys, just so it looks cooler, but in Blizz hotkeys when you walk on the hotkeys it self they become more transparent for better visibility. I would like to make same with picture I put under thoose hotkeys - is it possible? If yes, can anyone help me with it?

KK20

The arrow can be moved under the class Scene_Hotkeys under the method #main (Part 3). You'll see something along the lines of @choice.x/y. Do note that this only modifies its starting position. If you wish to edit its position after pressing left or right, you will need to scroll down to #update_choice.

I recall seeing that somewhere...but I can't remember whose script did that. Take a look at some of the HUD scripts in the database.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Globock

Thanks, you're the best! I have one more question (I don't want to keep making new topics all the time) - how to change graphics of that arrow? ^^'

KK20

Right above where you made your changes, you'll see

    # create bitmap
    @choice.bitmap = $BlizzABS.cache.image('menu_arrow')

The arrow graphic is actually drawn pixel-by-pixel within the script. But if you want to upload your own graphic into the game (in the Pictures folder), you can modify the line to look like

@choice.bitmap = RPG::Cache.picture('filename')

Replacing filename with the filename of your image.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Globock

It worked, thanks so much <3 by the way I can't find anything about transparenty in any HUD ; /

KK20

I found it after remembering again. Under class Hotkey_Assignment, you'll see a self.bitmap = Bitmap.new(320,32). Replace that with
self.bitmap = RPG::Cache.picture('filename').clone

Then, under the method #draw to find

          # remove this icon
          self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))

And you can comment that line out.

Your border should be at least 320 x 32 pixels. Also, it will punch transparent holes in it to draw the skill icons. There is a way around that, but it'd take a bit more work and some collaboration between you and I.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Globock

I'm sorry but I don't understand what you mean with this:
Quote from: KK20 on May 30, 2013, 03:56:22 pm
Then, under the method #draw to find

          # remove this icon
          self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))

And you can comment that line out.

My English isn't perfect so I have a little trouble figuring out what you mean

KK20

Basically, just scroll down from where I told you to edit until you come across def draw and scroll down a few more lines after that to find the line I mentioned.

You also could have just done CTRL + F for that line.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Globock

It doesn't really work, picture is still normal when I walk under it ; /

KK20

It works fine for me, both logically and performance. This is assuming you are using Blizz-ABS v2.84 or 2.85. Are you using other scripts related to Blizz-ABS?

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Globock

I'm using v2.84 and no scripts related to it ;x just to be sure, you wanted me to put a "#" in front of this line "self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))"?

KK20

Correct. Anything with '#' preceding words/code is considered a 'comment'.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Globock

Well, than I have no idea what can cause a problem

KK20

This is what my entire Hotkey_Assignment class looks like:

#==============================================================================
# Hotkey_Assignment
#------------------------------------------------------------------------------
#  This class creates and display currently assigned hotkeys and is more
#  effiecient than the Window class.
#==============================================================================

class Hotkey_Assignment < Sprite
 
  #----------------------------------------------------------------------------
  # Initialization
  #  viewport - the viewport for the sprite
  #----------------------------------------------------------------------------
  def initialize(viewport = nil)
    # call superclass
    super
    # create bitmap
    self.bitmap = RPG::Cache.picture('hotkeyborder').clone #Bitmap.new(320, 32)
    # set font to bold
    self.bitmap.font.bold = true
    # decrease font size
    self.bitmap.font.size -= 8
    # set font color
    self.bitmap.font.color = system_color
    # set x and y position
    self.x, self.y, self.z = 160, 0, 1100
    # skill IDs on hotkeys
    @skills = BlizzABS::Cache::EmptyKeys
    # item IDs on hotkeys
    @items = BlizzABS::Cache::EmptyKeys
    # update display
    update
  end
  #----------------------------------------------------------------------------
  # draw
  #  Draws the hotkey display.
  #----------------------------------------------------------------------------
  def draw(index = nil)
    # iterate through all hotkeys
    (index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
        # if hotkey is skill hotkey
        if $game_player.skill_hotkeys[i%10] != 0
          # temporary object
          object = $data_skills[$game_player.skill_hotkeys[i%10]]
        # if hotkey is item hotkey
        elsif $game_player.item_hotkeys[i%10] != 0
          # temporary object
          object = $data_items[$game_player.item_hotkeys[i%10]]
        end
        # if any change applied (10 is used for 0)
        if @items[i%10] != $game_player.item_hotkeys[i%10] ||
            @skills[i%10] != $game_player.skill_hotkeys[i%10]
          # remove this icon
          #self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
          # fill icon bachground
          self.bitmap.fill_rect(32*(i-1)+4, 4, 24, 24, Color.new(0, 0, 0, 128))
          # if object exists
          if object != nil
            # load bitmap
            bitmap = RPG::Cache.icon(object.icon_name)
            # draw bitmap
            self.bitmap.blt(32*(i-1)+4, 4, bitmap, Rect.new(0, 0, 24, 24))
          end
          # draw hotkey number
          self.bitmap.draw_text_full(32*(i-1), 10, 30, 32, (i%10).to_s, 2)
        end}
    # set new items
    @items = $game_player.item_hotkeys.clone
    # set new skills
    @skills = $game_player.skill_hotkeys.clone
  end
  #----------------------------------------------------------------------------
  # update
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  def update
    # call superclass method
    super
    # if actor or item hotkeys or skill hotkeys have changed
    if @actor != $game_player.battler || @items != $game_player.item_hotkeys ||
        @skills != $game_player.skill_hotkeys
      # set new actor
      @actor = $game_player.battler
      # redraw
      draw
    end
  end
 
end

And I'm just using a basic 320 x 32 graphic filled entirely red.
Spoiler: ShowHide

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Globock

May 31, 2013, 04:41:02 am #14 Last Edit: May 31, 2013, 06:59:25 am by Globock
I almost got it work!
Spoiler: ShowHide

Only problem is that picture isn't centered with hotkeys ^^"

Edit: Can this picture be bigger than 320x32? Mine is and it seems like this is a problem

Blizzard

Please use spoilers for images. *fixes post*
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.

KK20

Blizz, hard at work spoiler-ing images =P

Yes you can use a bigger size than 320 x 32. The only reason why it has to be at least that size is so that the hotkeys can actually be seen. Go ahead and make your graphic only a size of 200 x 32. You'll see by what I mean.

Within that draw method, you'll see these lines:

          # fill icon bachground
          self.bitmap.fill_rect(32*(i-1)+4, 4, 24, 24, Color.new(0, 0, 0, 128))
#and further down...
          # draw hotkey number
          self.bitmap.draw_text_full(32*(i-1), 10, 30, 32, (i%10).to_s, 2)

The first two values in the parenthesis are the x- and y-coordinates. You will need to make changes to these values listed. It looks like the hotkeys need to be moved 13 pixels to the right and 4 pixels down. So, in my example code above, I'd make the lines look like this:

          # fill icon bachground
          self.bitmap.fill_rect(32*(i-1)+4+13, 4+4, 24, 24, Color.new(0, 0, 0, 128))
#and further down...
          # draw hotkey number
          self.bitmap.draw_text_full(32*(i-1)+13, 10+4, 30, 32, (i%10).to_s, 2)

Also, it seems like your hotkey border is getting cut off at the bottom. You need to change the y-value of the bitmap (which is found under initialize).

    # set x and y position
    self.x, self.y, self.z = 160, 0, 1100 #<-- for me, y is currently equal to 0

To move it up, decrease the value.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Globock

For some reason I had to move it 5 pixels instead of 13, and it fits fine, but now skill icons are in wrong position... Ahh, I'm sorry for taking so much of your time ;x

Spoiler: ShowHide

KK20

lol whoops, forgot one more line to edit (method draw again):

            # load bitmap
            bitmap = RPG::Cache.icon(object.icon_name)
            # draw bitmap
            self.bitmap.blt(32*(i-1)+4, 4, bitmap, Rect.new(0, 0, 24, 24))

Same thing: change the x- and y-coordinates.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Globock