Action Recharge Times
Authors: winkio
Version: 1.11
Type: Misc. Add-on
Key Term: Blizz-ABS Plugin
IntroductionThis script adds the function of recharge times for weapons, items, skills, and enemy attacks to Blizz-ABS.
Features
- Recharge times for weapons, items, skills, and enemy attacks
- Works with custom HUDs
- Recharge bar and number counter
ScreenshotsNote: this screenshot also features my custom HUD, but this script works without it.
(http://christiansenryan.googlepages.com/ART2.jpg)
Script
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# 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 800
end
return 800
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.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]+501
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
#----------------------------------------------------------------------------
# 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]+501
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
InstructionsPUT BELOW BLIZZ-ABS
Configure the recharge times like they are in Blizz-ABS. What that means in for each skill/item/weapo/enemy, under the appropriate area, put in
when (ID OF SKILL/ITEM/WEAPON/ENEMY) then return (RECHARGE TIME)
The recharge time is in frames. 40 frames is about 1 second.
CompatibilityMade for Blizz-ABS 2.82 and above.
Credits and Thanks
- Blizzard for setting down some main code
- Aqua for testing it and telling me all my stupid mistakes
- winkio
Author's NotesJust a note: it seems to lag very slightly if a lot of stuff is recharging at once, like 5 or more things.
If you have any ideas for other ways to show something recharging that you want implemented, let me know. I originally had a spiral recharge thing like most MMOs do (WoW and Guild Wars, for example), but it lagged too much. I will look into ways to reduce that lag, but it may not be possible.
I actually made a plugin for that. I just can't remember for whom it was. >.< I think it was NAMKCOR. Anyway, I promised not to release it. ._. You should ask him if it's ok with him. Or wait until I implement it into Blizz-ABS. >.<
I think it's all right. I don't want to get you in trouble (although I don't know why the person would think that recharge times are so original) but I figured it out from the AI triggers :P
(don't know why I didn't look there earlier)
So... once I end up getting this to work, will it be allowed for me to post it up? Because this is kind of independent...
And if I do end up posting this up, will you just put yours up too thereby nullifying mine? In which case, it wouldn't even be worth it to develop it on my own...
I'll pm Namkcor and see what he thinks as well.
Quote from: Blizzard on December 12, 2008, 05:23:55 am
I actually made a plugin for that. I just can't remember for whom it was. >.< I think it was NAMKCOR. Anyway, I promised not to release it. ._. You should ask him if it's ok with him. Or wait until I implement it into Blizz-ABS. >.<
Blizz, go ahead and release it
Alright, here you go:
class BlizzABS::Cache
alias init_recharger_later initialize
def initialize
init_recharger_later
@data['empty_hud_yellow_bar'] = @data['empty_hud_green_bar'].clone
@data['empty_hud_yellow_bar'].hue_change(-60)
@data['hud_yellow_bar'] = @data['hud_green_bar'].clone
@data['hud_yellow_bar'].hue_change(-60)
#p 1
#p self.image('hud_yellow_bar')
end
end
$BlizzABS = BlizzABS::Processor.new
class Recharger < Sprite
def initialize
super
self.bitmap = Bitmap.new(156, 14)
color = case BlizzABS::Config::HUD_TYPE
when 0 then Color.new(255, 255, 255, 192)
when 1 then Color.new(0, 0, 0, 0)
end
self.bitmap.fill_rect(0, 0, 156, 14, color) if color.is_a?(Color)
self.x = 4
update
end
def update
super
now, full = $game_player.recharge
self.bitmap.gradient_bar_hud(0, 0, 154, now.to_f/full, 'hud_yellow_bar')
self.dispose if !$game_player.recharging?
end
end
class Scene_Map
alias main_recharger_later main
def main
@recharge_bar = Recharger.new if $game_player.recharging?
main_recharger_later
@recharge_bar.dispose if @recharge_bar != nil
end
alias upd_recharger_later update
def update
if $game_player.recharging? && @recharge_bar == nil
@recharge_bar = Recharger.new
end
upd_recharger_later
if @recharge_bar != nil
if @hud != nil
@recharge_bar.y = @hud.y + @hud.bitmap.height + 4
else
@recharge_bar.y = 4
end
@recharge_bar.update
@recharge_bar = nil if @recharge_bar.disposed?
end
end
end
class Map_Battler
attr_reader :recharge
alias upd_recharger_later update
def update
@recharge[0] -= 1 if recharging?
upd_recharger_later
end
alias freeze_action_recharger_later freeze_action
def freeze_action
return (freeze_action_recharger_later || recharging?)
end
alias skill_penalty_recharger_later skill_penalty
def skill_penalty(id)
re = BlizzABS::Skills.recharge(id)
@recharge = [re, re]
return skill_penalty_recharger_later(id)
end
alias item_penalty_recharger_later item_penalty
def item_penalty(id)
re = BlizzABS::Skills.recharge(id)
@recharge = [re, re]
return item_penalty_recharger_later(id)
end
def recharging?
return (@recharge != nil && @recharge[0] > 0)
end
end
class Map_Actor
alias attack_penalty_recharger_later attack_penalty
def attack_penalty
re = BlizzABS::Weapons.recharge(@battler.weapon_id)
@recharge = [re, re]
return attack_penalty_recharger_later
end
end
class Map_Enemy
alias attack_penalty_recharger_later attack_penalty
def attack_penalty
re = BlizzABS::Enemies.recharge(@battler.weapon_id)
@recharge = [re, re]
return attack_penalty_recharger_later
end
end
module BlizzABS
module Weapons
def self.recharge(id)
case id
when 1 then return 40
end
return 40
end
end
module Skills
def self.recharge(id)
case id
when 1 then return 40
end
return 40
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 40
end
return 40
end
end
end
I'll put it up later as plugin.
Eep! This is not what I wanted...
Lol winkio was actually making this system because I requested it.
I wanted that each skill have its OWN counter to prevent itself from being used spammily instead of just one that prevents the character from doing anything else.
*cough* like in MMOs *cough*
I'm pretty sure winkio knows what I'm talking about.
Yeah sorry Aqua for not doing this over the weekend. I underestimated the amount of studying I needed (and still need) to do for finals, which I have through friday this week. I should have it done by Christmas, as long as my family doesn't have too much planned...
Blizz's system is pretty much how I am doing mine, except of course the array of recharge counters that I have, and the update is on the hotkey bar, not the hud.
Another thing that you might be able to help me with blizz is if there is any method to fill a polygon. I'm sure there is, I just can't seem to find it.
And yes, Aqua requested this, but I had this idea for a while on my back burner, along with most of my other stuff. So it's for me too. (And other people may want this as well)
winkio, take your time with this; I'm in no rush.
Eductation is always important!
"Eductation"...Irony! XD
I'm actually look to use this :X This is quite neat and really simplifies my project that I'm working on.
I'm working on it a bit tonight because it kind-of counts as studying for my low-level computer science class. ;)
EDIT: Ok, finished the system, only through borrowing a small part of Blizz's code. Now to add the visual indicators on the hotkey bar.
@anyone who knows: how do I fill a polygon?
LMAO! I made that for NAMK almost a year ago. xD Feel free to take the entire code and make a new version featuring individual recharges without the bar. Just be sure to add the appropriate stuff like Blizz-ABS-is-there check, etc. Best you integrate the check for usage in Map_Battler#skill_can_use? instead of direct implementation in the deriving classes like I did.
Yes, I modified skill_can_use, attack_can_use, and item_can use, and I'm using two paralell arrays: one for max recharge times, and one for the counters. And there is no lag:)
The only thing left is some way to show it's charging. If there is a way to fill a polygon or triangle, I can use that, otherwise, I'll make a little bar for each thing on the hotkeys
You have to code the filling of polygons or triangles yourself by using pixel and rectangle filling. In other words: no.
darn, thought so. Well, as might as well just code the whole drawing of the sector at once.
EDIT: Sweet, I finished it, using a 3-part piecewise function. The only problem is that it seems to go one pixel over each edge of the icon. Any ideas why?
Also, it won't fill the rectangle the opacity of the color I give it. Why?
Final question: It seems that the hotkey bar only updates upon activation/deactivation for me. Why?
Woah that lagged a lot :O
And I'm not sure about this, but the rectangles over the icons might not be disposed when the time is over.
Other than that, good job :)
MAJOR EDIT: All the old testing code is gone, because the script is finished!!!
bump bump bump bump BUMP BUMP BUMP BUMP BUMP BUUMMMMMMMMMMMMP
Ah, that felt good. :^_^':
Yep, this thing is done, so look at it!
Quote from: winkio on December 11, 2008, 07:25:43 pm
The recharge time is in frames. 40 frames is about 1 second.
Lol, 40 frames is exactly one second.
That reminds me of that episode of Big Bang Theory where those two guys have to push a closet up the stairs and the angle is 30°. One of them is like "That should decrease the power needed by around half." and the other is like "... by EXACTLY half."
Very nice ^^ a long awaited script =D
Does it matter where this script is posted? IE above BABS or below it? Just curious is all. G'job as well. :3
It should go below babs
oops, forgot to put that there. sorry. Yep, below.
Nice scipt, ill use this!
I got an error message:
Script 'Recharge' line 92: NameError occured.
undefined method 'skill_penalty' for 'Map_Battler'
I use BlizzABS 2.53.
Could someone please help me?
It is below BABS. I'm not
that stupid. ^^
My Script order is:
Light and Shadow System
Particle System
Ccoa Weather
AMS
Slanted Bars
Text shadow
Autoswitcher
Credit Script
Ccoa Tileset Swap
Light Cones
Sprite_Mirror
F12 Pause
Swimming Script (I'll delete this, its not compatible with BABS)
Quicksave
More Layers
Chaos Project Debug
BlizzABS 1
BlizzABS 2
BlizzABS 3
Recharge Time
Touch Damage
Kill Count
Actor Change
Secondary Weapon
Dialogue from txt
I don't know. I didn't remove the skill_penalty method as far as I remember. What about your savefiles? You shouldn't use savefiles from before adding the scripts.
The error appears before the title screen comes up. And I looked at the BABS script, skill_penalty is definitly there :???:
Ah, I think I know what's wrong. I have moved the method into the subclasses Map_Actor and Map_Enemy. I needed it because of checking if the proper action sprites are turned off.
I couldn't fix it by just changing the class, i got a new error when I tried to start a new game:
Script 'BlizzABS Part 3' line 2590: ArgumentError occurred.
wrong number of arguments(1 for 0)
def initialize
# call superclass method for first actor
super(0) <= thats line 2590
end
It seems that the recharge script doesn't think that a zero is super.
It means that the player class was changed or something like that. Sorry, but I can't help you in short term.
Can you help me in long term, then? XD
Nope. :P Pray that winkio drops by or that Aqua helps you. :P
D: I'll help...
Just not now though... I wanna rest @.@
I should do it soon though, as I need it for my game (which I hope I can work on a lot now XD)
Edit:
Okay I put it up.
It works, but I'm not sure if I really made it better though...
I just copied & pasted the methods into Map_Actor and Map_Enemy and changed the indexes with the initialize method...
Lol... someone wanna check my code? XD
It doesn't crash anymore so I suppose it works, I haven't cofigured it jet though. So thank you for the help :D
(I just learned how to level up someone, so level ++ for you^^)
But I've got another problem :roll: : The Hotkey Bar now is on the bottom of the screen which doesn't work with
the MOG HUD I'm using and in the Hotkey assignment menu the little arrow for assigning still is in his normal position :???: is there a way to change that in the skript?
Sorry for all the problems :^_^':
EDIT: Nevermind I figured it out by myself. I just had to replace the y value in line 274 with 0.
Perhaps you should add that to the first post?
# set x and y position
self.x, self.y, self.z = 160, 0, 1100
Ah right... Wink had the hotkey placed where his custom HUD is...
I'll change it later XD
Is it possible to have the recharge timer like this: ???
(http://www.themook.net/mookui/images/omnicc.jpg)
I mean, the seconds remaining drawn over the icon of the skill as a number.
Also, how do i put the hotkey bar back into its place????
(http://img188.imageshack.us/img188/6293/hotkey.jpg)
BTW: Sorry for my very very bad english =P
I always wondered what this did. What does it exactly do? I'm really stupid I know...
It doesn't allow you to spam skills.
Say skill A has recharge time of 20 seconds.
You can only use skill A every 20 seconds.
Oh like on some mmo's that makes more sense :P like Cabal for example. Phss I wish I woulda known that earlier xD
I'm back for a little while, so I will update this. While I'm at it, I'll ask for any other problems/suggestions.
Right now, I need to:
update for the new version of BlizzABS
fix the hotkey positions
add a number countdown
Dont forget your HUD you posted here too. If you can theres a bug when a party member dies.
I'm pretty much done updating this, just need to run a few tests, then I'll let one of you test for bugs, and then work on the final.
EDIT: done.
The rate is 10x what it /should/ be.
When I put 40 frames, it should 2 seconds, but gives 20 seconds.
I think in the rate part, you did divided the rate by 2 instead of 20 by accident ^_^""
I can't seem to find that line though XD
Errr... forgot 40 frames = 1 second...
I put 40 and get 20 seconds :P
Edit:
Nevermind... misread the default config @.@
Ok, so. How do i change the amount of cooldown i want each skill/item to have?
Where do i paste this 'when (ID OF SKILL/ITEM/WEAPON/ENEMY) then return (RECHARGE TIME)' in the script? i cant seem to figiure it out!
Ok, nvm. I got it.
Just copy/paste this underneath itself.
module Skills
def self.recharge(id)
case id
when (Skill Number) then return (Frames 40=1s)
end
return 400
end
Um... it's kinda in the script... -_____-
Well, now another problem. It is setting all the skills for the same cooldown. Ive tried changing lots of different things and its still the same.
module Skills
def self.recharge(id)
case id
when 1 then return 200
end
return 200
end
def self.recharge(id)
case id
when 7 then return 120
end
return 120
end
def self.recharge(id)
case id
when 57 then return 200
end
return 200
end
end
Is that not how it should look, becuase they are all set to 5 second skill timer for some reason, even tho they are set to be different? If I'm doing it wrong please explain how I need to change it! Thanks ~
You're doing it wrong.
You set it up the same way you set up case statements in Blizz-ABS
Hmm... That doesnt really help >.>
I have very limited knowledge with scripting,. Thanks tho, ill look through it and try to figure it out.
In your case...
module Skills
def self.recharge(id)
case id
when 1 then return 200
when 7 then return 120
when 57 then return 200
end
return 200
end
end
This is like, the basics of scripting. If you can't even figure this out, I strongly recommend sticking to eventing.
Yeah, i figuered it out. I was putting it in the wrong spot, to say the least. Thanks tho!
And yes. I have about the same knowledge with scripting as a boot, or any other inanimate object. :naughty:
ok......i am so using this script^^
thanks alot
updated to v1.11, now compatible with Blizz-ABS 2.82
So for some reason this script is crashing on line 226 ("@recharge.dispose") before I can get the chance to test it.
It crashes after I leave the menu from assigning a skill to the hotkey bar, with a NoMethod error.
just change that line 2
@recharge.dispose if @recharge != nil
Quote from: mroedesigns on January 08, 2011, 06:33:18 pm
So for some reason this script is crashing on line 226 ("@recharge.dispose") before I can get the chance to test it.
It crashes after I leave the menu from assigning a skill to the hotkey bar, with a NoMethod error.
That probably happened because you loaded a savegame from before you used the script when the hotkey bar was visible. Use a new game.
Quote from: winkio on January 09, 2011, 05:14:13 pm
That probably happened because you loaded a savegame from before you used the script when the hotkey bar was visible. Use a new game.
Nope, it was a new game. Nathmatt's fix worked, though.
Only other thing is that if a skill is used when its recharging, it still displays the damage (0, of course). Is there any way it can be modified so that if it's recharging it doesn't show anything?
one question: i get this error:
Script"Blizz-ABS Recharge Time" line 94: ArgumentError occurred.
wrong number of arguments(2 for 1)
I removed rest of the scripts except Blizz-ABS , but i still getting this error. Any idea what is wrong?
You need to update Blizz-ABS.
i see, i forgot to update BABS (still on 2.79)
ty
this is exactly the scripit i needed but im having a complicated problem o-o.
i have the setting specified on one skill, but for some reason it works on all skills. so all skills have the same count down.
also, how do u add more then 1 to the list?
i tried doubling it
module Skills
def self.recharge(id)
case id
when 1 then return 800
end
return 800
end
end
module Skills
def self.recharge(id)
case id
when 2 then return 500
end
return 500
end
end
or putting it this way
module Skills
def self.recharge(id)
case id
when 1,2 then return 800,500
end
return 800,500
end
end
both didnt work, so how is it suppose to be? also the first problem, it should work only on the skill specified in the config, not all of them.
probably it should be like this
module Skills
def self.recharge(id)
case id
when 1 then return 800
when 2 then return 500
end
return 20
end
end
yes perfect, thank you ^^
Edit, aw darn it xD now that I finally got the sripit to work i put it in my main project, which has a custom hud, and it gives me an error
QuoteScripit 'recharge' line 95: argument error accurred.
wrong number of arguments (2 to 1)
i went to line 95 and its
return (!recharging?(1+id) && skill_can_use_recharge_later?(id, forced))
im guessing its because of the custom hud I have for my game, which looks like so
(http://img17.imageshack.us/img17/4893/weaponsfxcopycopy.png)
though it is only a guess that the hud is doing that., my scripits order is
QuoteAdvanced Message Script
Blizz1
Blizz2
Blizz3
recharge
Auto Target
Mouse Controller
Imput name
Snapshot
Advance GameOver Script
Mouse Map Menu
fullscreen
Weather Effects
Scroll Panorama
Custom Equipment Screen
Custom hud
so what should I be doing to make it work with the hud?
thanks :S
you need to update Blizz-ABS.
im using the newest one, also. noticed that i get an error when I use the costum hud and the recharge scripit, I get the error when I try to get to the menu. in game its all fine, but once I try to go to the menu it crashes. allways refering me to this " @recharge.dispose"
uhh its what shows the recharge thing but with it, it wont let me into the menu.
EDIT!::
it doesnt work on skills that are set to be combo's =\.
Quote from: shalaren metropolis on February 21, 2011, 07:03:46 pm
im using the newest one, also. noticed that i get an error when I use the costum hud and the recharge scripit, I get the error when I try to get to the menu. in game its all fine, but once I try to go to the menu it crashes. allways refering me to this " @recharge.dispose"
uhh its what shows the recharge thing but with it, it wont let me into the menu.
try changing that to
@recharge.dispose if @recharge != nil
then it goes on to something wrong with this one
" return (!recharging?(1+id) && skill_can_use_recharge_later?(id, forced))"
ALSO IT DOESNT WORK ON SKILLS THAT ARE SET AS COMBOS =\, THESE NEED TO HAVE A COOL DOWN TOO.
I really like this! The only other thing I was wondering is if there was any way of dimming the icon while it was recharging? I was thinking maybe just showing a black square over the icon that was X% transparent, so it made it darker.
How can I change the size and color of the recharge bar?
Quote from: mroedesigns on June 18, 2011, 02:06:56 am
I really like this! The only other thing I was wondering is if there was any way of dimming the icon while it was recharging? I was thinking maybe just showing a black square over the icon that was X% transparent, so it made it darker.
#----------------------------------------------------------------------------
# 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'm guessing this is what you are looking for. It was located at the bottom of the script.
@above
Why would you want to increase the size, unless you had some custom Hotkey display that is larger than the default? As for the color, find this line:
self.bitmap.fill_rect(32*(i-1)+4, 0, len, 4, Color.new(255, 255, 0))
and change the 3 values in Color.new. There are two of these lines, so make sure to edit both of them.
Thanks KK20! Is there a way to change the icon(spell icon) color/transparency while recharghing?
Where I told you how to change the color of those recharge bars (there were two of them), throw this code directly below it.
self.bitmap.fill_rect(32*(i-1)+4, 4, 24, 24, Color.new(0, 0, 0, 127))
.
Thank you very,very,very,very much.... :) This is a great step for my game :)
Ok now I have another problem........The hotkeys 3,4,5......9.. aren't working good...Look at this pictures...
(http://img683.imageshack.us/img683/8388/96565674.jpg)
(http://img840.imageshack.us/img840/8009/95364820.jpg)
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.
I'm using Landith HUD...Looks very nice but I don't know how to set the space between hotkeys to default...Thank you for helping me.
Oh....I found how :^_^': ... Now works perfectly thank you very much!!! I will give you credits :)
Sorry for bringing this thread back from the grave. D:
I really want to use this script, but I have my hotkeys set up vertically rather than horizontally so the recharge timers show up on the wrong side.
(http://img.photobucket.com/albums/v247/Taone/Screenshot6.png)
I've been trying to change the script to make the recharge timers show up vertically, but they either don't change, or they stop showing up overall.
(http://img.photobucket.com/albums/v247/Taone/error-2.png)
Much thanks if you guys can help.
I'm going to need to know what HUD script that is. It's merely just a matter of changing the coordinates of where the graphics are drawn. But I need to know the hotkey's viewport's dimensions first.
Quote from: KK20 on February 16, 2012, 04:56:00 pm
I'm going to need to know what HUD script that is. It's merely just a matter of changing the coordinates of where the graphics are drawn. But I need to know the hotkey's viewport's dimensions first.
Kk20 to the rescue again. :P Thanks for helping me out so much.
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# Blizz-ABS Party HUD by Winkio
# Version: 1.25
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
#
#
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# This script modifies the Blizz-ABS HUD to display the HP/SP of up to ,six
# party members at once. It also moves the hud and skill bar to the bottom and
# scales down the minimap.
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
#==============================================================================
# PARHUD_CONFIG
#------------------------------------------------------------------------------
# This module is the configuration section
#==============================================================================
module PARHUD_CONFIG
# Keeps health bar same color no matter what hp
COLOR_FIX = false
# Centers the hud display
CENTER_DISPLAY = true
# shows facesets. If set to true, must have a max party size of 4 or less.
# If set to false, must have a max party size of 6 or less.
FACESETS = false
# display map name in hud
MAPNAME = true
# background picture for top hud. If you have one, put it in Pictures.
# Set this variable to the file name, for example, "mybg.png"
# It should be 640 pixels wide and 50+TOPSPACE pixels tall.
BGTOP = ""
# space between top of HUD and top of screen. must be between 0 and 14
TOPSPACE = 2
# allow minimap to be fullscreen
MINIMAP_FULLSCREEN = true
# the image behind the hotkeys
HotkeyImage = 'HotkeyBorder'
end
#==============================================================================
# Game_System
#------------------------------------------------------------------------------
# This class was modified to support the party hud
#==============================================================================
class Game_System
attr_accessor :parhud
alias initialize_parhud_later initialize
def initialize
@parhud = true
initialize_parhud_later
end
end
#==============================================================================
# Scene_Title
#==============================================================================
class Scene_Title
alias main_parhud_later main
def main
$map_infos = load_data('Data/MapInfos.rxdata')
$map_infos.keys.each {|key| $map_infos[key] = $map_infos[key].name}
main_parhud_later
end
end
#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
def name
return $map_infos[@map_id]
end
end
#==============================================================================
# ParHud
#------------------------------------------------------------------------------
# This class creates the top hud that shows the hp/sp of all party members and
# their names.
#==============================================================================
class ParHud < Sprite
#----------------------------------------------------------------------------
# Initialization
# viewport - the viewport for the sprite
#----------------------------------------------------------------------------
def initialize(viewport = nil)
# call superclass method
super
# create positions
create_positions
# create bitmap
self.bitmap = Bitmap.new(640, 50+PARHUD_CONFIG::TOPSPACE)
# set font
self.bitmap.font.name = 'Calibri'
# set font size
self.bitmap.font.size = 16
# set font to bold
self.bitmap.font.bold = true
# set z coordinate
self.z = 1000
# set party size
@psize = $game_party.actors.size
@poffset = 0
test_offset
@hp, @maxhp = [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]
@sp, @maxsp = [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]
# draw basic HUD
draw_basic
# update
update
end
#----------------------------------------------------------------------------
# create_positions
# Sets drawing positions. This method can be aliased and the positions
# modified to create a different HUD.
#----------------------------------------------------------------------------
def create_positions
@name_x, @name_y, @hp_x, @hp_y, @sp_x, @sp_y = [], [], [], [], [], []
if PARHUD_CONFIG::FACESETS
@face_x, @face_y = [], []
end
if !PARHUD_CONFIG::CENTER_DISPLAY
@maxpsize = BlizzABS::Config::MAX_PARTY
@name_x, @name_y, @hp_x, @hp_y, @sp_x, @sp_y = [], [], [], [], [], []
@face_x, @face_y = [], []
(0...@maxpsize).each {|i|
if PARHUD_CONFIG::FACESETS
xdat = i*640/@maxpsize + 320/@maxpsize-25
@face_x.push(xdat-52)
@face_y.push(PARHUD_CONFIG::TOPSPACE)
else
xdat = i*640/@maxpsize + 320/@maxpsize-50
end
@name_x.push(xdat)
@name_y.push(PARHUD_CONFIG::TOPSPACE)
@hp_x.push(xdat)
@hp_y.push(16+PARHUD_CONFIG::TOPSPACE)
@sp_x.push(xdat)
@sp_y.push(33+PARHUD_CONFIG::TOPSPACE)}
else
if (@psize == nil)
#@psize = 1
@psize = $game_party.actors.size
end
(0...@psize).each {|i|
if PARHUD_CONFIG::FACESETS
xdat = i*640/@psize + 320/@psize-25
@face_x.push(xdat-52)
@face_y.push(PARHUD_CONFIG::TOPSPACE)
else
xdat = i*640/@psize + 320/@psize-50
end
@name_x.push(xdat)
@name_y.push(PARHUD_CONFIG::TOPSPACE)
@hp_x.push(xdat)
@hp_y.push(16+PARHUD_CONFIG::TOPSPACE)
@sp_x.push(xdat)
@sp_y.push(33+PARHUD_CONFIG::TOPSPACE)}
end
end
#----------------------------------------------------------------------------
# draw_basic
# Draws the HUD template.
#----------------------------------------------------------------------------
def draw_basic
self.bitmap.font.size = 16
color = Color.new(255, 255, 255, 127)
if PARHUD_CONFIG::BGTOP != ""
# load bitmap
bitmap = RPG::Cache.picture(PARHUD_CONFIG::BGTOP)
# draw bitmap
self.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 640, 50+PARHUD_CONFIG::TOPSPACE))
end
self.bitmap.font.color = Color.new(255, 255, 255)
# if color exists
if color.is_a?(Color)
(0...@psize).each {|i|
# draw outlines in color
self.bitmap.fill_rect(@hp_x[i], @hp_y[i], 102, 14, color)
self.bitmap.fill_rect(@sp_x[i], @sp_y[i], 102, 14, color)
# draw actor's names and faces
self.bitmap.draw_text_full(@name_x[i], @name_y[i], 104, 20, actor(i).name, 1)
if PARHUD_CONFIG::FACESETS
self.bitmap.fill_rect(@face_x[i], @face_y[i], 50, 50, color)
# load bitmap
bitmap = RPG::Cache.picture("actor"+actor(i).id.to_s+".png")
# draw bitmap
self.bitmap.blt(@face_x[i]+1, @face_y[i]+1, bitmap, Rect.new(0, 0, 48, 48))
end
}
end
self.bitmap.font.size = 14
end
#----------------------------------------------------------------------------
# draw_empty
# Draws the HP and SP display when actor doesn't exist.
#----------------------------------------------------------------------------
def draw_empty
# set font color
self.bitmap.font.color = disabled_color
(0...@psize).each {|i|
# draw empty bars
self.bitmap.gradient_bar_hud(@hp_x[i], @hp_y[i], 100, 0, 'hud_green_bar')
self.bitmap.gradient_bar_hud(@sp_x[i], @sp_y[i], 100, 0, 'hud_blue_bar')
# draw empty HP/SP
self.bitmap.draw_text_full(@hp_x[i]+48, @hp_y[i]-3, 48, 20, '0', 2)
self.bitmap.draw_text_full(@sp_x[i]+48, @sp_y[i]-3, 48, 20, '0', 2)
}
# reset all flag variables
@hp = @sp = @maxhp = @maxsp = nil
end
#----------------------------------------------------------------------------
# draw_hp
# Draws the HP display.
#----------------------------------------------------------------------------
def draw_hp
@hp, @maxhp = [], []
self.bitmap.font.color = normal_color
(0...@psize).each {|i|
# set current variables
@hp.push(actor(i).hp)
@maxhp.push(actor(i).maxhp)
rate = (@maxhp[i] > 0 ? @hp[i].to_f / @maxhp[i] : 0)
if PARHUD_CONFIG::COLOR_FIX
# draw gradient bar
self.bitmap.gradient_bar_hud(@hp_x[i], @hp_y[i], 100, rate, 'hud_green_bar', 0)
# draw HP
self.bitmap.draw_text_full(@hp_x[i]+1, @hp_y[i], 100, 11, @hp[i].to_s, 1)
else
# draw gradient bar
self.bitmap.gradient_bar_hud(@hp_x[i], @hp_y[i], 100, rate, 'hud_green_bar', 1)
# set font color depending on how many HP left
self.bitmap.font.color = @hp[i] == 0 ? knockout_color :
@hp[i] <= @maxhp[i] / 4 ? crisis_color : normal_color
# draw HP
self.bitmap.draw_text_full(@hp_x[i]+1, @hp_y[i], 100, 11, @hp[i].to_s, 1)
self.bitmap.font.color = normal_color
end
}
end
#----------------------------------------------------------------------------
# draw_sp
# Draws the SP display.
#----------------------------------------------------------------------------
def draw_sp
@sp, @maxsp = [], []
self.bitmap.font.color = normal_color
(0...@psize).each {|i|
# set current variables
@sp.push(actor(i).sp)
@maxsp.push(actor(i).maxsp)
rate = (@maxsp[i] > 0 ? @sp[i].to_f / @maxsp[i] : 0)
# draw gradient bar
self.bitmap.gradient_bar_hud(@sp_x[i], @sp_y[i], 100, rate, 'hud_blue_bar', 0)
# draw HP
self.bitmap.draw_text_full(@sp_x[i]+1, @sp_y[i], 100, 11, @sp[i].to_s, 1)
}
end
#----------------------------------------------------------------------------
# update
# Checks if HUD needs refreshing.
#----------------------------------------------------------------------------
def update
# if actor doesn't exist
if actor == nil
# unless already drawn empty HUD
unless @empty_hud_drawn
# draw HUD template
draw_basic
# draw empty HP, SP and EXP bars
draw_empty
# empty HUD was drawn
@empty_hud_drawn = true
end
else
if @psize != $game_party.actors.size
@psize = $game_party.actors.size
self.bitmap.clear
create_positions
test_offset
draw_basic
end
# if HUD needs refresh
if $game_temp.hud_refresh
# draw all data about actors
draw_hp
draw_sp
# remove flag
$game_temp.hud_refresh = nil
else
# draw data that needs to be updated
test_offset
test_hp
test_sp
end
# empty HUD wasn't drawn
@empty_hud_drawn = false
end
end
#----------------------------------------------------------------------------
# test_hp
# Tests and draws the HP.
#----------------------------------------------------------------------------
def test_hp
(0...@psize).each {|i|
# draw new HP if HP or max HP have changed
if actor(i).hp != @hp[i] || actor(i).maxhp != @maxhp[i]
draw_hp
return
end}
end
#----------------------------------------------------------------------------
# test_sp
# Tests and draws the SP.
#----------------------------------------------------------------------------
def test_sp
(0...@psize).each {|i|
# draw new HP if HP or max HP have changed
if actor(i).sp != @sp[i] || actor(i).maxsp != @maxsp[i]
draw_sp
return
end}
end
#----------------------------------------------------------------------------
# test_offset
# Tests and draws the SP.
#----------------------------------------------------------------------------
def test_offset
(0...@psize).each {|i|
if actor(0).name != $game_actors[1].name
@poffset = (@poffset + 1) % @psize
else
return
end}
end
#----------------------------------------------------------------------------
# actor
# Returns the party leader's battler for easier reference.
#----------------------------------------------------------------------------
def actor(id = 0)
return $game_party.actors[(id + @poffset)%@psize]
end
#----------------------------------------------------------------------------
# dispose
# disposes of the sprite.
#----------------------------------------------------------------------------
def dispose
super
end
end
#==============================================================================
# Hud
#------------------------------------------------------------------------------
# This class was modified to support SR display and modify the number of
# skills left to use.
# Displays HUD window and exp/level bar
#==============================================================================
class Hud < Sprite
#----------------------------------------------------------------------------
# Initialization
# viewport - the viewport for the sprite
#----------------------------------------------------------------------------
def initialize(viewport = nil)
# call superclass method
super
# create positions
create_positions
# create bitmap
self.bitmap = Bitmap.new(120, 90)
# set font
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 coordinates
self.x, self.y = @hud_x, @hud_y
# set z coordinate
self.z = 1000
# draw basic HUD
draw_basic
# update
update
end
#----------------------------------------------------------------------------
# create_positions
# Sets drawing positions. This method can be aliased and the positions
# modified to create a different HUD.
#----------------------------------------------------------------------------
def create_positions
@hud_height, @hud_width, @hud_x, @hud_y = 60, 120, 0, 420
@level_x, @level_y = 0, 0
@gold_x, @gold_y, @loc_x, @loc_y = 10, 20, 10, 40
@sbar_x, @sbar_y = 65, 60
if !BlizzABS::Config::DIRECT_HOTKEYS
@hot_x, @hot_y, @left_x, @left_y = 4, 60, 4, 74
end
end
#----------------------------------------------------------------------------
# draw_basic
# Draws the HUD template.
#----------------------------------------------------------------------------
def draw_basic
# fill with grey rectangle
self.bitmap.fill_rect(0, 0, @hud_width, @hud_height,
Color.new(0, 0, 0, 127))
color = Color.new(255, 255, 255, 127)
# if color exists
if color.is_a?(Color)
# draw outlines in color
self.bitmap.fill_rect(@level_x, @level_y, 120, 14, color)
end
if !BlizzABS::Config::DIRECT_HOTKEYS
# draw "Skill:"
self.bitmap.draw_text_full(@hot_x, @hot_y, 48, 20, 'S')
# draw "Item:"
self.bitmap.draw_text_full(@hot_x+60, @hot_y, 48, 20, 'I')
end
# set font color
self.bitmap.font.color = system_color
# draw "ER"
self.bitmap.draw_text_full(@gold_x + 80, @gold_y, 20, 20, 'G')
end
#----------------------------------------------------------------------------
# draw_empty
# Draws the HP and SP display when actor doesn't exist.
#----------------------------------------------------------------------------
def draw_empty
self.bitmap.gradient_bar_hud(@level_x+1, @level_y+1, 118, 'hud_white_bar', 1)
# set font color
self.bitmap.font.color = disabled_color
# draw empty HP
self.bitmap.draw_text_full(@level_x, @level_y, 118, 11, '0', 1)
# reset all flag variables
@name = @level = @hp = @sp = @maxhp = @maxsp = @exp = @states = @skill =
@skills_left = @item = @items_left = @gold = nil
end
#----------------------------------------------------------------------------
# draw_exp
# Draws the EXP display.
#----------------------------------------------------------------------------
def draw_exp
# set current variables
@exp, @level = actor.exp, actor.level
# set fill rate
rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
# draw gradient bar
self.bitmap.gradient_bar_hud(@level_x, @level_y, 118, rate, 'hud_blue_bar', 2)
# set font color depending on how many HP left
self.bitmap.font.color = normal_color
self.bitmap.font.size = 14
# draw EXP
self.bitmap.draw_text_full(@level_x, @level_y-3, 118, 20, 'Level ' + @level.to_s, 1)
self.bitmap.font.size = 16
end
#----------------------------------------------------------------------------
# draw_gold
# Draws the gold display.
#----------------------------------------------------------------------------
def draw_gold
# set current variable
@gold = $game_party.gold
# remove old display
self.bitmap.fill_rect(@gold_x, @gold_y, 80, 20, Color.new(0, 0, 0, 127))
# set font color
self.bitmap.font.color = normal_color
# draw party's gold
self.bitmap.draw_text_full(@gold_x, @gold_y, 80, 20, $game_party.gold.to_s, 2)
end
#----------------------------------------------------------------------------
# draw_loc
# Draws the map location display.
#----------------------------------------------------------------------------
def draw_loc
# set current variable
@loc = $game_map.name
# remove old display
self.bitmap.fill_rect(@loc_x, @loc_y, 100, 20, Color.new(0, 0, 0, 127))
# set font color
self.bitmap.font.color = normal_color
# draw party's gold
self.bitmap.draw_text_full(@loc_x, @loc_y, 100, 20, $game_map.name, 1)
end
#----------------------------------------------------------------------------
# draw_hskill
# Draws the hot skill display.
#----------------------------------------------------------------------------
def draw_hskill
# set current variable
@skill = actor.skill
# remove old display
self.bitmap.fill_rect(@hot_x+28, @hot_y+4, 24, 24, Color.new(0, 0, 0, 128))
# if skill hot skill exists
if @skill != 0
# load bitmap
bitmap = RPG::Cache.icon($data_skills[@skill].icon_name)
# draw bitmap
self.bitmap.blt(@hot_x+28, @hot_y+4, bitmap, Rect.new(0, 0, 24, 24))
end
# removes skills left to use display
draw_lskill
end
#----------------------------------------------------------------------------
# draw_lskill
# Draws the skills left to use display.
#----------------------------------------------------------------------------
def draw_lskill
# remove old display
self.bitmap.fill_rect(@left_x, @left_y+4, 24, 16, Color.new(0, 0, 0, 128))
# get the number of skills left
@skills_left = get_skills_left
# if hot skill exists
if @skill != nil && @skill > 0
# if normal SP cost
if @skills_left >= 0
# if not enough sp to use
if @skills_left == 0
# set font color
self.bitmap.font.color = Color.new(255, 0, 0)
# if enough SP for 5 or less skill uses
elsif @skills_left <= 5
# set font color
self.bitmap.font.color = Color.new(255, 255, 0)
else
# set font color
self.bitmap.font.color = normal_color
end
# decrease font color
self.bitmap.font.size -= 2
# draw number how many skills left to use
self.bitmap.draw_text_full(@left_x, @left_y, 24, 20, @skills_left.to_s, 1)
# increase font size
self.bitmap.font.size += 2
# if infinite skills left
elsif @skills_left == -1
# set font color
self.bitmap.font.color = Color.new(0, 255, 0)
# increase font size
self.bitmap.font.size += 4
# draw "∞" skill uses left
self.bitmap.draw_text_full(@left_x, @left_y, 24, 20, '∞', 1)
# decrease font size
self.bitmap.font.size -= 4
end
end
end
#----------------------------------------------------------------------------
# get_skills_left
# Gets the number of skill usages left.
#----------------------------------------------------------------------------
def get_skills_left
# if skill hot skill exists
if @skill != nil && @skill > 0
# if SP cost is zero
if $data_skills[@skill].sp_cost > 0
# get basic SP cost
sp_cost = $data_skills[@skill].sp_cost
# if using SP Cost Mod Status
if $tons_version != nil && $tons_version >= 6.54 &&
$game_system.SP_COST_MOD
# get modified cost
sp_cost = BlizzCFG.get_cost_mod(actor.states, sp_cost)
end
# infinite
return -1 if sp_cost == 0
# calculate skills left to use
return actor.sp / sp_cost
end
# set flag
return -1
end
# set flag
return -2
end
#----------------------------------------------------------------------------
# draw_hitem
# Draws the hot item display.
#----------------------------------------------------------------------------
def draw_hitem
# set current variable
@item = actor.item
# remove old display
self.bitmap.fill_rect(@hot_x+88, @hot_y+4, 24, 24, Color.new(0, 0, 0, 128))
# if hot item exists
if @item != 0
# load bitmap
bitmap = RPG::Cache.icon($data_items[@item].icon_name)
# draw bitmap
self.bitmap.blt(@hot_x+88, @hot_y+4, bitmap, Rect.new(0, 0, 24, 24))
end
# removes items left to use display
draw_litem
end
#----------------------------------------------------------------------------
# draw_litem
# Draws the items left to use display.
#----------------------------------------------------------------------------
def draw_litem
# set current variable
@items_left = $game_party.item_number(@item)
# remove old display
self.bitmap.fill_rect(@left_x+60, @left_y+4, 24, 16, Color.new(0, 0, 0, 128))
# if hot item exists
if @item != nil && @item > 0
# if item exists and cannot be consumed
if $data_items[@item] != nil && !$data_items[@item].consumable
# set font color
self.bitmap.font.color = Color.new(0, 255, 0)
# increase font size
self.bitmap.font.size += 4
# draw "∞" items left
self.bitmap.draw_text_full(@left_x+60, @left_y, 24, 20, '∞', 1)
# decrease font size
self.bitmap.font.size -= 4
else
# if no items left
if @items_left == 0
# set font color
self.bitmap.font.color = Color.new(255, 0, 0)
# if equal or less items left
elsif @items_left <= 10
# set font color
self.bitmap.font.color = Color.new(255, 255, 0)
else
# set font color
self.bitmap.font.color = normal_color
end
# decrease font color
self.bitmap.font.size -= 2
# draw number how many items left to use
self.bitmap.draw_text_full(@left_x+60, @left_y, 24, 20, @items_left.to_s, 1)
# increase font size
self.bitmap.font.size += 2
end
end
end
#----------------------------------------------------------------------------
# update
# Checks if HUD needs refreshing.
#----------------------------------------------------------------------------
def update
# if actor doesn't exist
if actor == nil
# unless already drawn empty HUD
unless @empty_hud_drawn
# draw HUD template
draw_basic
# draw empty HP, SP and EXP bars
draw_empty
# empty HUD was drawn
@empty_hud_drawn = true
end
else
# if HUD needs refresh
if $game_temp.hud_refresh
# draw all data about actors
draw_exp
draw_gold
$game_temp.common_event_id = 9
if PARHUD_CONFIG::MAPNAME
draw_loc
end
unless BlizzABS::Config::DIRECT_HOTKEYS
draw_hskill
draw_lskill
draw_hitem
draw_litem
end
# remove flag
$game_temp.hud_refresh = nil
else
# draw data that needs to be updated
test_exp
test_gold
if PARHUD_CONFIG::MAPNAME
test_loc
end
unless BlizzABS::Config::DIRECT_HOTKEYS
test_hskill
test_lskill
test_hitem
test_litem
end
end
# empty HUD wasn't drawn
@empty_hud_drawn = false
end
end
#----------------------------------------------------------------------------
# test_exp
# Tests and draws the EXP.
#----------------------------------------------------------------------------
def test_exp
# draw new HP if HP or max HP have changed
draw_exp if actor.exp != @exp
end
#----------------------------------------------------------------------------
# test_gold
# Tests and draws the gold.
#----------------------------------------------------------------------------
def test_gold
# draw new er if er has changed
draw_gold if $game_party.gold != @gold
end
#----------------------------------------------------------------------------
# test_loc
# Tests and draws the loc.
#----------------------------------------------------------------------------
def test_loc
# draw new er if er has changed
draw_loc if $game_map.name != @loc
end
#----------------------------------------------------------------------------
# actor
# Returns the party leader's battler for easier reference.
#----------------------------------------------------------------------------
def actor
return $game_player.battler
end
#----------------------------------------------------------------------------
# dispose
# Removes PARHUD from screen and memory.
#----------------------------------------------------------------------------
def dispose
@parhud = nil
super
end
end
#==============================================================================
# Hotkey_Assignment
#------------------------------------------------------------------------------
# This class creates and display currently assigned hotkeys and is more
# effiecient than the Window class.
# Changed to display at bottom of screen with new graphics.
#==============================================================================
class Hotkey_Assignment < Sprite
#----------------------------------------------------------------------------
# Initialization
# viewport - the viewport for the sprite
#----------------------------------------------------------------------------
def initialize(viewport = nil)
# call superclass
super
# create bitmap
bitmap = RPG::Cache.picture(PARHUD_CONFIG::HotkeyImage)
self.bitmap = bitmap.clone
# 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 = 4, 60, 9000
@page = 1
# 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(0, 32*(i-1), 0, 0, Color.new(0, 0, 0, 0))
# fill icon bachground
self.bitmap.fill_rect(4, 32*(i-1)+4, 0, 0, Color.new(0, 0, 0, 0))
# if object exists
if object != nil
# load bitmap
bitmap = RPG::Cache.icon(object.icon_name)
# draw bitmap
self.bitmap.blt(7, 32*(i-1)+4, bitmap, Rect.new(0, 0, 24, 255))
end
# draw hotkey number
self.bitmap.draw_text_full(6, 32*(i-1), 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
end
#==============================================================================
# Scene_Map
#------------------------------------------------------------------------------
# This class was enhanced to support HUD control and creation system and
# Blizz-ABS battle handling and level up text display.
# Changed to enable the party hud
#==============================================================================
class Scene_Map
#----------------------------------------------------------------------------
# override main
#----------------------------------------------------------------------------
alias main_blizzabs_later_winkio main
def main
# create HUD if HUD is turned on and HUD active
@hud = Hud.new if $game_system.hud
@parhud = ParHud.new if $game_system.parhud
# if HOTKEYS is turned on and assignment display active
if $game_system.hotkeys
# create assignment display
@hotkeys = Hotkey_Assignment.new
end
# if MINIMAP is turned on and minimap active
if $game_system.minimap > 0
# create HUD
@minimap = Minimap.new
end
# tests and sets the in_battle flag
test_in_battle
# call original method
main_blizzabs_later
# set in_battle flag
$game_temp.in_battle = false
# delete HUD elements that exist
[@hud, @parhud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
end
#----------------------------------------------------------------------------
# hud_update
# This method 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, @parhud, @minimap, @hotkeys].each {|s|
# if sprite exists
if s != nil
# update sprite
s.update
# if player is on the same position as one of the sprites on the screen
if $game_player.screen_x < s.vx + s.vw + 16 &&
$game_player.screen_y < s.vy + s.vh + 48 &&
$game_player.screen_x > s.vx && $game_player.screen_y > s.vy &&
((s == @minimap) ? ($game_system.minimap < 2) : true)
# decrease opacity quickly if critical opacity not reached
s.opacity -= 25 if s.opacity > 80
# if not full opacity
elsif s.opacity <= 255
# increase opacity quickly if critical opacity not reached
s.opacity += 25
end
end}
end
#----------------------------------------------------------------------------
# check_huds
# This method handles enabling and disabling the HUD parts on the map.
#----------------------------------------------------------------------------
def check_huds
# if minimap button is enabled and pressed
if $game_system.minimap_button && Input.trigger?(Input::Minimap)
# trigger minimap active
$game_system.minimap = ($game_system.minimap + 1) %
((PARHUD_CONFIG::MINIMAP_FULLSCREEN) ? 3 : 2) #change123
end
# if hotkey display button is enabled and pressed
if $game_system.hotkey_button && Input.trigger?(Input::Hotkey)
# trigger hotkey display active
$game_system.hotkeys = (!$game_system.hotkeys)
end
# if HUD button is enabled and pressed
if $game_system.hud_button && Input.trigger?(Input::Hud)
# trigger it active
$game_system.hud = (!$game_system.hud)
$game_system.parhud = (!$game_system.parhud)
end
# if minimap not active and minimap exists
if $game_system.minimap == 0 && @minimap != nil
# delete it
@minimap.dispose
@minimap = nil
# if minimap is turned on and active and doesn't exist
elsif BlizzABS::Config::MINIMAP && $game_system.minimap > 0
# create it
@minimap = Minimap.new if @minimap == nil
end
# if assignment display not active and exists
if !$game_system.hotkeys && @hotkeys != nil
# delete it
@hotkeys.dispose
@hotkeys = nil
# if HOTKEYS is turned on and active and doesn't exist
elsif BlizzABS::Config::HOTKEYS && $game_system.hotkeys
# create it
@hotkeys = Hotkey_Assignment.new if @hotkeys == nil
end
# if HUD not active and HUD exists
if !$game_system.hud && @hud != nil
# delete it
@hud.dispose
@hud = nil
@parhud.dispose
@parhud = nil
# if HUD is turned on and HUD active and HUD doesn't exist
elsif BlizzABS::Config::HUD_ENABLED && $game_system.hud
# create it
@hud = Hud.new if @hud == nil
@parhud = ParHud.new if @parhud == nil
end
end
end
#==============================================================================
# Window_Skill_Hotkey
#------------------------------------------------------------------------------
# This class serves as display for skills that can be hotkeyed.
# Changed position to top of screen
#==============================================================================
class Window_Skill_Hotkey < Window_Skill
#----------------------------------------------------------------------------
# Initialization
# actor - actor
#----------------------------------------------------------------------------
def initialize(actor)
# call superclass method
super
# set max column number
@column_max = 1
# set width and height
self.width, self.height = 260, 416
# set y and z position
self.x, self.y, self.z = 60, 0, 21000
# remove cursor display
self.cursor_rect.empty
# set to not active
self.active = false
# refresh display
refresh
end
end
#==============================================================================
# Window_Item_Hotkey
#------------------------------------------------------------------------------
# This class serves as display for items that can be hotkeyed.
# Changed position to top of screen
#==============================================================================
class Window_Item_Hotkey < Window_Item
#----------------------------------------------------------------------------
# Initialization
# actor - actor
#----------------------------------------------------------------------------
def initialize
# call superclass method
super
# set max column number
@column_max = 1
# set width and height
self.width, self.height = 320, 416
# set x, y and z position
self.x, self.y, self.z = 310, 0, 21000
# remove cursor display
self.cursor_rect.empty
# set to not active
self.active = false
# refresh display
refresh
end
end
#==============================================================================
# Scene_Hotkeys
#------------------------------------------------------------------------------
# This class handles the skill/item hotkey processing.
# The position of the arrow has been changed to the bottom of the screen.
# Also included the upside down arrow.
#==============================================================================
class Scene_Hotkeys
#----------------------------------------------------------------------------
# main
# The main processing method.
#----------------------------------------------------------------------------
def main
# create spriteset
@spriteset = Spriteset_Map.new
# create viewport
@view = Viewport.new(0, 0, 640, 480)
# set tone to current screen tone
@view.tone = @tone.clone
# create HUD if HUD is turned on and HUD active
@hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
# if ASSIGNMENT is turned
if BlizzABS::Config::HOTKEYS
# create assignment display
@hotkeys = Hotkey_Assignment.new
# set z position
@hotkeys.z = 200
end
# if MINIMAP is turned on and minimap active
if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
# create HUD
@minimap = Minimap.new
end
# create sprite
@choice = Sprite.new
# create bitmap
@choice.bitmap = menu_arrow
# set x, y and z positions
@choice.x, @choice.y, @choice.z, @choice.opacity = 4, 60, 500, 230
# set active flag
@active = true
# set index
@index = 0
# set up mode flag
@up_mode = true
# create modified skill window
@skill_window = Window_Skill_Hotkey.new($game_player.battler)
# create modified item window
@item_window = Window_Item_Hotkey.new
# set last active
@last_active = true
# transtition
Graphics.transition
# loop
loop do
# update game screen
Graphics.update
# update input
Input.update
# frame update
update
# stop if chosen an option
break if $scene != self
end
# freeze screen
Graphics.freeze
# delet spriteset
@spriteset.dispose
# delete HUD elements that exist
[@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
# delete choice sprite
@choice.dispose
# delete skill window
@skill_window.dispose
# delete item window
@item_window.dispose
# delete viewport
@view.dispose
end
#--------------------------------------------------------------------------
# menu_arrow
# Creates the arrow displayed in the hotkey assignment menu. Upside down
#--------------------------------------------------------------------------
def menu_arrow
b = Bitmap.new(16, 9)
c1 = Color.new(0, 0, 0)
c2 = Color.new(255, 255, 255)
c3 = Color.new(127, 127, 127)
b.fill_rect(7, 8, 2, 1, c2)
b.set_pixel(6, 7, c2)
b.fill_rect(7, 7, 1, 7, c3)
b.fill_rect(8, 7, 1, 7, c1)
b.set_pixel(9, 7, c2)
b.set_pixel(5, 6, c2)
b.fill_rect(6, 6, 1, 6, c3)
b.fill_rect(9, 6, 1, 6, c1)
b.set_pixel(10, 6, c2)
b.set_pixel(4, 5, c2)
b.fill_rect(5, 5, 1, 5, c3)
b.fill_rect(10, 5, 1, 5, c1)
b.set_pixel(11, 5, c2)
b.set_pixel(3, 4, c2)
b.fill_rect(4, 4, 1, 4, c3)
b.fill_rect(11, 4, 1, 4, c1)
b.set_pixel(12, 4, c2)
b.set_pixel(2, 3, c2)
b.fill_rect(3, 3, 1, 3, c3)
b.fill_rect(12, 3, 1, 3, c1)
b.set_pixel(13, 3, c2)
b.set_pixel(1, 2, c2)
b.fill_rect(2, 2, 1, 2, c3)
b.fill_rect(13, 2, 1, 2, c1)
b.set_pixel(14, 2, c2)
b.set_pixel(0, 1, c2)
b.set_pixel(1, 1, c3)
b.set_pixel(14, 1, c1)
b.set_pixel(15, 1, c2)
b.fill_rect(1, 0, 14, 1, c2)
return b
end
end
It's Winkio's party HUD, with some edits.
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:
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.
Works great! Thanks alot man! :D
Is it too soon for me to say that I love you?
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.
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...
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.
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.
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.
Go to page 4 of this thread. It's there ;)
I pasted that code
#----------------------------------------------------------------------------
# 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
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:
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# 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.
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.
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...
):
(http://i1281.photobucket.com/albums/a520/KiwakiwaR/timerposition_zps67c940d4.png)
***Edit***
Im using
Blizz-ABS Party HUD++ Landith
Version: 1.00
and its beautiful. but maybe its the culprit.
Landith hud is rewriting some methods, you should try to place it right below Blizz ABS and above Action Recharge script
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.
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:
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# 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
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
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).
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
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.
Just wanted to point this out: item cooldowns are not displayed over the hotkeys. This was brought to my attention from this post (http://forum.chaos-project.com/index.php/topic,13338.msg177634.html#msg177634). It has been fixed and I updated the original post.
Hello!
Sorry for necroposting but I'm having some issues with this script.
The problem is kinda simple : It laggs very, very much (I'm using many other scripts including higher resolution) but when I have 3-4 spells recharging it's almost unplayable. Is there a way to modify something in the script to make it more smooth? I'm thinking of removing the cooldown bars over the spells, or something similar that may improve performance.
Thanks in advance!
yea, removing the graphical part would definitely improve performance
Thanks for reply!
Looks like I can't figure it out how to solve this. :'( I think I removed the drawing thing but it still laggs. Even with the VX engine it still drops to 5 fps.
Is there a possibility to modify blizz's script to draw the countdowns over the hotkeys (only the numbers) like in winkio's script?
class BlizzABS::Cache
alias init_recharger_later initialize
def initialize
init_recharger_later
@data['empty_hud_yellow_bar'] = @data['empty_hud_green_bar'].clone
@data['empty_hud_yellow_bar'].hue_change(-60)
@data['hud_yellow_bar'] = @data['hud_green_bar'].clone
@data['hud_yellow_bar'].hue_change(-60)
#p 1
#p self.image('hud_yellow_bar')
end
end
$BlizzABS = BlizzABS::Processor.new
class Recharger < Sprite
def initialize
super
self.bitmap = Bitmap.new(156, 14)
color = case BlizzABS::Config::HUD_TYPE
when 0 then Color.new(255, 255, 255, 192)
when 1 then Color.new(0, 0, 0, 0)
end
self.bitmap.fill_rect(0, 0, 156, 14, color) if color.is_a?(Color)
self.x = 4
update
end
def update
super
now, full = $game_player.recharge
self.bitmap.gradient_bar_hud(0, 0, 154, now.to_f/full, 'hud_yellow_bar')
self.dispose if !$game_player.recharging?
end
end
class Scene_Map
alias main_recharger_later main
def main
@recharge_bar = Recharger.new if $game_player.recharging?
main_recharger_later
@recharge_bar.dispose if @recharge_bar != nil
end
alias upd_recharger_later update
def update
if $game_player.recharging? && @recharge_bar == nil
@recharge_bar = Recharger.new
end
upd_recharger_later
if @recharge_bar != nil
if @hud != nil
@recharge_bar.y = @hud.y + @hud.bitmap.height + 4
else
@recharge_bar.y = 4
end
@recharge_bar.update
@recharge_bar = nil if @recharge_bar.disposed?
end
end
end
class Map_Battler
attr_reader :recharge
alias upd_recharger_later update
def update
@recharge[0] -= 1 if recharging?
upd_recharger_later
end
alias freeze_action_recharger_later freeze_action
def freeze_action
return (freeze_action_recharger_later || recharging?)
end
alias skill_penalty_recharger_later skill_penalty
def skill_penalty(id)
re = BlizzABS::Skills.recharge(id)
@recharge = [re, re]
return skill_penalty_recharger_later(id)
end
alias item_penalty_recharger_later item_penalty
def item_penalty(id)
re = BlizzABS::Skills.recharge(id)
@recharge = [re, re]
return item_penalty_recharger_later(id)
end
def recharging?
return (@recharge != nil && @recharge[0] > 0)
end
end
class Map_Actor
alias attack_penalty_recharger_later attack_penalty
def attack_penalty
re = BlizzABS::Weapons.recharge(@battler.weapon_id)
@recharge = [re, re]
return attack_penalty_recharger_later
end
end
class Map_Enemy
alias attack_penalty_recharger_later attack_penalty
def attack_penalty
re = BlizzABS::Enemies.recharge(@battler.weapon_id)
@recharge = [re, re]
return attack_penalty_recharger_later
end
end
module BlizzABS
module Weapons
def self.recharge(id)
case id
when 1 then return 40
end
return 40
end
end
module Skills
def self.recharge(id)
case id
when 1 then return 40
end
return 40
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 40
end
return 40
end
end
end
I'm refering to this script.
Thanks in advance!