[XP] Action Recharge Times (for BABS)

Started by winkio, December 11, 2008, 07:25:43 pm

Previous topic - Next topic

KK20

Not sure how this edit worked, but it looked like it did its job.

In the Cooldown script, locate the class Hotkey_Assignment_Recharge and delete everything below that. Replace with this:
Hotkey_Assignment_Recharge: ShowHide
class Hotkey_Assignment_Recharge < Sprite
 
  attr_reader :skillrecharge
  attr_reader :itemrecharge
  attr_reader :chargebitmaps
  #----------------------------------------------------------------------------
  # Initialization
  #  viewport - the viewport for the sprite
  #----------------------------------------------------------------------------
  def initialize(x0, y0, z0, viewport = nil)
    # call superclass
    super(viewport)
    # create bitmap
    self.bitmap = Bitmap.new(48, 320)
    # set font name
    self.bitmap.font.name = 'Arial'
    # set font size
    self.bitmap.font.size = 16
    # set font to bold
    self.bitmap.font.bold = true
    # set x and y position
    self.x, self.y, self.z = x0, y0, z0+100
    # update display
    @actor = $game_player.battler
    @skillrecharge = []
    @itemrecharge = []
    (1...10).each {|i|
        @skillrecharge.push(i)
        @itemrecharge.push(i)}
    update
  end
  #----------------------------------------------------------------------------
  # 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(7, 32*(i-1), 32, 32, Color.new(0, 0, 0, 0))
        # draw recharge indicator
        len = (24*$game_player.rech_rate(ind)).to_i
        self.bitmap.fill_rect(7, 32*(i-1), len, 4, Color.new(255, 255, 0))
        # Draws black square over the skill/item graphic
  #KK20#      self.bitmap.fill_rect(7, 32*(i-1)+4, 24, 24, Color.new(0, 0, 0, 127))
        # draw time left of cooldown
        self.bitmap.draw_text_full(7, 32*(i-1)+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(7, 32*(i-1), 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(7, 32*(i-1), 32, 32, Color.new(0, 0, 0, 0))
        # draw recharge indicator
        len = (24*$game_player.rech_rate(ind)).to_i
        self.bitmap.fill_rect(7, 32*(i-1), len, 4, Color.new(255, 255, 0))
        # Draws black square over the skill/item graphic
#KK20#       self.bitmap.fill_rect(7, 32*(i-1)+4, 24, 24, Color.new(0, 0, 0, 127))
        # draw time left of cooldown
        self.bitmap.draw_text_full(7, 32*(i-1)+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(7, 32*(i-1), 32, 32, Color.new(0, 0, 0, 0))
        end
        @itemrecharge.delete(i)
      end}
  end
  #----------------------------------------------------------------------------
  # update
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  def update
    if @actor != $game_player.battler
      # set new actor
      @actor = $game_player.battler
      @skillrecharge = []
      @itemrecharge = []
      self.bitmap.fill_rect(0, 0, 32, 320, Color.new(0, 0, 0, 0))
      (1...10).each {|i|
        @skillrecharge.push(i)
        @itemrecharge.push(i)}
      draw
    end
    draw if test_recharge
  end
  #----------------------------------------------------------------------------
  # test_recharge
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  def test_recharge
    BlizzABS::Cache::HotkeyRange.each {|i|
      if $game_player.skill_hotkeys[i%10] != 0 and !@skillrecharge.include?(i)
        ind = $game_player.skill_hotkeys[i%10]+1
        if $game_player.recharging?(ind)
          @skillrecharge.push(i)
          return true
        end
      elsif $game_player.item_hotkeys[i%10] != 0 and !@itemrecharge.include?(i)
        ind = $game_player.item_hotkeys[i%10]+1
        if $game_player.recharging?(ind)
          @itemrecharge.push(i)
          return true
        end
      end}
    return false if @skillrecharge.size < 1 and @itemrecharge.size < 1
    return true
  end
  #----------------------------------------------------------------------------
  # bitmap_square_sect
  #  w          - width
  #  rate       - fill rate
  #  color    - color
  #  Draws the HUD gradient bar.
  #  This was going to be used a recharge graphic, but it lagged.  I included
  #  the code in case someone ever wanted to use it or fixes the lag.
  #----------------------------------------------------------------------------
  def bitmap_square_sect(w, rate)
    b = Bitmap.new(w, w)
    return b if rate <= 0.0 or rate > 1.0
    color = Color.new(0, 0, 0, 127)
    (0...23).each {|x|
      (0...23).each {|y|
        angle = (Math.atan2(x-w/2, y-w/2) + 6*Math::PI/2)%(2*Math::PI)
        b.set_pixel(x, y, color) if angle <= 2*Math::PI*rate}}
    return b
  end
end

I also added my "darken the icon graphic when in cooldown" bit in there. CTRL+F for #KK20# and delete that bit if you want to use them.

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!

Kirye

Works great! Thanks alot man! :D

Is it too soon for me to say that I love you?

Spoiler: ShowHide

Kirye

Sorry to necro this again, but I had another question. D: So i've been trying to find a way to manually make it so that a skill is considered "used" and activates its recharge time. The reason why i've been trying to do this, is that combos aren't registered as using the skill, so they can be spammed.

So far I found a temporary fix, but it severely limits the creativity I can put into a combo. So yeah, if there was a script call or something that would automatically put that skill on cooldown mode, that would be amazing.

Spoiler: ShowHide

KK20

Make the combo force the use of itself. If Skill ID 57 triggers Combo 1, have Combo 1 force the use of Skill 57.
Unless that's not what you're asking for...

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!

Kirye

Quote from: KK20 on April 29, 2012, 10:35:49 pm
Make the combo force the use of itself. If Skill ID 57 triggers Combo 1, have Combo 1 force the use of Skill 57.
Unless that's not what you're asking for...


That's actually the temporary fix i've been using. The problem is that it still somewhat limits what I can do with the skill. D: You can't force the game to use certain skills through combos if I remember right.

Spoiler: ShowHide

KK20

Force the use of a skill in a combo (copypasta):
In an uneditted Blizz ABS, go to line 1176. You should see this:
      when COMSkill # skill [int]
        # use skill
        @ch.use_skill($data_skills[command[1]])
Change it to this:
      when COMSkill # skill [int]
        # use skill
        @ch.use_skill($data_skills[command[1]], true)


Trying to understand what you mean by limiting.

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!

Kiwa

March 17, 2013, 06:37:35 am #86 Last Edit: March 17, 2013, 09:47:21 am by Kiwa
So i have been reading this... ahh yes interesting.
Originally i wanted something similar to what others are requesting.

A greyed out icon was one of those things.
I also wanted to relocate the counter to dead center of the greyed out icon.

i failed to create that. i did manage to move the counter to the center of the icon..but for some reason only half the number would show. (IE: the top half of the number 5 and a little to none of the curl at the bottom)

so i decided to check the forums for an answer. to my surprise this was abuzz with new posts.
I thought YES! someone requested what i want without it having to be me!!
so i quickly copied your script KK20.
and plugged it in just as you instructed on this page.

to my surprise... all i see the yellow bar counting down.. no number and no grey icon.
did i mess something up or over look something?


****EDIT****
After with futzing with it more (wiping it out and starting anew)...
I found the timer bar and counter and grey box off in a corner somewhere lol. gonna try to relocate it...

****EDIT****
I now see that's code for the vertically stacked hotkeys. I was looking for the stock BABS model with your addition. i tried to add it.. its sorta working its getting closer.. the square is a bit large i think and not centered on the hotkey icon.




KK20

Go to page 4 of this thread. It's there ;)

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!

Kiwa

I pasted that code
Spoiler: ShowHide

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


in and replaced what i had here that i modded on my own (with the #KK20 line).
Surprised me that its doing the exact same thing i was having an issue with. its still not alined properly.
i need to move the entire "code" down 16 pixels and right 18 pixels. (so says my very skilled and accurate MS paint skills.) id like the pic but i don't have a photo bucket or any account like that.

but no matter what i modded in that section of the code...it wouldn't budge the alignment for me.

Now maybe guide me a bit so i can learn. i understood this
self.bitmap.fill_rect(x, y, width, height, Color.new(0, 0, 0))

when i change either X or Y ...it will not move from its location and that's what i cant understand. is it somewhere else in the script?
any help is appreciated.

Thanks :D

KK20

If you are using an uneditted Blizz-ABS/default hotkey UI and you replaced the draw method in this script with my edit, it should all work out fine.

I also have the entire script edit here, so all you would have to do is replace the existing one with this:
Spoiler: ShowHide
Code: ruby

#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# Blizz-ABS Action Recharge Time by Winkio
# Version: 1.11
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
#
#
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# This script modifies the Blizz-ABS system to allow for recharge times.  These
# times are graphically represented on the hotkey bar
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
module BlizzABS
  #-----------------------------------------------------------------------------
  # configure recharge times like everything else.
  # put in the number of frames (40 = 1 second)
  #-----------------------------------------------------------------------------
  module Weapons
    def self.recharge(id)
      case id
      when 1 then return 0
      end
      return 0
    end
  end
  module Skills
    def self.recharge(id)
      case id
      when 1 then return 80
      end
      return 80
    end
  end
  module Items
    def self.recharge(id)
      case id
      when 1 then return 40
      end
      return 40
    end
  end
  module Enemies
    def self.recharge(id)
      case id
      when 1 then return 0
      end
      return 0
    end
  end
end

class Map_Battler
  attr_reader :recharge
  attr_reader :rechcounter
  attr_reader :rechcheck
 
  #----------------------------------------------------------------------------
  # Initialize
  #----------------------------------------------------------------------------
  alias initialize_recharge_later initialize
  def initialize
    @rechcounter = [0, 0] #attack, defend
    (0...999).each {|i| @rechcounter.push(0)} #500 skills and 500 items
    @recharge = @rechcounter.clone
    @recheck = []
    initialize_recharge_later
  end
  #----------------------------------------------------------------------------
  # Recharging
  #----------------------------------------------------------------------------
  def recharging?(index)
    return (@rechcounter[index] > 0)
  end
  #----------------------------------------------------------------------------
  # Recharge Rate
  #----------------------------------------------------------------------------
  def rech_rate(index)
    return 0.0 if @recharge[index] == 0
    return (@rechcounter[index].to_f/@recharge[index].to_f)
  end
  #----------------------------------------------------------------------------
  # attack_can_use?
  #----------------------------------------------------------------------------
  alias attack_can_use_recharge_later? attack_can_use?
  def attack_can_use?
    return (!recharging?(0) && attack_can_use_recharge_later?)
  end
  #----------------------------------------------------------------------------
  # skill_can_use?
  #----------------------------------------------------------------------------
  alias skill_can_use_recharge_later? skill_can_use?
  def skill_can_use?(id, forced = false)
    return (!recharging?(1+id) && skill_can_use_recharge_later?(id, forced))
  end
  #----------------------------------------------------------------------------
  # item_can_use?
  #----------------------------------------------------------------------------
  alias item_can_use_recharge_later? item_can_use?
  def item_can_use?(id, forced = false)
    return (!recharging?(501+id) && item_can_use_recharge_later?(id, forced))
  end
end

class Map_Actor
  #----------------------------------------------------------------------------
  # Update
  #----------------------------------------------------------------------------
  alias upd_recharger_later update
  def update
    @recheck.each {|i|
      if recharging?(i)
        @rechcounter[i] -= 1
      else
        @recheck.delete(i)
      end}
    upd_recharger_later
  end
  #----------------------------------------------------------------------------
  # Attack Penalty
  #----------------------------------------------------------------------------
  alias attack_penalty_recharger_later attack_penalty
  def attack_penalty
    re = BlizzABS::Weapons.recharge(@battler.weapon_id)
    @recharge[0], @rechcounter[0] = re, re
    @recheck.push(0)
    return attack_penalty_recharger_later
  end
  #----------------------------------------------------------------------------
  # Skill Penalty
  #----------------------------------------------------------------------------
  alias skill_penalty_recharger_later skill_penalty
  def skill_penalty(id)
    re = BlizzABS::Skills.recharge(id)
    @recharge[1+id], @rechcounter[1+id] = re, re
    @recheck.push(1+id)
    return skill_penalty_recharger_later(id)
  end
  #----------------------------------------------------------------------------
  # Item Penalty
  #----------------------------------------------------------------------------
  alias item_penalty_recharger_later item_penalty
  def item_penalty(id)
    re = BlizzABS::Items.recharge(id)
    @recharge[501+id], @rechcounter[501+id] = re, re
    @recheck.push(501+id)
    return item_penalty_recharger_later(id)
  end
end


class Map_Enemy
  #----------------------------------------------------------------------------
  # Update
  #----------------------------------------------------------------------------
  alias upd_recharger_later update
  def update
    @recheck.each {|i|
      if recharging?(i)
        @rechcounter[i] -= 1
      else
        @recheck.delete(i)
      end}
    upd_recharger_later
  end
  #----------------------------------------------------------------------------
  # Attack Penalty
  #----------------------------------------------------------------------------
  alias attack_penalty_recharger_later attack_penalty
  def attack_penalty
    re = BlizzABS::Enemies.recharge(@battler.weapon_id)
    @recharge[0], @rechcounter[0] = re, re
    @recheck.push(0)
    return attack_penalty_recharger_later
  end
  #----------------------------------------------------------------------------
  # Skill Penalty
  #----------------------------------------------------------------------------
  alias skill_penalty_recharger_later skill_penalty
  def skill_penalty(id)
    re = BlizzABS::Skills.recharge(id)
    @recharge[1+id], @rechcounter[1+id] = re, re
    @recheck.push(1+id)
    return skill_penalty_recharger_later(id)
  end
  #----------------------------------------------------------------------------
  # Item Penalty
  #----------------------------------------------------------------------------
  alias item_penalty_recharger_later item_penalty
  def item_penalty(id)
    re = BlizzABS::Items.recharge(id)
    @recharge[501+id], @rechcounter[501+id] = re, re
    @recheck.push(501+id)
    return item_penalty_recharger_later(id)
  end
end



class Hotkey_Assignment < Sprite
 
  attr_accessor :recharge
  alias initialize_recharge_later initialize
  def initialize(viewport = nil)
    initialize_recharge_later(viewport)
    @recharge = Hotkey_Assignment_Recharge.new(self.x, self.y, self.z)
   
  end
  #----------------------------------------------------------------------------
  # update
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  alias update_recharge_later update
  def update
    update_recharge_later
    if @recharge != nil
      @recharge.update
    end
  end
  #----------------------------------------------------------------------------
  # dispose
  #  Removes recharge time graphics from screen and memory.
  #----------------------------------------------------------------------------
  alias dispose_recharge_later dispose
  def dispose
    @recharge.dispose
    dispose_recharge_later
  end
end

class Hotkey_Assignment_Recharge < Sprite
 
  attr_reader :skillrecharge
  attr_reader :itemrecharge
  attr_reader :chargebitmaps
  #----------------------------------------------------------------------------
  # Initialization
  #  viewport - the viewport for the sprite
  #----------------------------------------------------------------------------
  def initialize(x0, y0, z0, viewport = nil)
    # call superclass
    super(viewport)
    # create bitmap
    self.bitmap = Bitmap.new(320, 32)
    # set font name
    self.bitmap.font.name = 'Arial'
    # set font size
    self.bitmap.font.size = 16
    # set font to bold
    self.bitmap.font.bold = true
    # set x and y position
    self.x, self.y, self.z = x0, y0, z0+100
    # update display
    @actor = $game_player.battler
    @skillrecharge = []
    @itemrecharge = []
    (1...10).each {|i|
        @skillrecharge.push(i)
        @itemrecharge.push(i)}
    update
  end
  #----------------------------------------------------------------------------
  # 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.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
        @itemrecharge.delete(i)
      end}
  end
  #----------------------------------------------------------------------------
  # update
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  def update
    if @actor != $game_player.battler
      # set new actor
      @actor = $game_player.battler
      @skillrecharge = []
      @itemrecharge = []
      self.bitmap.fill_rect(0, 0, 320, 32, Color.new(0, 0, 0, 0))
      (1...10).each {|i|
        @skillrecharge.push(i)
        @itemrecharge.push(i)}
      draw
    end
    draw if test_recharge
  end
  #----------------------------------------------------------------------------
  # test_recharge
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  def test_recharge
    BlizzABS::Cache::HotkeyRange.each {|i|
      if $game_player.skill_hotkeys[i%10] != 0 and !@skillrecharge.include?(i)
        ind = $game_player.skill_hotkeys[i%10]+1
        if $game_player.recharging?(ind)
          @skillrecharge.push(i)
          return true
        end
      elsif $game_player.item_hotkeys[i%10] != 0 and !@itemrecharge.include?(i)
        ind = $game_player.item_hotkeys[i%10]+1
        if $game_player.recharging?(ind)
          @itemrecharge.push(i)
          return true
        end
      end}
    return false if @skillrecharge.size < 1 and @itemrecharge.size < 1
    return true
  end
  #----------------------------------------------------------------------------
  # bitmap_square_sect
  #  w          - width
  #  rate       - fill rate
  #  color    - color
  #  Draws the HUD gradient bar.
  #  This was going to be used a recharge graphic, but it lagged.  I included
  #  the code in case someone ever wanted to use it or fixes the lag.
  #----------------------------------------------------------------------------
  def bitmap_square_sect(w, rate)
    b = Bitmap.new(w, w)
    return b if rate <= 0.0 or rate > 1.0
    color = Color.new(0, 0, 0, 127)
    (0...23).each {|x|
      (0...23).each {|y|
        angle = (Math.atan2(x-w/2, y-w/2) + 6*Math::PI/2)%(2*Math::PI)
        b.set_pixel(x, y, color) if angle <= 2*Math::PI*rate}}
    return b
  end
end

If after all of that still doesn't work, I'd need to see pictures (better make that photobucket account--really it only takes a minute) or a demo.

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!

Kiwa

March 18, 2013, 11:19:12 pm #90 Last Edit: March 19, 2013, 01:56:35 am by Kiwa
Yeah its still doing it. thats what i had plugged in..
I must have done something wrong.

Im currently checking and writing this on a shot intermission at work.
I will make a photobucket and dump a photo and link it in when i have a chance.

Kiwa

March 19, 2013, 01:04:31 am #91 Last Edit: March 19, 2013, 01:59:00 am by Kiwa
Here it is.

you can see the timers wont center and i cant figure out why. i dont think i used anything to modify the hoykeys.
the only UI mod i have is the hud mod.
I do see 1 and 0 are far off from the same missalignment.
but i dont know if its related to the HUD...
):




***Edit***
Im using
Blizz-ABS Party HUD++ Landith
Version: 1.00

and its beautiful. but maybe its the culprit.

LiTTleDRAgo

Landith hud is rewriting some methods, you should try to place it right below Blizz ABS and above Action Recharge script

Kiwa

March 19, 2013, 04:21:55 am #93 Last Edit: March 19, 2013, 04:36:18 am by Kiwa
Thanks for the reply DRAgo. I rearranged the scripts to how i understood it from the post. it didn't seem to change anything.
So i whipped together a list of the scripts i am using in order.

Gameguy: level EXP reset
Blizz ABS 1
Blizz ABS 2
Blizz ABS 3
Landith: Blizz-ABS Party HUD++
Winkio: Action Recharge Time
LiTTleDRAgo: Smart Auto Targeting
LiTTleDRAgo: DRG Inventory System (its so beautiful)
Fantasist: Threat System (skills configured but not yet moded for BABS. tho i want it so hard lol.)
LiTTleDRAgo: Item Art Color  (playing with both DRAgo and Gameguys in the same slot, Currently have DRAgos plugged in)
Falcon: Tax Script

***EDIT***
I forgot to note. if i switch positions of the HUD and CD timers there are no CD timers in sight lol.

***EDIT 2***
So i removed the HUD entirely and it relocated and worked perfectly.
i was hoping to use this HUD and i intend to make this whole game work with Blizz's online system.
i have so many plans...sorry im making it hard eh?

My point is that if the hud will be overwritten by a default one with the OS this is fruitless.

KK20

No wonder why you had me all confused; I said the stock/default Blizz-ABS hotkey UI, not a custom one :wacko:

This worked for me:
Spoiler: ShowHide
Code: ruby

#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# Blizz-ABS Action Recharge Time by Winkio
# Version: 1.11
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
#
#
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# This script modifies the Blizz-ABS system to allow for recharge times.  These
# times are graphically represented on the hotkey bar
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
module BlizzABS
  #-----------------------------------------------------------------------------
  # configure recharge times like everything else.
  # put in the number of frames (40 = 1 second)
  #-----------------------------------------------------------------------------
  module Weapons
    def self.recharge(id)
      case id
      when 1 then return 0
      end
      return 0
    end
  end
  module Skills
    def self.recharge(id)
      case id
      when 1 then return 80
      end
      return 80
    end
  end
  module Items
    def self.recharge(id)
      case id
      when 1 then return 40
      end
      return 40
    end
  end
  module Enemies
    def self.recharge(id)
      case id
      when 1 then return 0
      end
      return 0
    end
  end
end

class Map_Battler
  attr_reader :recharge
  attr_reader :rechcounter
  attr_reader :rechcheck
 
  #----------------------------------------------------------------------------
  # Initialize
  #----------------------------------------------------------------------------
  alias initialize_recharge_later initialize
  def initialize
    @rechcounter = [0, 0] #attack, defend
    (0...999).each {|i| @rechcounter.push(0)} #500 skills and 500 items
    @recharge = @rechcounter.clone
    @recheck = []
    initialize_recharge_later
  end
  #----------------------------------------------------------------------------
  # Recharging
  #----------------------------------------------------------------------------
  def recharging?(index)
    return (@rechcounter[index] > 0)
  end
  #----------------------------------------------------------------------------
  # Recharge Rate
  #----------------------------------------------------------------------------
  def rech_rate(index)
    return 0.0 if @recharge[index] == 0
    return (@rechcounter[index].to_f/@recharge[index].to_f)
  end
  #----------------------------------------------------------------------------
  # attack_can_use?
  #----------------------------------------------------------------------------
  alias attack_can_use_recharge_later? attack_can_use?
  def attack_can_use?
    return (!recharging?(0) && attack_can_use_recharge_later?)
  end
  #----------------------------------------------------------------------------
  # skill_can_use?
  #----------------------------------------------------------------------------
  alias skill_can_use_recharge_later? skill_can_use?
  def skill_can_use?(id, forced = false)
    return (!recharging?(1+id) && skill_can_use_recharge_later?(id, forced))
  end
  #----------------------------------------------------------------------------
  # item_can_use?
  #----------------------------------------------------------------------------
  alias item_can_use_recharge_later? item_can_use?
  def item_can_use?(id, forced = false)
    return (!recharging?(501+id) && item_can_use_recharge_later?(id, forced))
  end
end

class Map_Actor
  #----------------------------------------------------------------------------
  # Update
  #----------------------------------------------------------------------------
  alias upd_recharger_later update
  def update
    @recheck.each {|i|
      if recharging?(i)
        @rechcounter[i] -= 1
      else
        @recheck.delete(i)
      end}
    upd_recharger_later
  end
  #----------------------------------------------------------------------------
  # Attack Penalty
  #----------------------------------------------------------------------------
  alias attack_penalty_recharger_later attack_penalty
  def attack_penalty
    re = BlizzABS::Weapons.recharge(@battler.weapon_id)
    @recharge[0], @rechcounter[0] = re, re
    @recheck.push(0)
    return attack_penalty_recharger_later
  end
  #----------------------------------------------------------------------------
  # Skill Penalty
  #----------------------------------------------------------------------------
  alias skill_penalty_recharger_later skill_penalty
  def skill_penalty(id)
    re = BlizzABS::Skills.recharge(id)
    @recharge[1+id], @rechcounter[1+id] = re, re
    @recheck.push(1+id)
    return skill_penalty_recharger_later(id)
  end
  #----------------------------------------------------------------------------
  # Item Penalty
  #----------------------------------------------------------------------------
  alias item_penalty_recharger_later item_penalty
  def item_penalty(id)
    re = BlizzABS::Items.recharge(id)
    @recharge[501+id], @rechcounter[501+id] = re, re
    @recheck.push(501+id)
    return item_penalty_recharger_later(id)
  end
end


class Map_Enemy
  #----------------------------------------------------------------------------
  # Update
  #----------------------------------------------------------------------------
  alias upd_recharger_later update
  def update
    @recheck.each {|i|
      if recharging?(i)
        @rechcounter[i] -= 1
      else
        @recheck.delete(i)
      end}
    upd_recharger_later
  end
  #----------------------------------------------------------------------------
  # Attack Penalty
  #----------------------------------------------------------------------------
  alias attack_penalty_recharger_later attack_penalty
  def attack_penalty
    re = BlizzABS::Enemies.recharge(@battler.weapon_id)
    @recharge[0], @rechcounter[0] = re, re
    @recheck.push(0)
    return attack_penalty_recharger_later
  end
  #----------------------------------------------------------------------------
  # Skill Penalty
  #----------------------------------------------------------------------------
  alias skill_penalty_recharger_later skill_penalty
  def skill_penalty(id)
    re = BlizzABS::Skills.recharge(id)
    @recharge[1+id], @rechcounter[1+id] = re, re
    @recheck.push(1+id)
    return skill_penalty_recharger_later(id)
  end
  #----------------------------------------------------------------------------
  # Item Penalty
  #----------------------------------------------------------------------------
  alias item_penalty_recharger_later item_penalty
  def item_penalty(id)
    re = BlizzABS::Items.recharge(id)
    @recharge[501+id], @rechcounter[501+id] = re, re
    @recheck.push(501+id)
    return item_penalty_recharger_later(id)
  end
end



class Hotkey_Assignment < Sprite
 
  attr_accessor :recharge
  alias initialize_recharge_later initialize
  def initialize(viewport = nil)
    initialize_recharge_later(viewport)
    @recharge = Hotkey_Assignment_Recharge.new(self.x, self.y, self.z)
   
  end
  #----------------------------------------------------------------------------
  # update
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  alias update_recharge_later update
  def update
    update_recharge_later
    if @recharge != nil
      @recharge.update
    end
  end
  #----------------------------------------------------------------------------
  # dispose
  #  Removes recharge time graphics from screen and memory.
  #----------------------------------------------------------------------------
  alias dispose_recharge_later dispose
  def dispose
    @recharge.dispose
    dispose_recharge_later
  end
end

class Hotkey_Assignment_Recharge < Sprite
 
  attr_reader :skillrecharge
  attr_reader :itemrecharge
  attr_reader :chargebitmaps
  #----------------------------------------------------------------------------
  # Initialization
  #  viewport - the viewport for the sprite
  #----------------------------------------------------------------------------
  def initialize(x0, y0, z0, viewport = nil)
    # call superclass
    super(viewport)
    # create bitmap
    self.bitmap = Bitmap.new(320, 45)
    # set font name
    self.bitmap.font.name = 'Arial'
    # set font size
    self.bitmap.font.size = 16
    # set font to bold
    self.bitmap.font.bold = true
    # set x and y position
    self.x, self.y, self.z = x0, y0, z0+100
    # update display
    @actor = $game_player.battler
    @skillrecharge = []
    @itemrecharge = []
    (1...10).each {|i|
        @skillrecharge.push(i)
        @itemrecharge.push(i)}
    update
  end
  #----------------------------------------------------------------------------
  # 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(30*(i-1)+22, 16, 28, 28, Color.new(0, 0, 0, 0))
        # draw recharge indicator
        len = (24*$game_player.rech_rate(ind)).to_i
        self.bitmap.fill_rect(30*(i-1)+22, 16, len, 4, Color.new(255, 255, 0))
        self.bitmap.fill_rect(30*(i-1)+22, 20, 24, 24, Color.new(0, 0, 0, 127))
        self.bitmap.draw_text_full(30*(i-1)+22, 20, 24, 24, (($game_player.rechcounter[ind]/40).to_i+1).to_s, 1)
      else
        if object != nil
          # remove old image
          self.bitmap.fill_rect(30*(i-1)+22, 16, 28, 28, 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(30*(i-1)+22, 16, 28, 28, Color.new(0, 0, 0, 0))
        # draw recharge indicator
        len = (24*$game_player.rech_rate(ind)).to_i
        self.bitmap.fill_rect(30*(i-1)+22, 16, len, 4, Color.new(255, 255, 0))
        self.bitmap.fill_rect(30*(i-1)+22, 20, 24, 24, Color.new(0, 0, 0, 127))
        self.bitmap.draw_text_full(30*(i-1)+22, 20, 24, 24, (($game_player.rechcounter[ind]/40).to_i+1).to_s, 1)
      else
        if object != nil
          # remove old image
          self.bitmap.fill_rect(30*(i-1)+22, 16, 28, 28, Color.new(0, 0, 0, 0))
        end
        @itemrecharge.delete(i)
      end}
  end
  #----------------------------------------------------------------------------
  # update
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  def update
    if @actor != $game_player.battler
      # set new actor
      @actor = $game_player.battler
      @skillrecharge = []
      @itemrecharge = []
      self.bitmap.fill_rect(0, 0, 320, 32, Color.new(0, 0, 0, 0))
      (1...10).each {|i|
        @skillrecharge.push(i)
        @itemrecharge.push(i)}
      draw
    end
    draw if test_recharge
  end
  #----------------------------------------------------------------------------
  # test_recharge
  #  Updates the hotkey display.
  #----------------------------------------------------------------------------
  def test_recharge
    BlizzABS::Cache::HotkeyRange.each {|i|
      if $game_player.skill_hotkeys[i%10] != 0 and !@skillrecharge.include?(i)
        ind = $game_player.skill_hotkeys[i%10]+1
        if $game_player.recharging?(ind)
          @skillrecharge.push(i)
          return true
        end
      elsif $game_player.item_hotkeys[i%10] != 0 and !@itemrecharge.include?(i)
        ind = $game_player.item_hotkeys[i%10]+1
        if $game_player.recharging?(ind)
          @itemrecharge.push(i)
          return true
        end
      end}
    return false if @skillrecharge.size < 1 and @itemrecharge.size < 1
    return true
  end
  #----------------------------------------------------------------------------
  # bitmap_square_sect
  #  w          - width
  #  rate       - fill rate
  #  color    - color
  #  Draws the HUD gradient bar.
  #  This was going to be used a recharge graphic, but it lagged.  I included
  #  the code in case someone ever wanted to use it or fixes the lag.
  #----------------------------------------------------------------------------
  def bitmap_square_sect(w, rate)
    b = Bitmap.new(w, w)
    return b if rate <= 0.0 or rate > 1.0
    color = Color.new(0, 0, 0, 127)
    (0...23).each {|x|
      (0...23).each {|y|
        angle = (Math.atan2(x-w/2, y-w/2) + 6*Math::PI/2)%(2*Math::PI)
        b.set_pixel(x, y, color) if angle <= 2*Math::PI*rate}}
    return b
  end
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!

Kiwa

Thanks a lot KK20. yeah sorry i had forgotten the HUD moved the hotkeys. completely my fault ...sorry for causing the headache to everyone.
This works great. im thinking i may toy around with it.. cuz on second thought i don't necessarily need the yellow timer bar.. (adds to lag me thinks)
i should just be able to pound it out as a comment.

im not sure i understand how it was moved correctly...
because i used this code
self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
when i modded the 32* to 30 it didn't budge.. and i changed the 0 to 15 ( just to see the movement patterns to troubleshoot it.)  and all i managed to do modding numbers was change the square to a rectangle... or gap them more..i was really baffled.

anyways. ill fiddle with it from here on out...
Thanks sooo much. my offer still stands :P

KK20

If I saw the context on how you used that code, I'd assist you with that. First off, Color.new(0,0,0,0) would not even create anything visible because of the 4th zero which sets the opacity level (0 = fully transparent, 255 = fully visible).

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!

Kiwa

Well yeah. the colors i understood. i left them as 0 just for the examples.

the code i had is already gone ..i pasted over it and closed the NotePad i had it pasted in....didint look back. lol
but my concern was why i couldn't get the box to draw in the proper spot. even when modifying it.
heres what i mean
self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))

i tried to modify "fill_rect(32*(i-1)" changing the 32* a a few different ways. if i went as low as 0 it caused an error. anything else it would either disappear or not move. even changing it to 36

i then tried to mod the next part "32, 32,"
i brought them as low as 0 and as high as 60. this changed teh size of the rectangle  not from its starting upper left corner.. but changed the upper right and lower right.

and this gave me my understanding of the command self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
was this
self.bitmap.fill_rect(x , y, Width, Height, Color.new(R, G, B, Opacity))

or something along those lines lol.

but i just couldn't get the upper left hand corner to move

KK20

I'd need to know where you put that line of code at; its location can mean basically everything.
You do understand the (i-1) is there because of the loop, right? To draw the 10 squares over the hotkey graphics, the loop runs through that line 10 times, setting i to equal 1 and increasing i by 1 each time it passes through. Thus, the first square will always have an X-Coordinate of 32*(1-1) = 32*(0) = 0. If you want to nudge it left or right more, a + or - after the parenthesis works, such as 32*(i-1)+4.

Probably best to move this over to PMs if you want to work on/understand this more.

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!

KK20

Just wanted to point this out: item cooldowns are not displayed over the hotkeys. This was brought to my attention from this post. It has been fixed and I updated the original post.

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!