Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # ** Biography
- # Version: 1.0
- # Author: VianoceGames
- # Date: February , 2015
- #-------------------------------------------------------------------------------
- # Description:
- # This scene creates a new window command in the main menu. This new command
- # opens a scene that displays detailed information about each character the
- # players of your game encouter through out the story. You can have it so
- # only playable characters are found in the biography or any NPCs you deam
- # worthy of their own biography. The choice is up to you.
- #
- #-------------------------------------------------------------------------------
- # Instruction:
- # Scroll down to the bottom and edit the character array with the information
- # about each character you want display in the biography when the game starts.
- # You can add more characters in a script call during events. The method of
- # doing so is as follows.
- #
- # By default there are two characters so adding nth = 2, then 3 when you add
- # a 4th character and so on.
- #
- # In a script call write:
- # $game_system.biography_chararray[nth] = Array.new
- # $game_system.biography_chararray[nth][0] = "Name"
- # $game_system.biography_chararray[nth][1] = number <~~ this must number no quotation marks
- # $game_system.biography_chararray[nth][2] = "Date of birth" My games have a time system from secs to years.
- # $game_system.biography_chararray[nth][3] = "Place of birth"
- # $game_system.biography_chararray[nth][4] = "height" ie: "5'3''"
- # $game_system.biography_chararray[nth][5] = "class/job/role"
- # $game_system.biography_chararray[nth][6] = "Mortality" or whatever you want here.
- # $game_system.biography_chararray[nth][7] = "Name of picture in picture folder"
- # $game_system.biography_chararray[nth][8] = "Name of picture in picture folder"
- # In a future version background will
- # be changable per character.
- # $game_system.biography_chararray[nth][9] = "Information about the character relavent
- # to the progress in the story."
- #
- # Notes: Changing any information for any character you just use the desired
- # line above replacing nth with the number for the desired character in
- # the array. It would be wise to keep notes for quick reference.
- #
- # Character picture images file dimentions are 272 x 288.
- #
- #-------------------------------------------------------------------------------
- # Thanks:
- # I would like to give thanks to Pacman for helping me with this script. You
- # were a huge help.
- #
- #===============================================================================
- class Scene_Biography < Scene_Base
- #-----------------------------------------------------------------------------
- # * Start Processing
- #-----------------------------------------------------------------------------
- def start
- super()
- @char_index_array = 0
- #------------------------------------------------------------------------
- # Background Image
- #------------------------------------------------------------------------
- @background_sprite = Sprite.new()
- @background_sprite.bitmap = Cache.picture("CrossedSwords")#background_image)
- @background_sprite.x = 0
- @background_sprite.y = 0
- @background_sprite.z = 0
- @background_sprite.zoom_x = Graphics.width.to_f / @background_sprite.bitmap.width
- @background_sprite.zoom_y = Graphics.height.to_f / @background_sprite.bitmap.height
- @background_sprite.opacity = 255
- @background_sprite.visible = true
- #------------------------------------------------------------------------
- #------------------------------------------------------------------------
- # Windows
- #------------------------------------------------------------------------
- @window_biography_name = Window_Biography_Name.new()
- @window_biography_image = Window_Biography_image.new()
- @window_biography_bios = Window_Biography_Bios.new()
- @window_biography_cgs = Window_Biography_CGS.new()
- #------------------------------------------------------------------------
- end
- #--------------------------------------------------------------------------
- # * Post-Start Processing
- #--------------------------------------------------------------------------
- def post_start
- super()
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super()
- return_scene() if Input.trigger?(:B)
- cancel_se() if Input.trigger?(:B)
- scroll_right() if Input.trigger?(:RIGHT)
- scroll_left() if Input.trigger?(:LEFT)
- end
- end
- def cancel_se
- cancel_sound = "Cancel2"
- RPG::SE.new(cancel_sound, 70, 100).play
- end
- def scroll_right
- scroll_se = "Decision3"
- RPG::SE::new(scroll_se, 70, 100).play
- return unless $game_system.char_index_array < $game_system.biography_chararray.size - 1
- $game_system.char_index_array += 1
- @window_biography_name.refresh
- @window_biography_image.refresh
- @window_biography_bios.refresh
- @window_biography_cgs.refresh
- end
- def scroll_left
- scroll_se = "Decision3"
- RPG::SE::new(scroll_se, 70, 100).play
- return unless $game_system.char_index_array > 0
- $game_system.char_index_array -= 1
- @window_biography_name.refresh
- @window_biography_image.refresh
- @window_biography_bios.refresh
- @window_biography_cgs.refresh
- end
- #--------------------------------------------------------------------------
- # * Pre-Termination Processing
- #--------------------------------------------------------------------------
- def pre_terminate
- @character_sprite.dispose()
- @character_sprite.bitmap.dispose()
- @background_sprite.dispose()
- @background_sprite.bitmap.dispose()
- end
- #--------------------------------------------------------------------------
- # * Termination Processing
- #--------------------------------------------------------------------------
- def terminate
- super()
- @window_biography_name.dispose()
- @window_biography_image.dispose()
- @window_biography_bios.dispose()
- @window_biography_cgs.dispose()
- end
- #==============================================================================
- # ** Window_MenuCommand
- #------------------------------------------------------------------------------
- # This command window appears on the menu screen.
- #==============================================================================
- class Window_MenuCommand < Window_Command
- #--------------------------------------------------------------------------
- # * For Adding Original Commands
- #--------------------------------------------------------------------------
- alias vg14_custscene_winmencmmd_addorigcmmd_74yrth add_original_commands
- #--------------------------------------------------------------------------
- def add_original_commands
- vg14_custscene_winmencmmd_addorigcmmd_74yrth() # Call original method
- add_command("Biography", :biography_scene, true)
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs the menu screen processing.
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- alias vg14_custscene_scenemenu_createcmmdwindow_74yrth create_command_window
- #--------------------------------------------------------------------------
- def create_command_window
- vg14_custscene_scenemenu_createcmmdwindow_74yrth() # Call original method
- @command_window.set_handler(:biography_scene, method(:command_scenebiography))
- end
- def command_scenebiography
- SceneManager.call(Scene_Biography)
- end
- end
- #==============================================================================
- # ** Window_Biography_Name
- #------------------------------------------------------------------------------
- # This message window is used to display text
- #==============================================================================
- class Window_Biography_Name < Window_Base
- def initialize()
- super(0, 0, (Graphics.width * 0.5) , (Graphics.height * 0.13))
- draw_name()
- end
- def draw_name()
- text = $game_system.biography_chararray[$game_system.char_index_array][0]
- draw_text_ex(0, 0, text)
- end
- def refresh()
- contents.clear
- draw_name()
- end
- end
- #==============================================================================
- # ** Window_Biography_image.
- #------------------------------------------------------------------------------
- # This message window is used to display text for the quest Desription.
- #==============================================================================
- class Window_Biography_image < Window_Base
- def initialize()
- super((Graphics.width * 0.05), (Graphics.height * 0.2), (Graphics.width * 0.4), (Graphics.height * 0.4))
- draw_image()
- end
- def draw_image
- #------------------------------------------------------------------------
- # Character Image
- #------------------------------------------------------------------------
- @character_sprite = Sprite.new()
- @character_sprite.bitmap = Cache.picture($game_system.biography_chararray[$game_system.char_index_array][7])#background_image)
- @character_sprite.x = 63
- @character_sprite.y = 88
- @character_sprite.z = 150
- @character_sprite.zoom_x = 272.0 * 0.54 / @character_sprite.bitmap.width
- @character_sprite.zoom_y = 288.0 * 0.54 / @character_sprite.bitmap.height
- @character_sprite.opacity = 255
- @character_sprite.visible = true
- #------------------------------------------------------------------------
- end
- def refresh()
- @character_sprite.dispose()
- @character_sprite.bitmap.dispose()
- draw_image()
- end
- end
- #==============================================================================
- # ** Window_Biography_Bios
- #------------------------------------------------------------------------------
- # This message window is used to display text
- #==============================================================================
- class Window_Biography_Bios < Window_Base
- def initialize()
- super((Graphics.width * 0.5), 0, (Graphics.width * 0.5), (Graphics.height * 0.7))
- draw_age() # Character's age
- draw_dob() # Character's date of birth
- draw_bp() # Character's place of birth
- draw_ht() # Character's height
- draw_clss() # Character's class
- draw_mort() # Character's mortality. You can edit this to be aleigence
- # or something if you wish. Just edit the method below to
- # display the desired lable (ie: "Mortality: ")
- end
- def draw_age()
- text = "Age: " + $game_system.biography_chararray[$game_system.char_index_array][1].to_s
- draw_text_ex(5, 6, text)
- end
- def draw_dob()
- text = "DOB: " + $game_system.biography_chararray[$game_system.char_index_array][2]
- draw_text_ex(5, 39, text)
- end
- def draw_bp()
- text = "Birthplace: " + $game_system.biography_chararray[$game_system.char_index_array][3]
- draw_text_ex(5, 78, text)
- end
- def draw_ht()
- text = "Height: " + $game_system.biography_chararray[$game_system.char_index_array][4]
- draw_text_ex( 5, 117, text)
- end
- def draw_clss()
- text = "Class: " + $game_system.biography_chararray[$game_system.char_index_array][5]
- draw_text_ex( 5, 156, text)
- end
- def draw_mort()
- text = "Mortality: " + $game_system.biography_chararray[$game_system.char_index_array][6]
- draw_text_ex( 5, 195, text)
- end
- def refresh()
- contents.clear
- draw_age()
- draw_dob()
- draw_bp()
- draw_ht()
- draw_clss()
- draw_mort()
- end
- end
- #==============================================================================
- # ** Window_Biography_CGS
- #------------------------------------------------------------------------------
- # This message window is used to display text
- #==============================================================================
- class Window_Biography_CGS < Window_Base
- def initialize()
- super(0, (Graphics.height * 0.7), Graphics.width, (Graphics.height * 0.3))
- draw_cgs()
- end
- def draw_cgs()
- text = "Character Growth: \n" + $game_system.biography_chararray[$game_system.char_index_array][9]
- draw_text_ex( 0, 0, text)
- end
- def refresh()
- contents.clear
- draw_cgs()
- end
- end
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system data. It saves the disable state of saving and
- # menus. Instances of this class are referenced by $game_system.
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :biography_chararray
- attr_accessor :char_index_array
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- alias vg14_gamesystem_biography_initialize_435r initialize
- #--------------------------------------------------------------------------
- def initialize
- vg14_gamesystem_biography_initialize_435r() # Call original method
- @char_index_array = 0 # Gives variable value other than nil
- #===========================================================================
- # Character Database Array
- #---------------------------------------------------------------------------
- @biography_chararray = [ # Don't touch this line
- #---------------------------------------------------------------------------
- # Editable Region
- #---------------------------------------------------------------------------
- # Name:0 Age:1 DOB:2 Birthplace:3 Height:4 Class:5 Mortality:6 CharImage:7 Background:8 CGS:9
- ["Ernesto", 2472, "Mon Day, Year", "Mt. Colib", "5'9''", "SpellBlade", "Immortal", "Actor4-5", "CrossedSwords", "Growth Description"],
- ["Benedict", 8473, "Mon Day, Year", "Unknown", "6'1''", "Vampire", "Immortal", "Benedict", "", ""],
- #---------------------------------------------------------------------------
- ]# End of Character Database Array \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
- #===========================================================================
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement