Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: Jragyn on May 28, 2011, 01:13:45 am

Title: [XP] J::EQUAP bars!
Post by: Jragyn on May 28, 2011, 01:13:45 am
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




Screenshots

Spoiler: ShowHide
(http://i53.tinypic.com/wlj48.png)



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 (http://pastebin.com/NVwGLHvp) 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




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 :)
Title: Re: [XP] J::EQUAP bars!
Post by: ForeverZer0 on May 28, 2011, 01:19:38 am
Good job, my little protégé!
Title: Re: [XP] J::EQUAP bars!
Post by: G_G on May 28, 2011, 01:26:33 am
Nice job.

@F0: When moving try and leave a redirection topic.
Title: Re: [XP] J::EQUAP bars!
Post by: ForeverZer0 on May 28, 2011, 02:21:03 am
Sorry, thought I caught it fast enough not to need one.
Title: Re: [XP] J::EQUAP bars!
Post by: Blizzard on May 28, 2011, 03:54:45 am
There is no "Misc. Add-on" key term. There is only "Misc Add-on".
Title: Re: [XP] J::EQUAP bars!
Post by: Jragyn on May 28, 2011, 11:29:25 am
Thanks Blizzard.
Fixed it :P