Main Menu
  • Welcome to The RPG Maker Resource Kit.

Character Biography REVISION

Started by italianstal1ion, February 04, 2007, 08:01:13 AM

0 Members and 1 Guest are viewing this topic.

italianstal1ion

Originally made by Claimh, I found it a little bland. So here's what I added:

Has SEVEN lines to describe your character, instead of three
Added Blood Type, Gender, Specialty, and Race. Also displays character's class.
Cleaned up some code, made it look nicer, took out foreign comments
And a bunch of small edits...
I have also added a FAQ at the end of the script.

What it does
"This will display character properties in a new status screen.
To access it, go into your existing status screen in the usual way,
then press the decision key. You will then be greeted with a short
biography of your selected character."


Script
put it above main, below everything else...blah blah blah
[spoiler="Script"]#==============================================================
# Character biography screens    Ver. 1.2    by Claimh
# Translated by TruthfulTiger
# Revision by ItalianStal1ion (shows more features; lines)
#------------------------------------------------------------------------------
#   This will display character properties in a new status screen.
#   To access it, go into your existing status screen in the usual way,
#   then press the decision key. You will then be greeted with a short
#   biography of your selected character.
#   The default stats (were)are: Name, Age, From, Height and Weight, but you can change
#   them to anything you want. You can also change the colour of the heading text.
#
#   ItalianStal1ion's Revision:
#   You can now have SEVEN lines to describe your character, instead of three
#   Added Blood Type, Gender, Specialty, and Race. Also displays character's class.
#   Cleaned up some code, made it look nicer, took out foreign comments
#   And a bunch of small edits...(moved battler for more room...)
#   Added FAQ
#
#   Extra
#   To call without going to status window:
#    Go to about line 335, and read the comment there.
#    call by $scene = Scene_Charactor.new
#==============================================================

#----------------------------------------------------------------------------
#   START
#----------------------------------------------------------------------------
# This sets the decision key as the key to access the bios.
CHENGE_KEY = Input::C
#--------------------------------------------------------------------------
# This is where you determine the characters' ages. There's spaces for eight,
# although you can add more. Each "??" is where you set the age, in order of
# where your characters are in the database. I.e, the first "??" is for character one,
# the "??" after that is for character two, etc.
#--------------------------------------------------------------------------
CHARA_AGE = ["??","??","??","??","??","??","??","??"]
#--------------------------------------------------------------------------
# This is where you set where each of your characters comes from. Same applies
# as for age, i.e in order of characters in the database.
#--------------------------------------------------------------------------
CHARA_FROM = ["Run Time Package","??","??","??","??","??","??","??"]
#--------------------------------------------------------------------------
# This is character height by default. I changed this to "Lives in".
#--------------------------------------------------------------------------
CHARA_H = ["6'","??","??","??","??","??","??","??"]
#--------------------------------------------------------------------------
# This is character's weight by default.
#--------------------------------------------------------------------------
CHARA_W = ["Heavy","??","??","??","??","??","??","??"]
#--------------------------------------------------------------------------
# This is the character's race by default
#--------------------------------------------------------------------------
CHARA_R = ["Human","??","??","??","??","??","??","??"]
#--------------------------------------------------------------------------
# This is the character's blood type by default
#--------------------------------------------------------------------------
CHARA_B = ["O","??","??","??","??","??","??","??"]
#--------------------------------------------------------------------------
# This is the character's specialty by default
#--------------------------------------------------------------------------
CHARA_S =  ["Axes","??","??","??","??","??","??","??"]
#--------------------------------------------------------------------------
# This is the character's gender by default
#--------------------------------------------------------------------------
CHARA_G = ["Male","??","??","??","??","??","??","??"]

#--------------------------------------------------------------------------
# This is where you add a few lines to briefly describe your character.
# Again, it follows character position in database.
# L1, L2, L3, L4, L5, L6, and L7 display text on lines 1, 2, 3, 4, 5, 6 and 7 respectively.
# To add another, copy and paste the L1-L7 lines and L_SET# = ....
# then change L_SET# to the hero u want. ex: L_SET9 (for hero 9)
#--------------------------------------------------------------------------
# Hero 1 description
L1 = "Insert first line of description here"               # Line 1 of description
L2 = "Insert second line of description here"               # Line 2 of description
L3 = "Insert third line of description here"               # Line 3 of description
L4 = "Insert fourth line of description here"             #4th added line of description
L5 = "Insert fifth line of description here"                #5th added line of description
L6 = "Insert sixth line of description here"                #6th added line of description
L7 = "Insert SEVENTH line of description here"         #7th added line of description
L_SET1 = [L1, L2, L3, L4, L5, L6, L7]  # This groups together the lines and displays them
# Hero 2 description
L1 = "Insert the first line of your description here"               # Line 1 of description
L2 = ""               # Line 2 of description
L3 = ""               # Line 3 of description
L4 = ""
L5 = ""
L6 = "Insert sixth line of description here"
L7 = "Insert SEVENTH line of description here"
L_SET2 = [L1, L2, L3, L4, L5, L6, L7]  # This groups together the lines and displays them
# Hero 3 description
L1 = "Insert the first line of your description here"               # Line 1 of description
L2 = ""               # Line 2 of description
L3 = ""               # Line 3 of description
L4 = ""
L5 = ""
L6 = "Insert sixth line of description here"
L7 = "Insert SEVENTH line of description here"
L_SET3 = [L1, L2, L3, L4, L5, L6, L7]  # This groups together the lines and displays them
# Hero 4 description
L1 = "Insert the first line of your description here"               # Line 1 of description
L2 = ""               # Line 2 of description
L3 = ""               # Line 3 of description
L4 = ""
L5 = ""
L6 = "Insert sixth line of description here"
L7 = "Insert SEVENTH line of description here"
L_SET4 = [L1, L2, L3, L4, L5, L6, L7]  # This groups together the lines and displays them
# Hero 5 description
L1 = "Insert the first line of your description here"               # Line 1 of description
L2 = ""               # Line 2 of description
L3 = ""               # Line 3 of description
L4 = ""
L5 = ""
L6 = "Insert sixth line of description here"
L7 = "Insert SEVENTH line of description here"
L_SET5 = [L1, L2, L3, L4, L5, L6, L7]  # This groups together the lines and displays them
# Hero 6 description
L1 = "Insert the first line of your description here"               # Line 1 of description
L2 = ""               # Line 2 of description
L3 = ""               # Line 3 of description
L4 = ""
L5 = ""
L6 = "Insert sixth line of description here"
L7 = "Insert SEVENTH line of description here"
L_SET6 = [L1, L2, L3, L4, L5, L6, L7]  # This groups together the lines and displays them
# Hero 7 description
L1 = "Insert the first line of your description here"               # Line 1 of description
L2 = ""               # Line 2 of description
L3 = ""               # Line 3 of description
L4 = ""
L5 = ""
L6 = "Insert sixth line of description here"
L7 = "Insert SEVENTH line of description here"
L_SET7 = [L1, L2, L3, L4, L5, L6, L7]  # This groups together the lines and displays them
# Hero 8 description
L1 = "Insert the first line of your description here"               # Line 1 of description
L2 = ""               # Line 2 of description
L3 = ""               # Line 3 of description
L4 = ""
L5 = ""
L6 = "Insert sixth line of description here"
L7 = "Insert SEVENTH line of description here"
L_SET8 = [L1, L2, L3, L4, L5, L6, L7]  # This groups together the lines and displays them
# This sets the variable CHARA_INFO to the different sets for each character
CHARA_INFO = [L_SET1,L_SET2,L_SET3,L_SET4,L_SET5,L_SET6,L_SET7,L_SET8]
# change if you add more characters. ex: [...L_SET9]

#----------------------------------------------------------------------------
#  END
#----------------------------------------------------------------------------

#==============================================================
#  Window_Charactor
#==============================================================

class Window_Charactor < Window_Base

def initialize(actor)
   super(0, 0, 640, 480)
   self.contents = Bitmap.new(width - 32, height - 32)
      self.contents.font.name = $fontface
   self.contents.font.size = $fontsize
   @actor = actor
   refresh
end

def refresh
   self.contents.clear
   draw_battler_graphics(@actor, 140, 225) # Draws the battler on screen
   self.contents.font.color.set(250, 0, 0) # Color for the following text. Set in (Red, Green, Blue)
   # Draws text. Change words in " " to whatever you want
   self.contents.draw_text(250, 10, 80, 32, "Name:")
   self.contents.draw_text(250, 50, 80, 32, "Age:")
   self.contents.draw_text(250, 90, 80, 32, "From:")
   self.contents.draw_text(250, 130, 80, 32, "Height:")
   self.contents.draw_text(250, 170, 80, 32, "Weight:")
   self.contents.draw_text(250, 210, 80, 32, "Race:")
   self.contents.draw_text(420, 50, 90, 32, "Blood Type:")
   self.contents.draw_text(420, 130, 100, 32, "Specialty:")
   self.contents.draw_text(420, 170, 100, 32, "Gender:")
   self.contents.font.color = normal_color # Sets text to normal color
   draw_actor_class(@actor, 520, 10)
   draw_actor_name(@actor, 340, 10)
   # Writes the variables you set earlier
   draw_actor_age(@actor, 340, 50)
   draw_actor_from(@actor, 340, 90)
   draw_actor_height(@actor, 340, 130)   
   draw_actor_weight(@actor, 340, 170)
   draw_actor_race(@actor, 340, 210)
   draw_actor_bloodtype(@actor, 520, 50)
   draw_actor_specialty(@actor, 520, 130)
   draw_actor_gender(@actor, 520, 170)
   draw_actor_other(@actor, 50, 250)
end
end

class Window_Base < Window
#--------------------------------------------------------------------------
# Draws the character picture
#--------------------------------------------------------------------------
def draw_battler_graphics(actor, x, y)
   battler=RPG::Cache.battler(actor.battler_name, actor.battler_hue) # Sets the battler graphic to be drawn
   w = battler.width
   h = battler.height
   self.contents.blt(x-w/2, y-h, battler, Rect.new(0, 0, w,h))
end

#--------------------------------------------------------------------------
# Draws the character's age
#--------------------------------------------------------------------------
def draw_actor_age(actor, x, y)
   self.contents.draw_text(x, y, 80, 32, CHARA_AGE[actor.id-1])
end

#--------------------------------------------------------------------------
# Draws the character's "From" attribute
#--------------------------------------------------------------------------
def draw_actor_from(actor, x, y)
   self.contents.draw_text(x, y, 280, 32, CHARA_FROM[actor.id-1])
end

#--------------------------------------------------------------------------
# Draws the character's "Height"
#--------------------------------------------------------------------------
def draw_actor_height(actor, x, y)
   self.contents.draw_text(x, y , 80, 32, CHARA_H[actor.id-1])
end

#--------------------------------------------------------------------------
# Draws the character's weight
#--------------------------------------------------------------------------
def draw_actor_weight(actor, x, y)
   self.contents.draw_text(x, y, 80, 32, CHARA_W[actor.id-1])
end

  #--------------------------------------------------------------------------
# Draws the character's race
#--------------------------------------------------------------------------
def draw_actor_race(actor, x, y)
   self.contents.draw_text(x, y, 280, 32, CHARA_R[actor.id-1])
end

   #--------------------------------------------------------------------------
# Draws the character's blood type
#--------------------------------------------------------------------------
def draw_actor_bloodtype(actor, x, y)
   self.contents.draw_text(x, y, 100, 32, CHARA_B[actor.id-1])
end

#--------------------------------------------------------------------------
# Draws the character's specialty
#--------------------------------------------------------------------------
def draw_actor_specialty(actor, x, y)
   self.contents.draw_text(x, y, 100, 32, CHARA_S[actor.id-1])
end

#--------------------------------------------------------------------------
# Draws the character's gender
#--------------------------------------------------------------------------
def draw_actor_gender(actor, x, y)
   self.contents.draw_text(x, y, 100, 32, CHARA_G[actor.id-1])
end

#--------------------------------------------------------------------------
# Draws the character's description - line numbers start from 0
#--------------------------------------------------------------------------
def draw_actor_other(actor, x, y)
   info = CHARA_INFO[actor.id-1]
   self.contents.draw_text(x, y, 600, 32, info[0])
   self.contents.draw_text(x, y+28, 600, 32, info[1])
   self.contents.draw_text(x, y+56, 600, 32, info[2])
   self.contents.draw_text(x, y+84, 600, 32, info[3])
   self.contents.draw_text(x, y+112, 600, 32, info[4])
   self.contents.draw_text(x, y+140, 600, 32, info[5])
   self.contents.draw_text(x, y+168, 600, 32, info[6])
end
end


#=============================================================
#  Scene_Charactor
#=============================================================

class Scene_Charactor

def initialize(actor_index = 0, equip_index = 0)
   @actor_index = actor_index
end

def main
   @actor = $game_party.actors[@actor_index]
   @status_window = Window_Charactor.new(@actor)
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   Graphics.freeze
   @status_window.dispose
end
#--------------------------------------------------------------------------
# Checks for buttons pressed; if "R" is pressed it goes onto the next character
#--------------------------------------------------------------------------
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_Charactor.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_Charactor.new(@actor_index)
     return
   end
end
end

#To not call from Status Window Delete the following lines (until STOP):
#===============================================================
#  Scene_Status
#===============================================================

class Scene_Status
#--------------------------------------------------------------------------
# This applies to the existing status window, and opens the bios if the decision key's pressed
#--------------------------------------------------------------------------
alias update_chara update
def update
   if Input.trigger?(CHENGE_KEY)
     $game_system.se_play($data_system.decision_se)
     $scene = Scene_Charactor.new(@actor_index)
     return
   end
   update_chara
end
end
# STOP

=begin   FAQ

1) It wont work with my CBS! Wtf!? How do I fix this?

If you're using a CBS like Cybersam's, ccoa's or Advocate's, you'll need to change this line:

battler=RPG::Cache.battler(actor.battler_name, actor.battler_hue)

to this:

battler=RPG::Cache.battler("Battlecharacters/" + actor.name, actor.character_hue)

then make a directory in your battlers folder, call it Battlecharacters and call your graphics by your character name.
(Thanks to Diego for this fix!)

FONT FIX:
Getting this error?

'Charas Bios' 107 Type Error

no implicit conversion from nil to integer

Go into main just under begin, and make sure you've got this layout:


$fontface = $fonttype = $defaultfontface = $defaultfonttype = "[chosen font]"   
$fontsize = $defaultfontsize = [chosen size]

Without the brackets, of course :P
That should fix it

ADDING YOUR OWN STUFF!!
1) Seven is just not enough! How do I add more?
(Whew...think if it was still three...)

Well first you will have to add these for every character. So for line 8 you go to Hero 1 Description
and add after L7 = "blah blah"
L8 = "Blah blah"   

then you would have to set this in the group. this line for every character's desc.:

L_SET1 = [L1, L2, L3, L4, L5, L6, L7]

you need to add an L8 to so itd be:   L_SET1 = [L1, L2, L3, L4, L5, L6, L7, L8]
(and of course L_SET1 varies for every hero)

Now you need to go where it DISPLAYS this info. which is these lines:

  info = CHARA_INFO[actor.id-1]
   self.contents.draw_text(x, y, 600, 32, info[0])
   self.contents.draw_text(x, y+28, 600, 32, info[1])
   self.contents.draw_text(x, y+56, 600, 32, info[2])
   self.contents.draw_text(x, y+84, 600, 32, info[3])
   self.contents.draw_text(x, y+112, 600, 32, info[4])
   self.contents.draw_text(x, y+140, 600, 32, info[5])
   self.contents.draw_text(x, y+168, 600, 32, info[6])
   
   so you add after those:  self.contents.draw_text(x, y+168, 600, 32, info[7])
   
   Well, you cant just do that. You will need to move the font around. Just change the y+# values.
   Be sure to go in even intervals. You will notice I went by 28. (28,56,84,112, etc.)
=end
[/spoiler]

Screenshot

(I don't know why he's named scorpion...:p )

Demo
Do you really need a demo? Really?

Compatibility
Compatible with SDK. Its just a window, shouldn't cause any errors with any other script, but if it does say so here.

Post any questions/suggestions here! Please note the FAQ I have put at the bottom of the script for people that cant see the font!