[VX] Exp Bar in Window_MenuStatus

Exp bar in Window_MenuStatus
Version: 1.1
By: Teth

Introduction

This script show exp bar in Window_MenuStatus
*There was error made by me ^^ script is now ok*

Information
Version 1.1 - Percentage exp text made :)
Added demo

Screenshots

Image

Demo

Argh... take it ^^ http://www.speedyshare.com/300862514.html

Script

script Spoiler
  1.  
  2.  
  3. #==============================================================================
  4. # â–  Window_MenuStatus
  5. # Script made by Teth
  6. #==============================================================================
  7.  
  8. class Window_MenuStatus < Window_Selectable
  9.   #--------------------------------------------------------------------------
  10.   # * Object Initialization
  11.   #     x : window X coordinate
  12.   #     y : window Y coordinate
  13.   #--------------------------------------------------------------------------
  14.   def initialize(x, y)
  15.     super(x, y, 384, 416)
  16.     refresh
  17.     self.active = false
  18.     self.index = -1
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # ● Refresh
  22.   #--------------------------------------------------------------------------
  23.   def refresh
  24.     self.contents.clear
  25.     @item_max = $game_party.members.size
  26.     for actor in $game_party.members
  27.     draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
  28.     x = 104
  29.     y = actor.index * 96 + WLH / 2
  30.     draw_actor_name(actor, x, y)
  31.     draw_actor_class(actor, x + 120, y - 13)
  32.     draw_actor_level(actor, x, y + WLH * 1)
  33.     draw_actor_state(actor, x, y + WLH * 2)
  34.     draw_actor_hp(actor, x + 120, y + WLH * 1 - 13)
  35.     draw_actor_mp(actor, x + 120, y + WLH * 2 - 13)
  36.     draw_actor_expbar(actor, x + 120, y + WLH * 3 - 13)
  37.     end
  38.   end
  39. end
  40.   #--------------------------------------------------------------------------
  41.   # ● Update
  42.   #--------------------------------------------------------------------------
  43.     def update_cursor
  44.     if @index < 0 # カーソルなし
  45.       self.cursor_rect.empty
  46.         elsif @index < @item_max # 通常
  47.           self.cursor_rect.set(0, @index * 96, contents.width, 96)
  48.             elsif @index >= 100 # 自分
  49.               self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
  50.             else # 全体
  51.               self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
  52.   end
  53. end
  54.   #--------------------------------------------------------------------------
  55.   # ● Actor expbar code
  56.   #--------------------------------------------------------------------------
  57.   def draw_actor_expbar(actor, x, y, width = 120)
  58.     draw_actor_exp_gauge(actor, x, y)
  59.     s1 = actor.exp_s - actor.current_lvl_exp
  60.     s2 = actor.next_lvl_exp
  61.     s3 = 100*s1/s2
  62.     self.contents.font.color = system_color
  63.     self.contents.draw_text(x, y, 40, Window_Base::WLH, 'Exp')
  64.     self.contents.font.color = hp_color(actor)
  65.     last_font_size = self.contents.font.size
  66.     xr = x + width
  67.     if width < 120
  68.       self.contents.draw_text(xr - 44, y, 34, Window_Base::WLH, s3, 2)
  69.     else
  70.       self.contents.draw_text(xr - 89, y, 34, Window_Base::WLH, s3, 2)
  71.       self.contents.font.color = normal_color
  72.       self.contents.draw_text(xr - 55, y, 11, Window_Base::WLH, "%", 2)
  73.     end
  74.   end
  75.  
  76.   def draw_actor_exp_gauge(actor, x, y, width = 120)
  77.       color_behind = Color.new(39, 58, 83, 255)
  78.       exp_color = Color.new(0, 200, 0, 255)
  79.       nextexp_color = Color.new(0, 100, 0, 255)
  80.       s1 = actor.exp_s
  81.       s2 = actor.current_lvl_exp
  82.       level = actor.level
  83.     if level != 99 #For avoid Fixnum bug
  84.       s3 = s1-s2
  85.       s4 = actor.next_lvl_exp
  86.       self.contents.fill_rect(x, y + Window_Base::WLH - 8,width,6,color_behind)
  87.       self.contents.gradient_fill_rect(x, y + Window_Base::WLH - 8,(width*s3)/s4,6,exp_color,nextexp_color)
  88.     else
  89.       self.contents.gradient_fill_rect(x, y + Window_Base::WLH - 8,width,6,exp_color,nextexp_color)
  90.     end
  91.   end
  92.  
  93.   #--------------------------------------------------------------------------
  94.   # ● End of expbar code
  95.   #--------------------------------------------------------------------------
  96.  
  97. #==============================================================================
  98. # ** Game_Actor
  99. #------------------------------------------------------------------------------
  100. # This class handles actors. It's used within the Game_Actors class
  101. # ($game_actors) and referenced by the Game_Party class ($game_party).
  102. #==============================================================================
  103.  
  104. class Game_Actor < Game_Battler
  105.  
  106.   #--------------------------------------------------------------------------
  107.   # ● Two needed defs ^^
  108.   #--------------------------------------------------------------------------
  109.   def current_lvl_exp
  110.     return @exp_list[@level]
  111.   end
  112.  
  113.   def next_lvl_exp
  114.     return @exp_list[@level+1]-@exp_list[@level]
  115.     end
  116.   end
Expand to see the code.


Instructions

Just place it above main

Compatibility

This script overwrites Window_MenuStatus

Credits and Thanks

Thanks to Tavoeltav for request
Basic... But useful. Looks alot better than the crappy text in the RTP
That bar is going to look awkward when you have more than 4 digits worth of experience...
Thanks for comments and ye i know that what you said Diedrupo :P
I was trying to make a percents but i get bugged ^^
I'll try to make percents so this will look better (maybe)

@edit
Right 1.1 now ^^ I've made this percentage exp text
MAN... i need that demo i started to play rpg maker vx today:(
Okay, I'm going to use this for my project, but I changed the text on the bar to XP rather than Exp, are you okay with that?
It's a cool script...

One question... How long did it take you to learn Ruby, and where did you learn it? :blank:

I want to follow in your footsteps...
@Mustardy85
Thanks for your com ^^ You've made me smile first time in this week xD
Not long ^^ About 2-3 weeks from start learning to make this script. I have book "Ruby. Programming" wrote by creator of Ruby :)
And you must just need to learn it :) Ruby isn't that hard lang. As Matz said thats something between hard and easy language (btw. before i was learning some langs too cuz you have to know even something to know what do you read in this book xD). And read some scripts on this forum to see how everything works in RGSS and how to use ruby.
@Soupnazi
Don't worry. If you want to change it - just change ^^
@Kaze5115
No demo is needed to this script (but i've added) ^^ Just place this above main. If you don't know how read :
-Press F11 when you have opened your project in rmvx
-Go on down of list of scripts
-Above "main" you'll have "Materials"
-Click under this "Materials" and press insert
-Copy my script then get to your project and paste it in this big white place
-Click "Apply" and "Ok" or only "Ok" ^^
-Save your project and press F12 to test your game then choose "New Game"
-Then press ESC to look result ^^

Sry that i haven't responded for that big time but i was taking rest ^^

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=63705