[XP] Z-HUD for Blizz-ABS

Started by Blizzard, July 29, 2009, 04:34:54 pm

Previous topic - Next topic

KK20


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!

Moshan

 Thank you very much!
Now...I have another issue (sorry for bothering you guys :^_^':). I can't understand why modifying @exp_y still dosen't affect the exp bar position. It only works if I modify @exp_x. Any ideas?

KK20

That's handled in the method update_exp_y. If you're trying to change @exp_y in create_positions it's not going to work.

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!

Moshan

 Thank you again! You're the best!!! 8)

Moshan

January 26, 2014, 09:26:09 am #124 Last Edit: January 26, 2014, 10:03:58 am by adytza001
 Sorry again for asking stupid questions on inactive topics...but is there a way to disable that fade effect when walking under the hud?

EDIT: Also I'm trying to make one of the hp/sp bar to fill in the opposite direction of the other one. Is it possible? I think my problem can be solved somewhere here:
Spoiler: ShowHide
    else
     w1 = (b1.width * rate).to_i
     w2 = b2.width - w1
     self.bitmap.fill_rect(@sp_x, @sp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
     self.bitmap.blt(@sp_x, @sp_y, b1, Rect.new(0, 0, w1, b1.height))
     self.bitmap.blt(@sp_x + w1, @sp_y, b2, Rect.new(w1, 0, w2, b2.height))
   end
 end


  EDIT #2 :
 
  Now I've found another issue...If i use a Z_HUD_BACKGROUND my hotkey bar is behind the background. Can I bring it in front of it? Also can I make the space between hotkeys bigger?

Thanks in advance!

KK20

No Opacity Change: ShowHide
Place below BlizzABS

class Scene_Map
  #----------------------------------------------------------------------------
  # hud_update
  #  Contains a couple of routine calls to handle with the HUD.
  #----------------------------------------------------------------------------
  def hud_update
    # check activation of HUD parts
    check_huds
    # update minimap
    update_minimap
    # update hotkey assignment display
    update_hotkeys
    # iterate through all the HUD sprites
    [@hud, @minimap, @hotkeys].each {|s|
      # if sprite exists
      if s != nil
        # update sprite
        s.update
      end
    }
  end
end


Yes, you are correct. It's merely the opposite of what you see.
Spoiler: ShowHide

      w1 = (b1.width * rate).to_i
      w2 = b2.width - w1
      self.bitmap.fill_rect(@hp_x, @hp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
      self.bitmap.blt(@hp_x + w2, @hp_y, b1, Rect.new(w2, 0, w1, b1.height))
      self.bitmap.blt(@hp_x, @hp_y, b2, Rect.new(0, 0, w2, b2.height))


You'll need to explain your HUD background more. I can see my hotkeys perfectly fine (as well as the image held in Z_HOTKEYS_BACK ). I'm also pretty sure I have explained to you before about how to change the spacing between the hotkeys.

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!

Moshan

 Firstly, thank you very very much for helping me...again. I do not know what I would have done without you.

Secondly, the opacity thing works, but the hp/sp bar code is not working. I've edited the hp_x,hp_y etc. for the sp bar but it's not even working for neither of them (with proper modification for hp/sp). 

Lastly, regarding the spacing between the hotkeys, I forgot to inform you that I've tried what you first showed me:
Quote from: KK20 on September 05, 2011, 02:46:29 pm
Interesting, because mine didn't do that. Your edit looks like this, right?:
  #----------------------------------------------------------------------------
  # draw
  #  Draws the recharge sectors over the hotkey display.
  #----------------------------------------------------------------------------
  def draw(index = nil)
    # iterate through all skills that need to be recharged
    (@skillrecharge).each {|i|
      # temporary var
      object = $data_skills[$game_player.skill_hotkeys[i%10]]
      ind = $game_player.skill_hotkeys[i%10]+1
      if $game_player.recharging?(ind)
        # remove old image
        self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
        # draw recharge indicator
        len = (24*$game_player.rech_rate(ind)).to_i
        self.bitmap.fill_rect(32*(i-1)+4, 0, len, 4, Color.new(255, 255, 0))
        self.bitmap.fill_rect(32*(i-1)+4, 4, 24, 24, Color.new(0, 0, 0, 127))
        self.bitmap.draw_text_full(32*(i-1)+4, 4, 24, 24, (($game_player.rechcounter[ind]/40).to_i+1).to_s, 1)
      else
        if object != nil
          # remove old image
          self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
        end
        @skillrecharge.delete(i)
      end}
    # iterate through all items that need to be recharged
    (@itemrecharge).each {|i|
      # temporary var
      object = $data_items[$game_player.item_hotkeys[i%10]]
      ind = $game_player.item_hotkeys[i%10]+1
      if $game_player.recharging?(ind)
        # remove old image
        self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
        # draw recharge indicator
        len = (24*$game_player.rech_rate(ind)).to_i
        self.bitmap.fill_rect(32*(i-1)+4, 0, len, 4, Color.new(255, 255, 0))
        self.bitmap.draw_text_full(32*(i-1)+4, 4, 24, 24, (($game_player.rechcounter[ind]/40).to_i+1).to_s, 1)
      else
        if object != nil
          # remove old image
          self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
        end
        @itemrecharge.delete(i)
      end}
  end
Your hotkeys look customized. If so, the spacing between the hotkeys could be different than the default ones. In that case, you will have to change the four in 32*(i-1)+4 into something smaller I think.

 
  And this time, changing  32*(i-1)+4 does nothing. I think it's because of the Z-Hud that rewrites the way of displaying the hotkeys (just my guess)
  I've sent you a message with a link to download an example of my project. Maybe you can easily understand what I want if you see it.
  Thanks again! I can't wait to hear from you!

KK20

January 29, 2014, 03:06:57 pm #127 Last Edit: January 29, 2014, 03:17:13 pm by KK20
HP/SP Graphic:
Your empty graphics should be the same dimensions as the full graphics. Also, your edit to the drawing coordinates didn't look anything like what I posted.

      w1 = (b1.width * rate).to_i
      w2 = b1.width - w1
      self.bitmap.fill_rect(@sp_x, @sp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
      self.bitmap.blt(@sp_x + w2, @sp_y, b1, Rect.new(w2, 0, w1, b1.height))
      self.bitmap.blt(@sp_x, @sp_y, b2, Rect.new(0, 0, w2, b2.height))

Spacing:
You're referencing the skill cooldown script by winkio. That code only moves the cooldown-related graphics (rectangle timer, black overlay, etc.). It doesn't modify the hotkeys' coordinates themselves. You will want to edit this under Hotkey_Assignment:
Spoiler: ShowHide

 def draw(index = nil)
   back = RPG::Cache.picture(BlizzCFG::Z_HOTKEYS_BACK)
   w, h = back.width, back.height
   ow, oh = (w - 24) / 2, (h - 24) / 2
   (index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
       if $game_player.skill_hotkeys[i%10] != 0
         object = $data_skills[$game_player.skill_hotkeys[i%10]]
       elsif $game_player.item_hotkeys[i%10] != 0
         object = $data_items[$game_player.item_hotkeys[i%10]]
       end
       if @items[i%10] != $game_player.item_hotkeys[i%10] ||
           @skills[i%10] != $game_player.skill_hotkeys[i%10]
         self.bitmap.fill_rect(w*(i-1)+4, 0, w, h, Color.new(0, 0, 0, 0))  #<==== These lines
         self.bitmap.blt(w*(i-1)+4, 0, back, Rect.new(0, 0, w, h))         #<====
         if object != nil
           bitmap = RPG::Cache.icon(object.icon_name)
           self.bitmap.blt(w*(i-1)+ow+4, oh+1, bitmap, Rect.new(0, 0, 24, 24))  #<====
         end
         self.bitmap.draw_text_full(w*(i-1)+4, 0, w-2, 65, (i%10).to_s, 1)        #<====
       end}
   @items = $game_player.item_hotkeys.clone
   @skills = $game_player.skill_hotkeys.clone
 end


As for the background drawing over the hotkeys, it was a matter of z-values.
Spoiler: ShowHide


class Hotkey_Assignment
 
 def initialize(viewport = nil)
   super
   self.bitmap = Bitmap.new(438, 55)
   self.bitmap.font.bold = true
   self.bitmap.font.size -= 4
   self.bitmap.font.color = system_color
   self.x, self.y, self.z = 292, 491, 110      #<======= This should be 1100. No idea how this was changed.
   @skills = BlizzABS::Cache::EmptyKeys
   @items = BlizzABS::Cache::EmptyKeys
   update
 end

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!

Moshan

 Tons of thanks, my dear scripter! :-*

Everything works...except the spacing between hotkeys. I'm trying to change this values : w*(i-1)+4 in all that 4 lines but it's not working. It just moves all the hotkeys to right or to left. It does not increase the space between them. I can't really understand how might work, because I've also try to test the lines one by one but I cant get the desired effect. It's really annoying...am I modyifing the right value?

Also the hp/sp works now but strangely the empty bar should be named like the normal one and viceversa. But works for me...no issue!

KK20

January 29, 2014, 03:39:04 pm #129 Last Edit: January 29, 2014, 03:42:36 pm by KK20
:roll: Oh yeah, forgot that I changed the bitmaps.

     w1 = (b1.width * rate).to_i
     w2 = b2.width - w1
     self.bitmap.fill_rect(@sp_x, @sp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
     self.bitmap.blt(@sp_x + w2, @sp_y, b1, Rect.new(w2, 0, w1, b1.height))
     self.bitmap.blt(@sp_x, @sp_y, b2, Rect.new(0, 0, w2, b2.height))

And I guess you should modify this line for the hotkeys

   w, h = back.width, back.height

to something like

   w, h = back.width + 5, back.height + 5

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!

Moshan

  ( Me trying to imitate a lady voice singing for KK20: "You're simply the beeeest!" )
 
  Yep. That line was the pain...Thank you again! If I can do something for you just PM me! I'll try to make it up to you.

fjshrr5

Sorry to necro, I seem to be having a problem with the copy/paste breaking the script..