New Scene_Status

0 Members and 1 Guest are viewing this topic.

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
New Scene_Status
Version: 1.0

Introduction

Modifies the Scene_Status

Screenshots



Script

Code: [Select]
#===================================================
# New Scene Status by Falcon
# Credit also goes to AcedentProne, since I used his Gradient Bar script
# Version History
# v1.0 Added Gradient Bars
# v.9 Initial Test
#===================================================

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#=====================================
#Gradient Bars with customizable lengths, thicknesses, types and Colors
#By AcedentProne
#=====================================
 def draw_normal_barz(x, y, type, length, thick, e1, e2, c1 = Color.new(153,238,153,255), c2 = Color.new(0,0,0,255))
   if type == "horizontal"
     width = length
     height = thick
     self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
     self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
     w = width * e1 / e2
     for i in 0..height
     r = c1.red + (c2.red - c1.red)   * (height -i)/height  + 0   * i/height
     g = c1.green + (c2.green - c1.green) * (height -i)/height  + 0 * i/height
     b = c1.blue + (c2.blue - c1.blue)  * (height -i)/height  + 0 * i/height
     a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height  + 255 * i/height
     self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
   end
 elsif type == "vertical"
   width = thick
   height = length
     self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
     self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
   h = height * e1 / e2
   for i in 0..width
     r = c1.red + (c2.red - c1.red)   * (width -i)/width  + 0   * i/width
     g = c1.green + (c2.green - c1.green) * (width -i)/width  + 0 * i/width
     b = c1.blue + (c2.blue - c1.blue)  * (width -i)/width  + 0 * i/width
     a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width  + 255 * i/width
     self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
   end
 end
end
def draw_actor_barz(actor,x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
   if type == "horizontal"
     width = length
     height = thick
     self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
     self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
     w = width * e1 / e2
     for i in 0..height
     r = c1.red + (c2.red - c1.red)   * (height -i)/height  + 0   * i/height
     g = c1.green + (c2.green - c1.green) * (height -i)/height  + 0 * i/height
     b = c1.blue + (c2.blue - c1.blue)  * (height -i)/height  + 0 * i/height
     a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height  + 255 * i/height
     self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
   end
 elsif type == "vertical"
   width = thick
   height = length
     self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
     self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
   h = height * e1 / e2
   for i in 0..width
     r = c1.red + (c2.red - c1.red)   * (width -i)/width  + 0   * i/width
     g = c1.green + (c2.green - c1.green) * (width -i)/width  + 0 * i/width
     b = c1.blue + (c2.blue - c1.blue)  * (width -i)/width  + 0 * i/width
     a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width  + 255 * i/width
     self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
   end
 end
end
  #--------------------------------------------------------------------------
  # * Draw EXP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_exp(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 24, 32, "Exp")
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 10, y, 84, 32, actor.exp_s, 2)
    self.contents.draw_text(x + 100, y, 12, 32, "/", 1)
    self.contents.draw_text(x + 112, y, 84, 32, actor.next_exp_s)
  end
end
#==============================================================================
class Scene_Status
 
#---------------------------------------------------------------------------------
  def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
  end
#---------------------------------------------------------------------------------

def main
    @actor = $game_party.actors[@actor_index]
    @window_actor = Window_Actor.new(@actor)
    @window_actor.x =0
    @window_actor.y =0
    @window_actor.height = 380
    @window_actor.width = 380
    @windowhpsp = WindowHPSP.new(@actor)
    @windowhpsp.x =0
    @windowhpsp.y =379
    @windowhpsp.height = 101
    @windowhpsp.width = 380
    @window_exp = Window_exp.new(@actor)
    @window_exp.x =379
    @window_exp.y =0
    @window_exp.height = 100
    @window_exp.width = 261
    @window_equipment = Window_equipment.new(@actor)
    @window_equipment.x =379
    @window_equipment.y =99
    @window_equipment.height = 381
    @window_equipment.width = 261
Graphics.transition
    loop do
      Graphics.update
      Input.update
     update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @window_actor.dispose
    @windowhpsp.dispose
    @window_exp.dispose
    @window_equipment.dispose
  end
#---------------------------------------------------------------------------------
  def update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(3)
      return
    end
    if Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Status.new(@actor_index)
      return
    end
    if Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Status.new(@actor_index)
      return
    end
  end
end

#===================================================
# Scene Status Ends
#=================================================== 



#===================================================
# Window_Actor Begins
#===================================================

class Window_Actor < Window_Base

#---------------------------------------------------------------------------------     
  def initialize(actor)
    super(0, 0, 380,380)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
#---------------------------------------------------------------------------------   
  def draw_actor_battler(actor, x, y)
    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(0, 0, bitmap, src_rect)
  end
#----------------------------------------------------------------------------------
  def refresh
    draw_actor_battler(@actor, 0, 0)
    draw_actor_graphic(@actor, 60, 330)
    draw_actor_name(@actor, 120, 0)
    draw_actor_class(@actor, 120 + 120, 0)
    draw_actor_level(@actor, 120, 32)
    draw_actor_state(@actor, 244, 32)
    draw_actor_parameter(@actor, 170, 96, 0)
    draw_actor_parameter(@actor, 170, 128, 1)
    draw_actor_parameter(@actor, 170, 160, 2)
    draw_actor_parameter(@actor, 170, 192, 3)
    draw_actor_parameter(@actor, 170, 224, 4)
    draw_actor_parameter(@actor, 170, 256, 5)
    draw_actor_parameter(@actor, 170, 288, 6)
  end
end
#===================================================
# Window_Actor Ends
#===================================================


#===================================================
# Window_HPSP Begins
#===================================================

class WindowHPSP < Window_Base

#---------------------------------------------------------------------------------     
  def initialize(actor)
    super(0, 0, 380,101)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
#---------------------------------------------------------------------------------   
   def refresh
    draw_actor_hp(@actor, 0, 0, 172)
    draw_actor_sp(@actor, 0, 32, 172)
    draw_normal_barz(175, 11, "horizontal", 150, 10, @actor.hp.to_i, @actor.maxhp.to_i, Color.new (225, 0, 0, 225))
    draw_normal_barz(175, 44, "horizontal", 150, 10, @actor.sp.to_i, @actor.maxsp.to_i, Color.new (0,0,255,255))
  end
end
#===================================================
# Window_HPSP Ends
#===================================================


#===================================================
# Window_exp Begins
#===================================================

class Window_exp < Window_Base

#---------------------------------------------------------------------------------     
  def initialize(actor)
    super(0, 0, 261,100)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
#---------------------------------------------------------------------------------   
  def refresh
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 80, 32, "Exp")
    self.contents.draw_text(120, 0, 80, 32, "Left")
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 32, 84, 32, @actor.exp_s, 2)
    self.contents.draw_text(140, 32, 84, 32, @actor.next_rest_exp_s, 2)
  end
end
#===================================================
# Window_exp Ends
#===================================================


#===================================================
# Window_equipment Begins
#===================================================

class Window_equipment < Window_Base

#---------------------------------------------------------------------------------     
  def initialize(actor)
    super(0, 0, 261,381)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
#---------------------------------------------------------------------------------   
  def refresh
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 96, 32, $data_system.words.weapon)
    self.contents.draw_text(0, 64, 96, 32, $data_system.words.armor1)
    self.contents.draw_text(0, 128, 96, 32, $data_system.words.armor2)
    self.contents.draw_text(0, 196, 96, 32, $data_system.words.armor3)
    self.contents.draw_text(0, 256, 96, 32, $data_system.words.armor4)
    draw_item_name($data_weapons[@actor.weapon_id], 0, 32)
    draw_item_name($data_armors[@actor.armor1_id], 0, 96)
    draw_item_name($data_armors[@actor.armor2_id], 0, 160)
    draw_item_name($data_armors[@actor.armor3_id], 0,228)
    draw_item_name($data_armors[@actor.armor4_id], 0, 288)
  end
end
#===================================================
# Window_equipment Ends
#=================================================== 

Instructions

Place this above main, below everything else and it should work fine :)

FAQ

N/A

Compatibility

Non SDK

Credits and Thanks

Give credit to Falcon, and Acedent Prone (for his gradient bars)

Author's Notes

None

*
Communication begins with understanding
Rep:
Level 89
Project of the Month winner for October 2007
Nice script there. Think Im gonna use it.

**
Rep: +0/-0Level 86
Nice script but 1 glitch wen you open the status screen it doesent show any text but it would be awsome if i could see the text  ;D

*
Communication begins with understanding
Rep:
Level 89
Project of the Month winner for October 2007
Replace this with Main

Code: [Select]
#==============================================================================
# ? Main
#------------------------------------------------------------------------------
# ?This class defines general game behavior.
#==============================================================================

begin
 
 # Font used in windows
$defaultfonttype = $fontface = $fontname = Font.default_name = "Tahoma"

# Font size used
$defaultfontsize = $fontsize = Font.default_size =  20
 
 # Freeze graphics
 Graphics.freeze
 
 # Title picture to use
 $scene = Scene_Title.new
 

 while $scene != nil
   $scene.main
 end

 Graphics.transition(20)
 
rescue Errno::ENOENT
 
 # Error message when file cannot be opened
 filename = $!.message.sub("No such file or directory - ", "")
 print("File #{filename} was not found.")
 
end


And I think it should work, since it works for me ::)
« Last Edit: August 24, 2007, 06:44:58 PM by Black Shadow »

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Yeah, this was made ages ago, when PKE was still technically legal :P

**
Rep: +0/-0Level 86
o ok ty ill use this for my game its just wat i needed anyways =)

EDIT: ty it works great and im keeping it fer my game =) rep +
« Last Edit: August 24, 2007, 07:18:58 PM by c93s »

*
Communication begins with understanding
Rep:
Level 89
Project of the Month winner for October 2007
I have a question Falcon. Is it possible to take away those bars? Since I want to use the bar script im using, and these bars in this script is just in the way. So how do I take them away?

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Post your bar script and I'll do a quick edit, it would only take a minute or two for me.

*
Communication begins with understanding
Rep:
Level 89
Project of the Month winner for October 2007
Yeah, it didn't took long for me to edit it. I knew that I was suppose to edit something in the script, but I wasn't sure what.

But It's solved now.