Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> Scene_Biography
Bigace
post Dec 8 2011, 02:07 PM
Post #1


The King of Spades
Group Icon

Group: Revolutionary
Posts: 400
Type: Developer
RM Skill: Intermediate




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.

--------------------------------------------------------------------------------
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



--------------------------------------------------------------------------------
Demo
Not need

script
CODE
###############################################################################
#                              CUSTOM Biography SCENE                         #
###############################################################################
# ** ACE Biography v1.0 **                                                    #
#    Author: Bigace360                                                        #
#    Date: Dec. 7, 2011                                                       #
###############################################################################
# To call the Biography Menu
# $scene = Scene_Biography.new(@status_window.index)
#------------------------------------------------------------------------------
#  v1.0 Dec. 7, 2011
#   ~ Initial Release
#
#   ~Classes~
# ** Module ACE
# ** Window_Base
# ** Window_Biography
# ** Window_Face
# ** Scene_Biography
###############################################################################
# ** ACE Module                                                                                          #
###############################################################################
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 size, Font Type, Actor Bio window X, Y]
    ACTOR       = [16, 'Verdana', 0, 0]
    #                  [History X, History Y, Biography X, Biography Y]
    BIO                    = [0, 120, 220, -180]
    #-----------------------------------------------------------------
    # DO NOT TOUCH THIS LINE
    constants = ["LAST_NAMES", "AGE", "GENDER", "RACE", "HEIGHT", "WEAPON", "FROM",
    "SPECIALTY", "HISTORY", "BIOGRAPHY"]
    for i in 0...constants.size
        eval(constants[i] + " = []")
    end
    # DO NOT TOUCH THIS LINE
    #-----------------------------
    # Configure Each actor's last name below.
    # SYNTAX:
    # LAST_NAMES[actor_id] = "Last Name"
    # actor_id being the actor's ID in the database
    # "Last Name" being the last name you wish to give the actor.
    # Note: You can set a default last name if you'd like, by setting
    #  the actor ID to 0 ( LAST_NAMES[0] = "" ). This goes the same for all the
    # other settings as well (ex. age, gender, race, etc...)
    # Default Settings
    LAST_NAMES[0] = ""
    AGE[0]        = ""
    GENDER[0]     = ""
    RACE[0]       = ""
    HEIGHT[0]     = ""
    WEAPON[0]     = ""
    FROM[0]       = ""
    SPECIALTY[0]  = ""
    HISTORY[0]    = ""
    BIOGRAPHY[0]  = ""
    # Actor Settings
    LAST_NAMES[1] = "Smith"
    LAST_NAMES[2] = "Doe"
    LAST_NAMES[3] = "Ray"
    LAST_NAMES[4] = "Griffen"
    LAST_NAMES[5] = "Green"
    LAST_NAMES[6] = "Clarke"
    LAST_NAMES[7] = "Clarke"
    LAST_NAMES[8] = "May"
    AGE[1] = "19"
    AGE[2] = "25"
    AGE[3] = "21"
    AGE[4] = "19"
    AGE[5] = "16"
    AGE[6] = "20"
    AGE[7] = "18"
    AGE[8] = "16"
    GENDER[1] = "Male"
    GENDER[2] = "Male"
    GENDER[3] = "Male"
    GENDER[4] = "Female"
    GENDER[5] = "Female"
    GENDER[6] = "Male"
    GENDER[7] = "Female"
    GENDER[8] = "Female"
    RACE[1] = "Human"
    RACE[2] = "Human"
    RACE[3] = "Human"
    RACE[4] = "Human"
    RACE[5] = "Elf"
    RACE[6] = "Human"
    RACE[7] = "Human"
    RACE[8] = "Human"
    HEIGHT[1] = "5'8"
    HEIGHT[2] = "5'9"
    HEIGHT[3] = "6'"
    HEIGHT[4] = "5'7"
    HEIGHT[5] = "5'7"
    HEIGHT[6] = "5'8"
    HEIGHT[7] = "5'7"
    HEIGHT[8] = "5'4"
    WEAPON[1] = "Swords"
    WEAPON[2] = "Spears"
    WEAPON[3] = "Axes"
    WEAPON[4] = "Knives"
    WEAPON[5] = "Great Bows"
    WEAPON[6] = "Guns"
    WEAPON[7] = "Wands"
    WEAPON[8] = "Staffs"
    FROM[1] = "England"
    FROM[2] = "America"
    FROM[3] = "New Zealand"
    FROM[4] = "Canada"
    FROM[5] = "Ireland"
    FROM[6] = "France"
    FROM[7] = "Germany"
    FROM[8] = "Berlin"
    SPECIALTY[1] = "Swordplay"
    SPECIALTY[2] = "Lanceplay"
    SPECIALTY[3] = "Axeplay"
    SPECIALTY[4] = "Robbery"
    SPECIALTY[5] = "Archery"
    SPECIALTY[6] = "Gunnery"
    SPECIALTY[7] = "White magic"
    SPECIALTY[8] = "Black Magic"
    
    #¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    # Actor DESCRIPTION CONFIG
    #¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    # HISTORY[ID] = ['This is an actors history description',
    #                'Text in different lines must be separated',
    #                'by comas']
    #
    # BIOGRAPHY[ID] = ['This is an actors biography description',
    #                     'Text in different lines must be separated',
    #                     'by comas']
    #
    HISTORY[1] = ['This is an actors history description text in different lines must be separated by comas']
    
    HISTORY[2] = ['This is an actors history description text in different lines must be separated by comas']
    
    HISTORY[3] = ['This is an actors history description text in different lines must be separated by comas']
    
    HISTORY[4] = ['This is an actors history description text in different lines must be separated by comas']
    
    HISTORY[5] = ['This is an actors history description text in different lines must be separated by comas']
    
    HISTORY[6] = ['This is an actors history description text in different lines must be separated by comas']
    
    HISTORY[7] = ['This is an actors history description text in different lines must be separated by comas']
    
    HISTORY[8] = ['This is an actors history description text in different lines must be separated by comas']
    
    #---------------------------Biography------------------------------
    
    BIOGRAPHY[1] = ['This is an actors biography description text in different',
    'lines must be separated by comas']
    
    BIOGRAPHY[2] = ['This is an actors biography description text in different',
    'lines must be separated by comas']
    
    BIOGRAPHY[3] = ['This is an actors biography description text in different',
    'lines must be separated by comas']
    
    BIOGRAPHY[4] = ['This is an actors biography description text in different',
    'lines must be separated by comas']
    
    BIOGRAPHY[5] = ['This is an actors biography description text in different',
    'lines must be separated by comas']
    
    BIOGRAPHY[6] = ['This is an actors biography description text in different',
    'lines must be separated by comas']
    
    BIOGRAPHY[7] = ['This is an actors biography description text in different',
    'lines must be separated by comas']
    
    BIOGRAPHY[8] = ['This is an actors biography description text in different',
    'lines must be separated by comas']
###############################################################################
end #Customization Ends
###############################################################################
#=============================================================================#
$acescript = {} if $acescript == nil                                                              #
$acescript["Biography"] = true                                                                        #
###############################################################################

#==============================================================================
# ** Window_Base
#==============================================================================
class Window_Base
    include ACE
    def color_black; return Color.new(0, 0, 0, 255); end
    def draw_text_outline(x, y, width, height, string, alignment = 0)
        self.contents.font.color = color_black
        self.contents.draw_text(x - 1, y - 1, width, height, string, alignment)
        self.contents.draw_text(x + 1, y - 1, width, height, string, alignment)
        self.contents.draw_text(x + 1, y + 1, width, height, string, alignment)
        self.contents.draw_text(x - 1, y + 1, width, height, string, alignment)
    end
    def biog_color; return Color.new(0, 255, 160); end
    def draw_actor_class_bio(actor, x, y)
        draw_text_outline(x, y, 236, 32, "Class: " + actor.class_name)
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y, 236, 32, "Class: " + actor.class_name)
    end
    def draw_actor_name_full(actor, x, y)
        name = actor.name
        last = LAST_NAMES[actor.id] || LAST_NAMES[0]
        draw_text_outline(x, y, 320, 32, "Name: " + name + " " + last)
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y, 320, 32, "Name: " + name + " " + last)
    end
    def draw_actor_age(actor, x, y)
        age = AGE[actor.id] || AGE[0]
        draw_text_outline(x, y, 320, 32, "Age: " + age)
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y, 320, 32, "Age: " + age)
    end
    def draw_actor_gender(actor, x, y)
        gender = GENDER[actor.id] || GENDER[0]
        draw_text_outline(x, y, 320, 32, "Gender: " + gender)
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y, 320, 32, "Gender: " + gender)
    end
    def draw_actor_race(actor, x, y)
        race = RACE[actor.id] || RACE[0]
        draw_text_outline(x, y, 320, 32, "Race: " + race)
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y, 320, 32, "Race: " + race)
    end
    def draw_actor_height(actor, x, y)
        height = HEIGHT[actor.id] || HEIGHT[0]
        draw_text_outline(x, y, 320, 32, "Height: " + height)
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y, 320, 32, "Height: " + height)
    end
    def draw_actor_weapons(actor, x, y)
        weapons = WEAPON[actor.id] || WEAPON[0]
        draw_text_outline(x, y, 320, 32, "Weapons: " + weapons)
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y, 320, 32, "Weapons: " + weapons)
    end
    def draw_actor_from(actor, x, y)
        from = FROM[actor.id] || FROM[0]
        draw_text_outline(x, y, 320, 32, "From: " + from)
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y, 320, 32, "From: " + from)
    end
    def draw_actor_specialty(actor, x, y)
        specialty = SPECIALTY[actor.id] || SPECIALTY[0]
        draw_text_outline(x, y, 320, 32, "Specialty: " + specialty)
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y, 320, 32, "Specialty: " + specialty)
    end
    def draw_actor_history(actor, x, y)
        info = (HISTORY[actor.id] || HISTORY[0]).to_a
        name = actor.name
        height = self.contents.height
        draw_text_outline(x, 190 + BIO[1], 320, 32, name + " " + "'s History: ")
        self.contents.font.color = normal_color
        self.contents.draw_text(x, 190 + BIO[1], 320, 32, name + " " + "'s History: ")
        for i in 0...info.size
            text = info[i]
            draw_text_outline(x, i * 32 + BIO[1], self.contents.width, height, text)
            self.contents.font.color = normal_color
            self.contents.draw_text(x, i * 32 + BIO[1], self.contents.width, height, text)
        end
    end
    def draw_actor_biography(actor, x, y)
        info = (BIOGRAPHY[actor.id] || BIOGRAPHY[0]).to_a
        name = actor.name
        height = self.contents.height
        draw_text_outline(x, y + 190, 320, 32, name + " " + "'s Biography: ")
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y + 190, 320, 32, name + " " + "'s Biography: ")        
        for i in 0...info.size
            text = info[i]
            draw_text_outline(x, i * 32 + y, self.contents.width, height, text)
            self.contents.font.color = normal_color
            self.contents.draw_text(x, i * 32 + y, self.contents.width, height, text)
        end
    end
    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
        src_rect = Rect.new(0, 0, cw, ch)
        if face == RPG::Cache.battler(actor.battler_name, actor.battler_hue)
            self.contents.blt(x + 40 , y - ch - 240, face, src_rect)
        else
            self.contents.blt(x , y - ch, face, src_rect)
        end
    end
end

#==============================================================================
# ** Window_Biography
#==============================================================================
class Window_Biography < Window_Base
    include ACE
    def initialize(actor)
        super(0, 0, 640, 480)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name, self.contents.font.size = ACTOR[1], ACTOR[0]
        @actor, self.opacity = actor, 255
        refresh
    end
    def refresh
        x2, y2 = ACTOR[2], ACTOR[3]
        draw_actor_name_full(@actor, x2, y2)
        draw_actor_class_bio(@actor, x2, y2 + 32)
        draw_actor_age(@actor, x2, y2 + 64)
        draw_actor_gender(@actor, x2, y2 + 96)
        draw_actor_race(@actor, x2, y2 + 128)
        draw_actor_height(@actor, x2, y2 + 160)
        draw_actor_weapons(@actor, x2, y2 + 192)
        draw_actor_from(@actor, x2, y2 + 224)
        draw_actor_specialty(@actor, x2, y2 + 256)
        draw_actor_history(@actor, BIO[0], y)
        draw_actor_biography(@actor, BIO[2], BIO[3])
    end
end

#==============================================================================
# ** Window_Face
#==============================================================================
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

#==============================================================================
# ** Scene_Biography
#==============================================================================
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 do
            Graphics.update
            Input.update
            update
            break if $scene != self
        end
        Graphics.freeze
        @biog_window.dispose
        @status_face.dispose
    end
    def update
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            $scene = Scene_Menu.new(3)
            return
        elsif Input.trigger?(Input::R)
            $game_system.se_play($data_system.cursor_se)
            @actor_index += 1
            @actor_index %= $game_party.actors.size
            $scene = Scene_Biography.new(@actor_index)
            return
        elsif 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_Biography.new(@actor_index)
            return
        end
    end
end


--------------------------------------------------------------------------------
Compatibility

No known issues.

--------------------------------------------------------------------------------
Credits and Thanks

•Bigace360, for the script
•Night_Runner, for helping figure out an error with the History/Bio paragraphs.

--------------------------------------------------------------------------------
Author's Notes

Enjoy!


__________________________



Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.

QUOTE ('Exiled One')
"If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others."
Go to the top of the page
 
+Quote Post
   
TheBen
post Dec 10 2011, 05:50 AM
Post #2


Intolerable Noob
Group Icon

Group: Revolutionary
Posts: 344
Type: Developer
RM Skill: Beginner




Hey! Looks pretty good, though customization is gonna be a bear. Two things, though...
Number 1
I think it would be best if you arranged the customization options for each actor so that attributes are actor-separated.
CODE
LAST_NAMES[1] = "Smith"
AGE[1] = "19"
GENDER[1] = "Male"
RACE[1] = "Human"
HEIGHT[1] = "5'8"
WEAPON[1] = "Swords"
FROM[1] = "England"
SPECIALTY = "Swordplay"

I can see how someone might get kind of confused, having to jump between sections in order to edit just one actor... but that's a pretty small complaint.

Number 2
You might want to use a different separator symbol than a comma. I'd use, say, the | button (shift - backslash, right of the right bracket key), or maybe the Enter key instead (for line in string; draw line of text; end).

It looks pretty good to me anyway. Keep it up!


__________________________
QUOTE
Great people talk about IDEAS
Average people talk about THINGS
Small people talk about OTHER PEOPLE

- A plaque on a BBQ restaurant in VA
Go to the top of the page
 
+Quote Post
   
Bigace
post Dec 10 2011, 11:21 AM
Post #3


The King of Spades
Group Icon

Group: Revolutionary
Posts: 400
Type: Developer
RM Skill: Intermediate




QUOTE (TheBen @ Dec 10 2011, 08:50 AM) *
Hey! Looks pretty good, though customization is gonna be a bear. Two things, though...
Number 1
I think it would be best if you arranged the customization options for each actor so that attributes are actor-separated.
CODE
LAST_NAMES[1] = "Smith"
AGE[1] = "19"
GENDER[1] = "Male"
RACE[1] = "Human"
HEIGHT[1] = "5'8"
WEAPON[1] = "Swords"
FROM[1] = "England"
SPECIALTY = "Swordplay"

I can see how someone might get kind of confused, having to jump between sections in order to edit just one actor... but that's a pretty small complaint.

Number 2
You might want to use a different separator symbol than a comma. I'd use, say, the | button (shift - backslash, right of the right bracket key), or maybe the Enter key instead (for line in string; draw line of text; end).

It looks pretty good to me anyway. Keep it up!


1) Not really going to fix that, if people need to rearrange it so they can see it better the cut and paste function is on there keyboard. Not to sound mean or anything.

2) what was wrong with the comma? the symbol that would cause most problems would be [ ' ] as if you tried doing this he's instead of he is you'll have a problem. But other wise nothing was really wrong. I'll look into it later.

Thanks though. cool.gif

This post has been edited by Bigace: Dec 10 2011, 11:22 AM


__________________________



Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.

QUOTE ('Exiled One')
"If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others."
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd May 2013 - 11:55 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker