Chaos Project

RPG Maker => General Discussion => Troubleshooting / Help => Topic started by: Globock on May 29, 2013, 11:40:48 am

Title: [Resolved] Blizz ABS hotkeys + transparent picture
Post by: Globock on May 29, 2013, 11:40:48 am
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?
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: KK20 on May 29, 2013, 08:15:59 pm
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.
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: Globock on May 30, 2013, 02:30:53 pm
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? ^^'
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: KK20 on May 30, 2013, 02:37:35 pm
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.
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: Globock on May 30, 2013, 02:48:52 pm
It worked, thanks so much <3 by the way I can't find anything about transparenty in any HUD ; /
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: KK20 on May 30, 2013, 03:56:22 pm
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.
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: Globock on May 30, 2013, 06:21:10 pm
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
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: KK20 on May 30, 2013, 06:45:07 pm
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.
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: Globock on May 30, 2013, 06:50:21 pm
It doesn't really work, picture is still normal when I walk under it ; /
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: KK20 on May 30, 2013, 06:57:22 pm
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?
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: Globock on May 30, 2013, 06:59:44 pm
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))"?
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: KK20 on May 30, 2013, 07:02:39 pm
Correct. Anything with '#' preceding words/code is considered a 'comment'.
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: Globock on May 30, 2013, 07:10:25 pm
Well, than I have no idea what can cause a problem
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: KK20 on May 30, 2013, 08:47:41 pm
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
(http://i1067.photobucket.com/albums/u430/kirbykid20/hotkeytest_zps2bab2eaf.png)
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: Globock on May 31, 2013, 04:41:02 am
I almost got it work!
Spoiler: ShowHide
(http://img818.imageshack.us/img818/6859/adsu.png)

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
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: Blizzard on May 31, 2013, 05:16:24 am
Please use spoilers for images. *fixes post*
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: KK20 on May 31, 2013, 05:41:48 pm
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.
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: Globock on May 31, 2013, 06:10:31 pm
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
(http://img195.imageshack.us/img195/3702/screenxy.png)
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: KK20 on May 31, 2013, 06:19:40 pm
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.
Title: Re: [RMXP] Blizz ABS hotkeys + transparent picture
Post by: Globock on May 31, 2013, 06:28:18 pm
You are just amazing, RESOLVED!