[XP] J::EQUAP bars!

Started by Jragyn, May 28, 2011, 01:13:45 am

Previous topic - Next topic

Jragyn

May 28, 2011, 01:13:45 am Last Edit: May 28, 2011, 11:29:07 am by Jragyn
J::EQUAP bars!
Authors: Jragyn
Version: 1
Type: TONs Plug-in
Key Term: Misc Add-on



Introduction

This script is just another visual representation of Blizzard's EQUAP system, but instead of AP/MAXap, it also uses bars.
The Blizzart Bars, mind you.


Features


  • Enables Bars to be used for Learnable EQUAP skills.

  • Can give a unique $game_system.bar_style to just the EQUAP bars.

  • Can change the coloring of just the EQUAP bars.

  • etc.




Screenshots

Spoiler: ShowHide



Demo

There doesn't need to be a demo for this.
Though I will make one of someone asks for it...(seriously I mean)


Script

Pastebin Link or:
Spoiler: ShowHide

=begin
____________________________
| J::EQUAP bars!             |
| Author: Jragyn             |
|____________________________|

 This script is more like a plug-in for the EQUAP system.
 It displays a bar that measures the AP vs. MAXap for any given skill.
 
 Of course...
 This script does require TONs to work.
 And the Blizzart BARS to be enabled.
 And the EQUAP System to be enabled and setup.
 

Credit to ForeverZer0 for being a Ruby Reference Bible for dummies :)

=end


#v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^
#::Aliased/Overwrite  [Window_Skill] ----- draw_item
#v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^

#========================#
# Set the wordage for a  #
# learned skill here:    #
module J                 #
 LEARNT = '-Master-'    #
#=======================================#
# Use a new color scheme                #
# for the EQUAP bars?                   #
 NEW_SCHEME = true                     #
# only need to set if NEW_SCHEME = true #
 SCHEME_1 = Color.new( 96, 96, 96,192) # (just a darkish grey)
 SCHEME_2 = Color.new(192,192,192,192) # (just a lighter grey)
#=======================================#
# Use a different $bar_style            #
# for the EQUAP bars?                   #
 NEW_BARS = true                       #
# only need to set if NEW_BARS = true   #
 J_STYLE = 2 # ( 0~6 )                 #
#=======================================#
end #
#===#

class Window_Skill
 alias j_draw_item_equap_bar draw_item
 def draw_item(index, w=148)

#checks to verify both Blizzart BARS and EQUAP are enabled.
if $game_system.BARS && TONS_OF_ADDONS::EQUAP_SKILLS

   skill = @data[index]    
   if @actor.skill_can_use?(skill.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   
   rate = 0
   if BlizzCFG.maxap(skill.id) > 0
     rate = @actor.ap(skill.id).to_f / BlizzCFG.maxap(skill.id)
   end#if
 #uses set colors in J::~~ if set to true, otherwise uses defaults.  
 if J::NEW_SCHEME
   color1 = J::SCHEME_1
   color2 = J::SCHEME_2
 else
   
 #color determination, based on Blizzard's draw_hp_bar(whatever) colorscheme.
     if rate > 0.6
       color1 = Color.new(80 - 150 * (rate-0.6), 80, 50 * (rate-0.6), 192)
       color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6), 192)
     elsif rate > 0.2 && rate <= 0.6
       color1 = Color.new(80, 200 * (rate-0.2), 0, 192)
       color2 = Color.new(240, 600 * (rate-0.2), 0, 192)
     elsif rate <= 0.2
       color1 = Color.new(400 * rate, 0, 0, 192)
       color2 = Color.new(240, 0, 0, 192)
     end#if
 end#ifJscheme
     color3 = Color.new(0, 80, 0, 192)
     
   x = 4 + index % 2 * (288 + 32)
   y = index / 2 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(skill.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
#===============================================================================
# The deciding part as to whether or not to draw the bars and/or ap_infos.    
     if BlizzCFG.maxap(skill.id) > 0 && @actor.ap(skill.id) == BlizzCFG.maxap(skill.id)
       self.contents.draw_text(x + 180, y, 60, 32, J::LEARNT, 2)
     elsif BlizzCFG.maxap(skill.id) > 0
       ap_info = "[#{@actor.ap(skill.id)}/#{BlizzCFG.maxap(skill.id)}]"
         if J::NEW_BARS
           original_style = $game_system.bar_style
           J::J_STYLE > 6 ? $game_system.bar_style = 2 : $game_system.bar_style = J::J_STYLE
           self.contents.gradient_bar(x+24, y, w, color1, color2, color3, rate)
           $game_system.bar_style = original_style
         else
           self.contents.gradient_bar(x+24, y, w, color1, color2, color3, rate)
         end#if_newbars
       self.contents.draw_text(x+180, y, 64, 32, ap_info, 0)
     end#if
#===============================================================================      
     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
   self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
 else
   j_draw_item_equap_bar(index)
 end#bars&equap
end#def

end#class



Instructions

As long as you have both Blizzart BARS (within TONs) enabled, and EQUAP enabled,
this script will function completely fine on its own. Though there are a couple extra little
aesthetics you can play with if you like.


Compatibility

May not work if you have a custom Window_Skill.


Credits and Thanks


  • Jragyn: I made it!

  • ForeverZer0: for allowing me to reference him like a Ruby Bible (or something like that XD )




Author's Notes

I can't really think of anything else I should stack on or add to this,
but if you think of something I need to know about this,
or have a recommendation/request, please let me know :)
A bright light can either illuminate or blind, but how will you know which until you open your eyes?

ForeverZer0

Good job, my little protégé!
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

G_G

Nice job.

@F0: When moving try and leave a redirection topic.

ForeverZer0

Sorry, thought I caught it fast enough not to need one.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Blizzard

There is no "Misc. Add-on" key term. There is only "Misc Add-on".
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Jragyn

A bright light can either illuminate or blind, but how will you know which until you open your eyes?