The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: heisenman on April 22, 2011, 12:09:16 AM

Title: YEZ to YEM Status Biography
Post by: heisenman on April 22, 2011, 12:09:16 AM
YEZ to YEM Status Biography
Version: 1.0
Author: Yanfly for the original scripts, heisenman
Date: 4 22, 2011




Description


This is a patch that brings back the YEZ Biography command in YEM Status Menu Melody. The Biography window displays actors biographies or classes descriptions.

Features


Screenshots

Actor biography.

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg859.imageshack.us%2Fimg859%2F9318%2F13773607.png&hash=8b1a5d24cfeb1846f5dc2b92ea747a4e382d6255)


Class description.

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg193.imageshack.us%2Fimg193%2F8084%2F55447286.png&hash=6c2a0adaa017d3b3f150e9d4d28d969d0521493d)

Instructions

Place this script below ? Materials and YEM Status Menu Melody but above ? Main in the Script Editor.
Note that the COMMANDS array and the COMMAND_VOCAB hash are rewritten from YEM Status Menu Melody, so update them if needed.
It requires YEM Status Menu Melody to work.

Script


Code: [Select]
#===============================================================================
# ** YEZ to YEM Status Biography
#------------------------------------------------------------------------------
#  This script brings back the YEZ Biography command in the Scene_Status
# command window that displays actors biographies or classes descriptions.
#===============================================================================
# Instructions
#------------------------------------------------------------------------------
#  Place this script below ? Materials and YEM Status Menu Melody but above
# ? Main in the Script Editor.
#  Note that the COMMANDS array and the COMMAND_VOCAB hash are rewritten, so
# update them if needed.
#  It requires YEM Status Menu Melody to work.
#===============================================================================
# Disclaimers
#------------------------------------------------------------------------------
#  This script is entirely based on the YEZ Biography command, present in the
# original YEZ Status Command Menu, and YEM Status Menu Melody. Both scripts are
# property of Yanfly (pockethouse.com).
#===============================================================================

module YEM
  module STATUS
   
#===============================================================================
# Configuration starts here.
#===============================================================================
   
    # This array determines what items will appear in the status scene and
    # what order they appear in. Remove them if you wish for them to not appear.
    COMMANDS =[
      :general,    # Displays general actor information.
      :boosters,   # Displays the actor's parameters and item boosts.
      :elements,   # Displays the actor's elemental affinities.
      :states,     # Displays the actor's status effect resistances.
      :biography,  # A biography of the actor.
    ] # Do not remove this.
   
    # This hash determines how the vocabulary appears in your game. Modify them
    # as you see fit if you wish to rename certain aspects.
    COMMAND_VOCAB ={
      :general    => "General",
      :boosters   => "Boosters",
      :elements   => "Elements",
      :states     => "Ailments",
      :biography  => "Biography",
    } # Do not remove this.
   
    # Biography Mini Window. The following will allow you to adjust biographies
    # for actors and classes. If an actor does not have a personal biography,
    # then the description of the character's class will be displayed instead.
    BIOGRAPHY ={
      :actor_bio => "%s's Biography",
      :class_des => "%s Description",
    } # Do not remove this.
   
    # When typing out biographies and descriptions, use \\N[x] to write out
    # the actor's name if the game allows renaming. For line splits, use |
    # at the each position you would want the description to start a new line.
    ACTOR_BIOS ={ # If an actor ID is not listed here, then refer to class bio.
    # ID => Bio
       1 => '\\N[1] is a very hot blooded young male whom|' +
            'embarked on a journey to save Don Miguel.|' +
            'But given his reckless behaviour and actions,|' +
            '\\N[1] is known to give his team lots of trouble.',
       2 => '\\N[2] trained as a warrior since she was|' +
            'quite young. Due to her militant past, she has|' +
            'developed a rather tomboy-ish personality.|' +
            '\\N[2] loves training and is also a health nut.',
       3 => '\\N[3] is the overzealous priest of \\N[1]\'s|' +
            'party. His actions speak louder than his words|' +
            'and his words are already loud enough. \\N[3]|' +
            'is definitely one who choose the wrong class.',
       4 => '\\N[4] is the team\'s walking encyclopedia.|' +
            'She just about knows everything for each and|' +
            'every situation. But aside from that, \\N[4]|' +
            'just doesn\'t have the actual life experience.',
    } # Do not remove this.
   
    # Just like the actor biographies, use \\N[x] to write out a changeable
    # actor's name and \\V[x] to write out variables. Use | to enforce a
    # line break.
    CLASS_BIOS ={
    # ID => Bio
       1 => 'Knights are quick and powerful characters|' +
            'that excel in both melee and magic.',
       2 => 'Warriors are very dedicated to close ranged|' +
            'physical combat.',
       3 => 'Priests focus on healing and aiding their|' +
            "party members. Don't let \\N[3] fool you.",
       4 => 'Magicians excel in the magical arts and also|' +
            'excel at blasting their enemies to bits.',
    } # Do not remove this.
 
#===============================================================================
# Configuration ends here.
#===============================================================================
   
  end # STATUS
end # YEM

#===============================================================================
# Window_Status_Biography
#===============================================================================

class Window_Status_Biography < Window_Base
 
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 128, Graphics.width, Graphics.height - 128)
    @actor = actor
    refresh
  end
 
  #--------------------------------------------------------------------------
  # actor=
  #--------------------------------------------------------------------------
  def actor=(new_actor)
    @actor = new_actor
    refresh
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if YEM::STATUS::ACTOR_BIOS.include?(@actor.id)
      draw_actor_bio
    elsif YEM::STATUS::CLASS_BIOS.include?(@actor.class_id)
      draw_class_bio
    end
  end
 
  #--------------------------------------------------------------------------
  # draw_actor_bio
  #--------------------------------------------------------------------------
  def draw_actor_bio
    self.contents.font.color = normal_color; dy = 0
    text = sprintf(YEM::STATUS::BIOGRAPHY[:actor_bio], @actor.name)
    self.contents.draw_text(0, dy, self.width-32, WLH*2, text, 1)
    text = YEM::STATUS::ACTOR_BIOS[@actor.id]
    nwidth = 544
    dx = 18; dy = WLH*2
    text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
    lines = text.split(/(?:[|]|\\n)/i)
    lines.each_with_index { |l, i|
      l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
      self.contents.draw_text(dx, i * 24 + dy, nwidth, WLH, l, 0)}
  end
 
  #--------------------------------------------------------------------------
  # draw_class_bio
  #--------------------------------------------------------------------------
  def draw_class_bio
    self.contents.font.color = normal_color; dy = 0
    text = sprintf(YEM::STATUS::BIOGRAPHY[:class_des], @actor.class.name)
    self.contents.draw_text(0, dy, self.width-32, WLH*2, text, 1)
    text = YEM::STATUS::CLASS_BIOS[@actor.class.id]
    nwidth = 544
    dx = 18; dy = WLH*2
    text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
    lines = text.split(/(?:[|]|\\n)/i)
    lines.each_with_index { |l, i|
      l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
      self.contents.draw_text(dx, i * 24 + dy, nwidth, WLH, l, 0)}
  end
 
end # Window_Status_Biography

#===============================================================================
# Scene_Status
#===============================================================================

class Scene_Status < Scene_Base
 
  #--------------------------------------------------------------------------
  # new method: create_command_window
  #--------------------------------------------------------------------------
  def create_command_window
    @data = []
    commands = []
    @windows = []
    for command in YEM::STATUS::COMMANDS
      case command
      when :general
        @general_window = Window_Status_General.new(@actor)
        @windows.push(@general_window)
      when :boosters
        @boosters_window = Window_Status_Booster.new(@actor, @help_window)
        @boosters_stats = Window_Booster_Stats.new(@actor, @boosters_window)
        @windows.push(@boosters_window)
        @windows.push(@boosters_stats)
      when :elements
        next unless $imported["BattleEngineMelody"]
        @elements_window = Window_Status_Elements.new(@actor, @help_window)
        @elements_stats = Window_Elements_Stats.new(@actor, @elements_window)
        @windows.push(@elements_window)
        @windows.push(@elements_stats)
      when :states
        next unless $imported["BattleEngineMelody"]
        @states_window = Window_Status_States.new(@actor, @help_window)
        @states_stats = Window_States_Stats.new(@actor, @states_window)
        @windows.push(@states_window)
        @windows.push(@states_stats)
      when :biography
        @biography_window = Window_Status_Biography.new(@actor)
        @windows.push(@biography_window)
      else; next
      end
      @data.push(command)
      commands.push(YEM::STATUS::COMMAND_VOCAB[command])
    end
    @command_window = Window_Command_Centered.new(160, commands)
    @command_window.height = 128
    @command_window.active = true
    #---
    if $game_temp.last_status_index != nil
      @command_window.oy = $game_temp.status_oy
      @command_window.index = $game_temp.last_status_index
    end
    #---
    update_visible_windows
  end
 
  #--------------------------------------------------------------------------
  # new method: update_visible_windows
  #--------------------------------------------------------------------------
  def update_visible_windows
    @help_window.y = Graphics.height * 8
    for window in @windows; window.y = Graphics.height * 8; end
    case @data[@command_window.index]
    when :general
      @general_window.y = @command_window.height
    when :boosters
      @help_window.y = @command_window.height
      @boosters_window.y = @help_window.y + @help_window.height
      @boosters_stats.y = @help_window.y + @help_window.height
      @boosters_window.update_help
    when :elements
      @help_window.y = @command_window.height
      @elements_window.y = @help_window.y + @help_window.height
      @elements_stats.y = @help_window.y + @help_window.height
      @elements_window.update_help
    when :states
      @help_window.y = @command_window.height
      @states_window.y = @help_window.y + @help_window.height
      @states_stats.y = @help_window.y + @help_window.height
      @states_window.update_help
    when :biography
      @biography_window.y = @command_window.height
    end
  end
 
end # Scene_Status

Credit



Support


Post here or PM me if you have troubles.

Author's Notes


It really needs to be said that I basically made nothing of this script, except piecing it together. Credits could as well go 100% to Yanfly, because he has a really clean scripting style even a noob like me can understand how they work. Well, almost.
Title: Re: YEZ to YEM Status Biography
Post by: modern algebra on April 22, 2011, 05:46:52 PM
Cool. Nice work heisenman and thanks for sharing.
Title: Re: YEZ to YEM Status Biography
Post by: thanatos2k1 on October 16, 2011, 03:40:15 AM
Does this only work for actors or can you have a choice like if I wanted to use this for all the characters and important npcs as well? Like the Brave Story menu from FFT.