The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Scripts Database => Topic started by: Bigace on March 12, 2012, 02:16:08 AM

Title: [XP] Scene_Biography v2.3
Post by: Bigace on March 12, 2012, 02:16:08 AM
Scene_Biography
Author: Bigace360
Type: Misc


Introduction
This is a script that calls a window that displays different aspects about a character... like their age, height, gender etc. These can be changed though. This script is free to use and edit as long as credit is given to me.


Feature
Shows actors characteristic stats and battler image or imported image. Can also add a background to it now.


Instructions
Insert this script above main, and call it Scene_Biography. Everything is in the module so there's no need to go any further down unless you know what your doing. Also as default, the script uses the battlers set in the database unless you place a image in the picture folder and place _P at the end of the files name.

Screenshot

(http://i781.photobucket.com/albums/yy94/Bigace360/RMXP/Screenshots/Scene_Bionew.png)

Demo
Not need

Script
Scene_Biography v2.3 (http://adf.ly/HZzLc)

Older versions:
Scene_Biography v1.1 (http://adf.ly/HZzR4)


Compatibility
No known issues.


Credits and Thanks

Author's Notes
Enjoy!
Title: Re: [XP] Scene_Biography v2.3
Post by: Bigace on March 28, 2012, 02:15:25 PM
Links fixed
Title: Re: [XP] Scene_Biography v2.3
Post by: pacdiggity on March 28, 2012, 09:35:03 PM
Your script link is still formatted incorrectly. You should probably test things before you post them or post that you fixed them :)
Title: Re: [XP] Scene_Biography v2.3
Post by: JudasFm on March 29, 2012, 01:02:25 AM
The link sort of works; you just have to delete the first http:// and the nonsense letters after it and add a colon to the http// in the appropriate place. 
Title: Re: [XP] Scene_Biography v2.3
Post by: Bigace on March 29, 2012, 08:14:26 PM
Your script link is still formatted incorrectly. You should probably test things before you post them or post that you fixed them :)

Not my fault, I reformmated like six times, this is getting annoying. Hopefully works this time on your end.
Title: Re: [XP] Scene_Biography v2.3
Post by: JudasFm on March 30, 2012, 07:30:15 PM
Got it into my main menu, but whenever I try to access it, I get an error message:

Script 'Scene_Biography' line 179: NameError occurred.

uninitialized constant Window_Biography:Bio_Window_Settings

Any ideas?
Title: Re: [XP] Scene_Biography v2.3
Post by: Bigace on March 31, 2012, 04:37:44 AM
Um, for some reason I created a typo by adding _Settings to the end of that?? Anyways it should work now.
Title: Re: [XP] Scene_Biography v2.3
Post by: JudasFm on March 31, 2012, 09:30:55 AM
Thanks, that fixed it :) The game no longer crashes but there's another issue; I can't select the character whose biography I want to view. When I choose Biography, it just goes straight in and displays the biography of the most recent character to join the party.
Title: Re: [XP] Scene_Biography v2.3
Post by: Bigace on March 31, 2012, 08:27:15 PM
Thanks, that fixed it :) The game no longer crashes but there's another issue; I can't select the character whose biography I want to view. When I choose Biography, it just goes straight in and displays the biography of the most recent character to join the party.

Oh sorry, thats because you didn't put it in the Menu correctly.
Here's a completely edited Main_menu (sorry I got bored)
Main_Menu(Edited) (http://db.tt/DxW3V49c)

All the parts that say #ACE(Edit) are the parts I intergrated the Biography into it. I got bored and compressed a bunch of other stuff.
Title: Re: [XP] Scene_Biography v2.3
Post by: JudasFm on March 31, 2012, 08:47:38 PM
Well, I'm getting closer :D I edited like you said and now I can select my main character, but whenever I try to press the down arrow to select another, it just goes straight into the main character's bio again. 
Title: Re: [XP] Scene_Biography v2.3
Post by: Bigace on March 31, 2012, 09:05:33 PM
Uh you must of edited your menu wrong as I'm not getting that issue.
Title: Re: [XP] Scene_Biography v2.3
Post by: JudasFm on March 31, 2012, 09:27:11 PM
Very probably, since this is the first time I've tried to do it ;) I'm working off two menus; one is Scene_Menu and the other Update_Scene_Menu (which I need for the Journal script I use, apparently; that one works fine, it was a pure copy-and-paste job).

Scene_Menu

Spoiler for:
class Scene_Menu
# --------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
    @changer = 0
    @where = 0
    @checker = 0
  end
# --------------------------------
  def main
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Save"
    s6 = "Leader"
    s7 = "End game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    if $game_party.actors.size == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    if $game_system.save_disabled
      @command_window.disable_item(4)
    end
    if $game_party.actors.size == 1
      @command_window.disable_item(5)
    end
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
# --------------------------------
  def update
    @command_window.update
    @gold_window.update
    @status_window.update
    if @command_window.active
      update_command
      return
    end
    if @status_window.active
      update_status
      return
    end
  end
# --------------------------------
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new
      when 1
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4
        if $game_system.save_disabled
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Save.new
      when 5
        $game_system.se_play($data_system.decision_se)
        @checker = 0
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 6
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_End.new
      end
      return
    end
  end
# --------------------------------
  def update_status
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 1
        if $game_party.actors[@status_window.index].restriction >= 2
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Skill.new(@status_window.index)
      when 2
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Equip.new(@status_window.index)
      when 3
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Status.new(@status_window.index)
      when 5
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Biography.new(@status_window.index)
        end
      end
      return
    end
  end

Update_Scene_Menu
Spoiler for:
class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Journal"
    s6 = "Biography"
    s7 = "Save"
    s8 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end
    # Make play time window
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    @gold_window.height = 64
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # journal
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to journal scene
        $scene = Scene_Journal.new
  when 5 # biography
    # display character's bio
         $game_system.se_play($data_system.decision_se)
         #switch to bio screen
          @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
         $scene = Scene_Biography.new(@status_window.index)
      when 6  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 7  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end
      return
    end
  end
end

I've tried editing both a little, but nothing works.  Like I said, this is the first time I've changed the menu myself, so it's hardly surprising I've made mistakes :-[ (not too keen to edit heavily since I'm not sure what I'm doing).  Update_Scene_Menu is the one the game works from, which is hardly surprising I guess.  I tried adding your edits to it, but I still get the same problem.

Anyway, if you get the chance to look through it at some point, I'd be very grateful :)
Title: Re: [XP] Scene_Biography v2.3
Post by: Bigace on April 02, 2012, 08:00:45 PM
I have no clue why you removed def update and def update_status, as that is needed, anyways here's a better version.

Here's the menu system from your second spoiler.
Spoiler for:
Code: [Select]
class Scene_Menu
def initialize(menu_index = 0); @menu_index = menu_index; end
def main
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Journal"
s6 = "Biography"
s7 = "Save"
s8 = "End Game"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8])
@command_window.index = @menu_index
(0...3).each {|i| @command_window.disable_item(i)} if $game_party.actors.size == 0
@command_window.disable_item(4) if $game_system.save_disabled
@gold_window = Window_Gold.new
@gold_window.x, @gold_window.y, @gold_window.height = 0, 416, 64
@status_window = Window_MenuStatus.new
@status_window.x, @status_window.y = 160, 0
# I created a array of the 3 windows, that will dispose and update and so you don't waste lines.
@window = [@command_window, @gold_window, @status_window]
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
Graphics.freeze
@window.each {|win| win.dispose}
end
def update
@window.each {|win| win.update}
if @command_window.active
update_command
elsif @status_window.active
update_status
end
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.actors.size == 0 && @command_window.index < 4
disable
end
case @command_window.index
$game_system.se_play($data_system.decision_se)
when 0 then $scene = Scene_Item.new
#The reason why this is combined like this is because they all say the same thing, in coding you don't want to repeat your self as it's a waste of line and memory.
when 1,2,3,5 # skill, equipment, status, biography
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 then $scene = Scene_Journal.new
when 6
if $game_system.save_disabled
disable
end
$scene = Scene_Save.new
when 7 then $scene = Scene_End.new
end
end
end
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active, @status_window.active = true, false
@status_window.index = -1
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @command_window.index
when 1  # skill
if $game_party.actors[@status_window.index].restriction >= 2
disable
end
$scene = Scene_Skill.new(@status_window.index)
when 2 then $scene = Scene_Equip.new(@status_window.index)
when 3 then $scene = Scene_Status.new(@status_window.index)
when 5 then $scene = Scene_Biography.new(@status_window.index) #ACE(EDIT)
end
end
end
def disable
return $game_system.se_play($data_system.buzzer_se)
end
end

But really unless you need to add anything else, you don't need to do anything else to this script.

Title: Re: [XP] Scene_Biography v2.3
Post by: JudasFm on April 02, 2012, 09:57:27 PM
I have no clue why they were removed either; like I said, this was a pure copy and paste job :o I don't understand the script, so I don't mess with it :)

Thanks for taking the time to tighten this up though :) I copied and pasted your script, but now when I start the game I get an error message:

Update Scene_Menu line 44: syntax error occurred

(To save time, I copied and pasted the chunk of code with line 44 highlighted.  Any ideas?  Sorry to keep being a pest but I really love this script and want to get it working in my game.  Again, if you get the time, that would be great :))

Spoiler for:
@window = [@command_window, @gold_window, @status_window]
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
Graphics.freeze
@window.each {|win| win.dispose}
end
def update
@window.each {|win| win.update}
if @command_window.active
update_command
elsif @status_window.active
update_status
end
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.actors.size == 0 && @command_window.index < 4
disable
end
case @command_window.index
$game_system.se_play($data_system.decision_se)
when 0 then $scene = Scene_Item.new
Title: Re: [XP] Scene_Biography v2.3
Post by: Bigace on April 02, 2012, 10:18:11 PM
ops, put the $game_system.se_play($data_system.decision_se)
one line up. Just above the case @command_window.index
Title: Re: [XP] Scene_Biography v2.3
Post by: JudasFm on April 02, 2012, 10:35:36 PM
Fantastic! The script is in my game and now works perfectly ;D Thanks so much for all your help!
Title: Re: [XP] Scene_Biography v2.3
Post by: onfurom on June 12, 2012, 12:44:11 PM
Okay!.... guys i need help this Bio script i got from Big ace :http://rmrk.net/index.php?topic=45339.0
well here's the probs okay i solve my problem from menu scene bio
but the next i encounter a problem is how i choose other char
bio? cuz i got the default bio only..
and i want that u can move other char by arrows...
Like Aluxes then u can change it to Dorothy or Esc to
exit   :'(


====:SORRY FOR BAD ENGLISH
Title: Re: [XP] Scene_Biography v2.3
Post by: Bigace on June 25, 2012, 03:55:07 AM
Sorry I haven't been on in a while, Onfurom if you're still wondering the default buttons are Q = left and W = right.
But I can change that for you:
Code: [Select]
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ? Scene_Biography                                                 
# ? Author: Bigace360   
# ? Version: 2.3
# ? Date: Dec. 7, 2011 
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#                               VERSION HISTORY                                #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# v.1.0 (Dec. 7, 2010)
#   ~ Original script completed
# v.1.1 (Jan. 8, 2012)
#   ~ Improved coding
# v.2.0 (Jan. 22, 2012)
# ~ The code has been rewriten so it's easier to use and takes up less lines.
# ~ Added "slice_text" method by Blizzard, which automatically break to next
# line when needed
# v.2.3 (Feb. 14, 2012)
# ~ You can align your paragraph's in the module [Right, Center, Left]
#   ~ You can now add a custom layount to your Biography screen.
#   ~ Improved coding
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# To call the Biography Menu
# $scene = Scene_Biography.new(@status_window.index)
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ? Module ACE
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
module ACE #Customization Begins
#             [X, Y, Suffix for portrait graphics]
PORTRAIT    = [300, 545, "_P"] #If the image isn't found in the folder
#then the script will use the batter image.
#             [Font Type, Font size]
FONT_TYPE     = ['Verdana',16]
#               [His, Bio]
History_Bio = [5,  250] #Y Coordinates for the History and Bio Paragraphs

# Bio_Window = [Position X, Position Y, Width, Height, Opacity, Trasparent Edge]
Bio_Window = [0, 0, 640, 480, 255, false]

# Image filename for window layout, must be on the Windowskin folder
Bio_Window_Bg = ''


# Position of the layout image
# Bio_Window_Bg_Postion = [Position X, Position Y]
Bio_Window_Bg_Postion = [0 , 0]

Para_Alignment = 0 # 0=Right, 1=Center, 2=Left

CHARACTER_STATS = ['Name:', 'Class:', 'Age:', 'Gender:', 'Race:',' Height:',
'Weight:', 'Weapon:', 'From:', 'Speciality:']
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
#    when ID then "STRING"
#
# ID is the enemy ID and STRING is a string with the information that should be
# displayed. Type all the information into one string, the script will slice
# the text by itself. Note that special characters like a " (double quote)
# need the use of the escape character \ (backslash). If you get and error
# with your string or the character doesn't appear right on the screen, try to
# use the escape character (i.e. for a " it would be \" instead of just ").
# The backslash itself needs an escape character (i.e. \\).
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Configure the values used for the above array for each character. Just make
# sure the value that corresponds to each stat is at the same index in the [].
def self.character_info(id)
info = case id
when 1 then ['Aluxes Smith', 'Fighter', '19', 'Male', 'Human', '5\'10"', '165 lbs.', 'Sword','England', 'Swordplay']
when 2 then ['Basil Doe', 'Lancer', '24', 'Male', 'Human', '6\'0"', '169 lbs.', 'Spear', 'America', 'Lanceplay']
when 3 then ['Cyrus Ray', 'Warrior', '21', 'Male', 'Human', '5\'7"', '197 lbs.', 'Axes', 'New Zealand','Axeplay']
when 4 then ['Dorothy Griffen', 'Thief', '19', 'Female', 'Human', '5\'7"', '119 lbs.', 'Knives', 'Canada', 'Robbery']
when 5 then ['Estelle Green', 'Hunter', '16', 'Female', 'Elf', '5\'8"', '116 lbs.', 'Great Bows', 'Ireland', 'Archery']
when 6 then ['Felix Clarke', 'Gunner', '20', 'Male', 'Human', '5\'7"', '135 lbs.', 'Guns', 'France', 'Gunnery']
when 7 then ['Gloria Clarke','Cleric', '18', 'Female', 'Human', '5\'4"', '119 lbs.', 'Wands', 'Germany', 'White magic']
when 8 then ['Hilda May', 'Mage', '20', 'Female', 'Human', '5\'5"', '113 lbs.', 'Staff', 'Berlin', 'Black Magic']
end
return info != nil ? info : []
end
# Short paragraph/description of character. Uses Blizzard's slice_text method
# to automatically break to next line when needed, so do not concern yourself
# with that.
def self.character_bio(id)
text = case id
when 1 then 'This is an actors biography description text in different lines must be separated by comas.This is an actors biography description text in different lines must be separated by comas.This is an actors biography description text in different lines must be separated by comas.This is an actors biography description text in different lines must be separated by comas.'
when 2 then 'This is an actors biography description text in different lines must be separated by comas.'
when 3 then 'This is an actors biography description text in different lines must be separated by comas.'
when 4 then 'This is an actors biography description text in different lines must be separated by comas.'
when 5 then 'This is an actors biography description text in different lines must be separated by comas.'
when 6 then 'This is an actors biography description text in different lines must be separated by comas.'
when 7 then 'This is an actors biography description text in different lines must be separated by comas.'
when 8 then 'This is an actors biography description text in different lines must be separated by comas.'
end
return text != nil ? text : ''
end
def self.character_history(id)
text = case id
when 1 then 'This is an actors history description text in different lines must be separated by comas.'
when 2 then 'This is an actors history description text in different lines must be separated by comas.'
when 3 then 'This is an actors history description text in different lines must be separated by comas.'
when 4 then 'This is an actors history description text in different lines must be separated by comas.'
when 5 then 'This is an actors history description text in different lines must be separated by comas.'
when 6 then 'This is an actors history description text in different lines must be separated by comas.'
when 7 then 'This is an actors history description text in different lines must be separated by comas.'
when 8 then 'This is an actors history description text in different lines must be separated by comas.'
end
return text != nil ? text : ''
end
end
$ace_script = {} if $ace_script == nil                      
$ace_script["Biography"] = true                        
###############################################################################
# ? Customization Ends
###############################################################################
class Bitmap
attr_accessor :bg_color
unless @bigace_bitmap_initialize
@bigace_bitmap_initialize = true
alias_method :cl_initialize, :initialize
def initialize(a, b = nil)
cl_initialize(a, b) if b != nil
cl_initialize(a) unless b != nil
@bg_color = Color.new(61,52,109)
end 
end
#------------(slice_text method by Blizzard)-------
def slice_text(text, width)
words = text.split(' ')
return words if words.size == 1
result, current_text = [], words.shift
words.each_index {|i|
if self.text_size("#{current_text} #{words[i]}").width > width
result.push(current_text)
current_text = words[i]
else
current_text = "#{current_text} #{words[i]}"
end
result.push(current_text) if i >= words.size - 1}
return result
end
#--------------------------------------------------
def text_bordered(x, y, width, height, text, align = 1)
color2 = font.color.clone
font.color = @bg_color
draw_text(x + 1, y + 1, width, height, text, align)
draw_text(x + 1, y - 1, width, height, text, align)
draw_text(x - 1, y + 1, width, height, text, align)
draw_text(x - 1, y - 1, width, height, text, align)
font.color = color2
draw_text(x, y, width, height, text, align)
end
end
class Window_Base < Window
include ACE
def nada(actor); face = RPG::Cache.battler(actor.battler_name, actor.battler_hue); end
def draw_heroface(actor,x,y)
face = RPG::Cache.picture(actor.name + PORTRAIT[2]) rescue nada(actor)
cw, ch = face.width, face.height
if face == RPG::Cache.battler(actor.battler_name, actor.battler_hue)
self.contents.blt(x + 40 , y - ch - 240, face, Rect.new(0, 0, cw, ch))
else
self.contents.blt(x , y - ch, face, Rect.new(0, 0, cw, ch))
end
end
end
class Window_Biography < Window_Base
include ACE
def initialize(actor)
super(Bio_Window[0], Bio_Window[1], Bio_Window[2], Bio_Window[3])
self.contents = Bitmap.new(width - 32, height - 32)
@background_image = Sprite.new
@background_image.bitmap = RPG::Cache.windowskin(Bio_Window_Bg)
@background_image.x = self.x + Bio_Window_Bg_Postion[0]
@background_image.y = self.y + Bio_Window_Bg_Postion[1]
@background_image.z = self.z - 1
@background_image.visible = self.visible
self.back_opacity = Bio_Window_Settings[4]
self.opacity = Bio_Window_Settings[4] if Bio_Window_Settings[5]
self.contents.font.name, self.contents.font.size = FONT_TYPE[0], FONT_TYPE[1]
@actor = actor
refresh
end
def refresh
self.contents.clear
stats = CHARACTER_STATS
info = ACE.character_info(@actor.id)
self.contents.font.color = system_color
y = 20
self.contents.font.bold = true
stats.each_index {|i| self.contents.text_bordered(0, i*(y*2), 128, y, stats[i],0)}
self.contents.text_bordered(200, History_Bio[0], 128, y, 'BIOGRAPHY:',0)
self.contents.text_bordered(200, History_Bio[1], 128, y, 'HISTORY:',0)
self.contents.font.bold = false
self.contents.font.color = normal_color
#-----------------------------
info.each_index {|i| self.contents.text_bordered(8, y+i*(y*2), 128, y, info[i],0)}
#-----------------------------
bio = self.contents.slice_text(ACE.character_bio(@actor.id), 370)
bio.each_index {|i| self.contents.text_bordered(220, (10+y)+i*y, 370, y, bio[i],Para_Alignment)}
#-----------------------------
his = self.contents.slice_text(ACE.character_history(@actor.id), 370)
his.each_index {|i| self.contents.text_bordered(220, (255+y)+i*y, 370, y, his[i],Para_Alignment)}
end
def dispose
super
@background_image.dispose if @background_image != nil
end
def visible=(n)
super
@background_image.visible = n if @background_image != nil
end
end
class Window_Face < Window_Base
def initialize(actor)
super(0, -20, 600, 520)
self.contents = Bitmap.new(width - 32, height - 32)
@actor, self.opacity, self.contents_opacity, self.z = actor, 0, 140, 99
refresh
end
def refresh
self.contents.clear
draw_heroface(@actor, PORTRAIT[0], PORTRAIT[1])
end
end
class Scene_Biography
def initialize(actor_index = 0); @actor_index = actor_index; end
def main
@actor = $game_party.actors[@actor_index]
@status_face, @biog_window = Window_Face.new(@actor), Window_Biography.new(@actor)
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
Graphics.freeze
[@biog_window, @status_face].each {|window| window.dispose}
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(3)
elsif Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Biography.new(@actor_index)
elsif Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Biography.new(@actor_index)
end
end
end
Title: Re: [XP] Scene_Biography v2.3
Post by: ribitt on July 21, 2012, 03:48:52 PM
Hello ^^ I was wondering how to edit the script so that if you chose to change the character's name in the game, the script would notice it instead of it being the basic name. I tried the /N[1] but it didn't work.