- Joined
- Jan 2, 2017
- Messages
- 5
- Reaction score
- 0
- First Language
- English
- Primarily Uses
Hi! I recently added Bigace360's Character Biography script into my project as it gave me the options and abilities I needed. However, there are several instances in which the system says there is a "SyntaxError" where it expects a "]" instead of a "}" so, trusting what I saw on my screen, I promptly changed those. The latest problem I've run into is another Syntax Error where a "]" is expected. It is identified as an "unexpected keyword_def" but I don't know what that means as I'm very new to scripts and all. The line that the system is having trouble with reads as follows:
" def self.character_history(id)"
And that's it. What seems to be the problem here?
Here is what I've done with the script so far, in case it was one of the edits I made that messed it up (What I changed has been bolded and the issue I mentioned is italicized and underlined):
Spoiler
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ Actor Biography
# ■ Author: Bigace360
# ■ Version: 1.00
# ■ Date: April 23, 2013
# ■ Blog: http://bigaceworld.wordpress.com/
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# VERSION HISTORY #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# v1.00 (04.23.2013) - Started and Finished
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# 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.
# Along with that, the script allows for the ability to change the descriptions
# for actors during the game.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# INSTRUCTIONS #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# To install the script, open you script editor and paste this script on a new
# section bellow the Materials section. If you are using a menu script and you
# want this script to add itself to the menu automatically, then this script
# should be below the custom menu. The actor's portrait images must be placed
# on the folder "Graphics/portraits/". Create a folder named "Portraits" in the
# Graphics folder.
#
#------------------------------------------------------------------------------
# Comment calls note tags:
# Tags to be used in events comment box, works like a script call.
#
# <change biography: id>
# string
# </change biography>
# The new description text, the string is the text, to add a break line
# use \\n.
# id : ID of the actor
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# SECTIONS #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ Modules
# ** Module ACE
# ** Module Cache
#
# ■ RPGVXACE Data Structures
# ** Object
# ** Bitmap
#
# ■ Game_Objects
# ** Game_System
# ** Game_Actor
# ** Game_Interpreter
#
# ■ Windows
# ** Window_MenuCommand
# ** Window_Biography
#
# ■ Scenes
# ** Scene_Menu
# ** Scene_Biography
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Credits/Thanks:
# - Bigace360, for the script.
# - Blizzard (Bitmap.Slice_text method)
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Script Conflicts and Compatability #
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# * Overwrite methods
# class Game_Actor < Game_Battler
# def description
#
# * Alias methods
# class Game_Interpreter
# def command_108
#
# class Window_MenuCommand < Window_Command
# def make_command_list
#
# class Scene_Menu < Scene_MenuBase
# def create_command_window(*args, &block)
# def on_personal_ok(*args, &block)
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ Module ACE::CORE
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
module ACE
module CORE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# ◆ Section I. General Settings◆
# -------------------------------------------------------------------------
# This changes the way menus appear in your game.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
BIO_CONFIG ={
# :menu_access - This value determines whether the Biography is accessible
# from a command in the menu. If true, then it is. If false, it isn't.
:menu_access => true,
# :menu_index - If :menu_access is true, then this value determines where
# in the menu command window it is inserted.
:menu_index => 4,
# :menu_label - If :menu_access is true, then this value determines the
# name of the command in the menu
:menu_label => 'Biography',
}
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# ◆ Section II. Biography Settings ◆
# -------------------------------------------------------------------------
# The following will allow you to adjust biographies for actors.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
BIOGRAPHY ={
#
ortrait - large image of the selected actor, you can choose it's x y
# coordinates from here.
# [X, Y ]
ortrait => [300, 545],
# :y_coordinates - Y Coordinates for the History and Bio Paragraphs
# [His.y, Bio.y]
:y_coordinates => [5, 200],
# Alignment for enemies biography and battle tactics:
# 0=right;
# 1=center;
# 2=left
:alignment => 0,
# :character_stats - Change the characters stat values in the array to
# whatever you want.
:character_stats => [
'Name:',
'Nicknames:',
'Age:',
'Gender:',
],
# :character_info - 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 array.
#-------------------------------------------------------------------------
# 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. \\). Also use \\N[x] to write out
# the actor's first name if the game allows renaming.Use \\C[x] to write
# out the actor's class name if the game allows for class changing and
# \\A[x] for actor's nicknames.
:character_info => {
# char_id => [character_stats,....],
1 => ['Caleb Adam Wilkerson', '\\A[1]', '15', 'Male',
2 => ['Cameron Bailey Parker', '\\A[2]', '15', 'Male',
3 => ['Cinderella Ballesteros', '\\A[3]', '15', 'Female',
4 => ['Corin Wheeler Davis', '\\A[4]', '16', 'Male',
5 => ['Gabriel Matthew Cruz', '\\A[5]', '14', 'Male',
6 => ['Sierra Michelle McNairn', '\\A[6]', '15', 'Female',
7 => ['Jackson Ewing Stovall', '\\A[7]', '15', 'Non-Binary',
],
# The header for the actors biography and history
:headers => ['BIOGRAPHY:', 'HISTORY:'],
]
# Short paragraph/description of character. When typing out biographies
# and descriptions, use \\N[x] to write out the actor's first name if the
# game allows renaming. For line splits, the script uses Blizzard's
# slice_text method to automatically break to next line when needed, so do
# not concern yourself with that.
def self.character_history(id)
text = case id
when 1 then '\\N[1] is RMVXA\'s hero and the main protagonist. He is a 19 ' +
'year-old orphaned human street urchin who lost his parents in a plague ' +
'when he was 12 years old. His only brother, died two years before the ' +
'start of the game, during the Zombie invasion.'
end
return !text.nil? ? text : 'No Information Available'
end
end
end
#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
# * BEGIN [ DON'T TOUCH THIS SECTION ]
#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
#
# ▼ Warning
# Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death,
# and/or halitosis so edit at your own risk.
#
#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# ▼ Import to Global Hash ▼ #
($ace_script ||= {})[:actor_biography] = 1.00
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Object (This class is the superclass of all other classes.)
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Object
def get_all_values(value1, value2 = nil)
value2 = value1 unless value2
/<#{value1}>((?:[^<]|<[^\/])*)<\/#{value2}>/im
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Bitmap (The bitmap class. Bitmaps are expressions of so-called graphics.)
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Bitmap
#------------(slice_text method by Blizzard)-------
def slice_text(text, width)
lines = text.split("\n")
result = []
lines.each do |text_chunk|
words = text_chunk.split(' ')
current_text = words.shift
next result << (current_text.nil? ? "" : current_text) if words.empty?
words.each_index do |i|
if self.text_size("#{current_text} #{words}").width > width
result.push(current_text)
current_text = words
else
current_text = "#{current_text} #{words}"
end
result << current_text if i >= words.size - 1
end
end
return result
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Module Cache
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Cache
def self.portrait(filename)
load_bitmap("Graphics/portraits/", filename)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Game_Actor
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_Actor < Game_Battler
def description
@description ? @description : actor.description
end
def description=(n)
@description = n
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Game_Interpreter
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_Interpreter
alias :ace_biography_command_108 :command_108 unless $@
def command_108
ace_biography_command_108
call_bio_description
end
def call_bio_description
value = "CHANGE BIOGRAPHY"
regexp = get_all_values("#{value}: (\\d+)", value)
note.scan(regexp) do |id, text|
text.gsub!(/\r\n/) {""}
text.gsub!(/\\n/) {"\r\n"}
$game_actors[id.to_i].description = text if $game_actors[id.to_i]
end
end
def note
@comments ? @comments.join("\r\n") : ""
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Biography
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Biography < Window_Selectable
include ACE::CORE
def initialize(actor)
super(0, 0, Graphics.width, Graphics.height)
@actor = actor; @bio = BIOGRAPHY
refresh
activate
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
def refresh
contents.clear
draw_actor_portrait(@actor, @bio[
ortrait][0], @bio[
ortrait][1])
stats = @bio[:character_stats]; @align = @bio[:alignment]
@bio_y = @bio[:y_coordinates][0]; @his_y = @bio[:y_coordinates][1]
contents.font.size = 16
draw_header(stats)
reset_font_settings
contents.font.size = 16
draw_actors_persona
contents.font.size = 20
draw_actors_bio; draw_actors_history
end
def draw_header(stats)
change_color(system_color); contents.font.bold = true
stats.each_index {|i| draw_text(0, i*(17*2), 168, 24, stats)}
draw_text(200, @bio_y, 168, 24, @bio[:headers][0])
draw_text(200, @his_y, 168, 24, @bio[:headers][1])
end
def draw_actors_persona
info = @bio[:character_info][@actor.id]
info.join(" ")
info.each do |i|
i.gsub!(/\\[Nn]\[([0-9]+)\]/) {actor_name($1.to_i)}
i.gsub!(/\\[Cc]\[([0-9]+)\]/) {actor_class($1.to_i)}
i.gsub!(/\\[Aa]\[([0-9]+)\]/) {actor_nickname($1.to_i)}
end
info.each_with_index {|i, y| draw_text(8, 17+y*(17*2), 168, 24, i)}
end
def actor_class(n)
actor = n >= 1 ? $game_actors[n] : nil
actor ? actor.class.name : ""
end
def actor_nickname(n)
actor = n >= 1 ? $game_actors[n] : nil
actor ? actor.nickname : ""
end
def draw_actors_bio
text = @actor.description
text = convert_escape_characters(text)
bio = contents.slice_text(text, 310)
bio.each_index do |i|
draw_text(210, ((@bio_y+5)+20)+i*20, 310, 24, bio, @align)
end
end
def draw_actors_history
text = ACE::CORE.character_history(@actor.id)
text = convert_escape_characters(text)
his = contents.slice_text(text, 310)
his.each_index do |i|
draw_text(210, ((@his_y+5)+20)+i*20, 310, 24, his, @align)
end
end
def draw_actor_portrait(filename, x, y)
bitmap = Cache.portrait("#{actor.name}_P") rescue Cache.portrait("")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y, bitmap, src_rect, 98)
bitmap.dispose
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Scene_Biography
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Scene_Biography < Scene_MenuBase
def start
super
@status_window = Window_Biography.new(@actor)
@status_window.set_handler
cancel, method
return_scene))
@status_window.set_handler
pagedown, method
next_actor))
@status_window.set_handler
pageup, method
prev_actor))
end
def on_actor_change
@status_window.actor = @actor
@status_window.activate
end
end
if ACE::CORE::BIO_CONFIG[:menu_access]
ACE_COMMAND_INSERTS = {}
ACE_InsertableMenuCommand = Struct.new
name, :index, :enable, :scene,
ther)
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# ■ Game_System
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
class Game_System
def ace_inserted_menu_commands
if !@ace_inserted_menu_commands
@ace_inserted_menu_commands = ACE_COMMAND_INSERTS.keys
@ace_inserted_menu_commands.sort! do |a, b|
ACE_COMMAND_INSERTS[a].index <=> ACE_COMMAND_INSERTS.index
end
end
@ace_inserted_menu_commands
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# ■ Window_MenuCommand
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
class Window_MenuCommand
alias :ace_command_bio_insert :make_command_list unless $@
def make_command_list(*args, &block)
ace_command_bio_insert(*args, &block)
$game_system.ace_inserted_menu_commands.each do |sym|
ace_insert_command(sym)
end
end
def ace_insert_command(symbol)
command = ACE_COMMAND_INSERTS[symbol]
name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
enabled = case command.enable
when Integer then command.enable == 0 ? true : $game_switches[command.enable]
when String then eval(command.enable)
when Symbol then self.send(command.enable)
else enabled = true
end
add_command(name, symbol, enabled)
added = @list.pop
@list.insert([command.index, @list.size].min, added)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# ■ Scene_Menu
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
class Scene_Menu
alias :ace_create_bio_window :create_command_window
alias :ace_personal_bio_ok
n_personal_ok
def create_command_window(*args, &block)
ace_create_bio_window(*args, &block)
$game_system.ace_inserted_menu_commands.each do |symbol|
ace_set_insert_handler(symbol)
end
end
def ace_set_insert_handler(symbol)
other = ACE_COMMAND_INSERTS[symbol].other
handler = case other
when Symbol then method(other)
when String then lambda { eval(other) }
when TrueClass then method
command_personal)
else method
ace_command_insert)
end
@command_window.set_handler(symbol, handler)
end
def ace_command_insert
SceneManager.call(Kernel.const_get(
ACE_COMMAND_INSERTS[@command_window.current_symbol].scene)
)
end
def on_personal_ok(*args, &block)
if $game_system.maic_inserted_menu_commands.include?(@command_window.current_symbol)
ace_command_insert
else
ace_personal_bio_ok(*args, &block)
end
end
end
ACE_COMMAND_INSERTS[:stateview] = ACE_InsertableMenuCommand.new(
ACE::CORE::BIO_CONFIG[:menu_label],
ACE::CORE::BIO_CONFIG[:menu_index], true, :Scene_Biography, false)
end
" def self.character_history(id)"
And that's it. What seems to be the problem here?
Here is what I've done with the script so far, in case it was one of the edits I made that messed it up (What I changed has been bolded and the issue I mentioned is italicized and underlined):
Spoiler
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ Actor Biography
# ■ Author: Bigace360
# ■ Version: 1.00
# ■ Date: April 23, 2013
# ■ Blog: http://bigaceworld.wordpress.com/
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# VERSION HISTORY #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# v1.00 (04.23.2013) - Started and Finished
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# 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.
# Along with that, the script allows for the ability to change the descriptions
# for actors during the game.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# INSTRUCTIONS #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# To install the script, open you script editor and paste this script on a new
# section bellow the Materials section. If you are using a menu script and you
# want this script to add itself to the menu automatically, then this script
# should be below the custom menu. The actor's portrait images must be placed
# on the folder "Graphics/portraits/". Create a folder named "Portraits" in the
# Graphics folder.
#
#------------------------------------------------------------------------------
# Comment calls note tags:
# Tags to be used in events comment box, works like a script call.
#
# <change biography: id>
# string
# </change biography>
# The new description text, the string is the text, to add a break line
# use \\n.
# id : ID of the actor
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# SECTIONS #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ Modules
# ** Module ACE
# ** Module Cache
#
# ■ RPGVXACE Data Structures
# ** Object
# ** Bitmap
#
# ■ Game_Objects
# ** Game_System
# ** Game_Actor
# ** Game_Interpreter
#
# ■ Windows
# ** Window_MenuCommand
# ** Window_Biography
#
# ■ Scenes
# ** Scene_Menu
# ** Scene_Biography
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Credits/Thanks:
# - Bigace360, for the script.
# - Blizzard (Bitmap.Slice_text method)
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Script Conflicts and Compatability #
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# * Overwrite methods
# class Game_Actor < Game_Battler
# def description
#
# * Alias methods
# class Game_Interpreter
# def command_108
#
# class Window_MenuCommand < Window_Command
# def make_command_list
#
# class Scene_Menu < Scene_MenuBase
# def create_command_window(*args, &block)
# def on_personal_ok(*args, &block)
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ Module ACE::CORE
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
module ACE
module CORE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# ◆ Section I. General Settings◆
# -------------------------------------------------------------------------
# This changes the way menus appear in your game.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
BIO_CONFIG ={
# :menu_access - This value determines whether the Biography is accessible
# from a command in the menu. If true, then it is. If false, it isn't.
:menu_access => true,
# :menu_index - If :menu_access is true, then this value determines where
# in the menu command window it is inserted.
:menu_index => 4,
# :menu_label - If :menu_access is true, then this value determines the
# name of the command in the menu
:menu_label => 'Biography',
}
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# ◆ Section II. Biography Settings ◆
# -------------------------------------------------------------------------
# The following will allow you to adjust biographies for actors.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
BIOGRAPHY ={
#
# coordinates from here.
# [X, Y ]
# :y_coordinates - Y Coordinates for the History and Bio Paragraphs
# [His.y, Bio.y]
:y_coordinates => [5, 200],
# Alignment for enemies biography and battle tactics:
# 0=right;
# 1=center;
# 2=left
:alignment => 0,
# :character_stats - Change the characters stat values in the array to
# whatever you want.
:character_stats => [
'Name:',
'Nicknames:',
'Age:',
'Gender:',
],
# :character_info - 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 array.
#-------------------------------------------------------------------------
# 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. \\). Also use \\N[x] to write out
# the actor's first name if the game allows renaming.Use \\C[x] to write
# out the actor's class name if the game allows for class changing and
# \\A[x] for actor's nicknames.
:character_info => {
# char_id => [character_stats,....],
1 => ['Caleb Adam Wilkerson', '\\A[1]', '15', 'Male',
2 => ['Cameron Bailey Parker', '\\A[2]', '15', 'Male',
3 => ['Cinderella Ballesteros', '\\A[3]', '15', 'Female',
4 => ['Corin Wheeler Davis', '\\A[4]', '16', 'Male',
5 => ['Gabriel Matthew Cruz', '\\A[5]', '14', 'Male',
6 => ['Sierra Michelle McNairn', '\\A[6]', '15', 'Female',
7 => ['Jackson Ewing Stovall', '\\A[7]', '15', 'Non-Binary',
],
# The header for the actors biography and history
:headers => ['BIOGRAPHY:', 'HISTORY:'],
]
# Short paragraph/description of character. When typing out biographies
# and descriptions, use \\N[x] to write out the actor's first name if the
# game allows renaming. For line splits, the script uses Blizzard's
# slice_text method to automatically break to next line when needed, so do
# not concern yourself with that.
def self.character_history(id)
text = case id
when 1 then '\\N[1] is RMVXA\'s hero and the main protagonist. He is a 19 ' +
'year-old orphaned human street urchin who lost his parents in a plague ' +
'when he was 12 years old. His only brother, died two years before the ' +
'start of the game, during the Zombie invasion.'
end
return !text.nil? ? text : 'No Information Available'
end
end
end
#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
# * BEGIN [ DON'T TOUCH THIS SECTION ]
#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
#
# ▼ Warning
# Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death,
# and/or halitosis so edit at your own risk.
#
#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# ▼ Import to Global Hash ▼ #
($ace_script ||= {})[:actor_biography] = 1.00
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Object (This class is the superclass of all other classes.)
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Object
def get_all_values(value1, value2 = nil)
value2 = value1 unless value2
/<#{value1}>((?:[^<]|<[^\/])*)<\/#{value2}>/im
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Bitmap (The bitmap class. Bitmaps are expressions of so-called graphics.)
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Bitmap
#------------(slice_text method by Blizzard)-------
def slice_text(text, width)
lines = text.split("\n")
result = []
lines.each do |text_chunk|
words = text_chunk.split(' ')
current_text = words.shift
next result << (current_text.nil? ? "" : current_text) if words.empty?
words.each_index do |i|
if self.text_size("#{current_text} #{words}").width > width
result.push(current_text)
current_text = words
else
current_text = "#{current_text} #{words}"
end
result << current_text if i >= words.size - 1
end
end
return result
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Module Cache
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Cache
def self.portrait(filename)
load_bitmap("Graphics/portraits/", filename)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Game_Actor
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_Actor < Game_Battler
def description
@description ? @description : actor.description
end
def description=(n)
@description = n
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Game_Interpreter
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_Interpreter
alias :ace_biography_command_108 :command_108 unless $@
def command_108
ace_biography_command_108
call_bio_description
end
def call_bio_description
value = "CHANGE BIOGRAPHY"
regexp = get_all_values("#{value}: (\\d+)", value)
note.scan(regexp) do |id, text|
text.gsub!(/\r\n/) {""}
text.gsub!(/\\n/) {"\r\n"}
$game_actors[id.to_i].description = text if $game_actors[id.to_i]
end
end
def note
@comments ? @comments.join("\r\n") : ""
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Biography
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Biography < Window_Selectable
include ACE::CORE
def initialize(actor)
super(0, 0, Graphics.width, Graphics.height)
@actor = actor; @bio = BIOGRAPHY
refresh
activate
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
def refresh
contents.clear
draw_actor_portrait(@actor, @bio[
stats = @bio[:character_stats]; @align = @bio[:alignment]
@bio_y = @bio[:y_coordinates][0]; @his_y = @bio[:y_coordinates][1]
contents.font.size = 16
draw_header(stats)
reset_font_settings
contents.font.size = 16
draw_actors_persona
contents.font.size = 20
draw_actors_bio; draw_actors_history
end
def draw_header(stats)
change_color(system_color); contents.font.bold = true
stats.each_index {|i| draw_text(0, i*(17*2), 168, 24, stats)}
draw_text(200, @bio_y, 168, 24, @bio[:headers][0])
draw_text(200, @his_y, 168, 24, @bio[:headers][1])
end
def draw_actors_persona
info = @bio[:character_info][@actor.id]
info.join(" ")
info.each do |i|
i.gsub!(/\\[Nn]\[([0-9]+)\]/) {actor_name($1.to_i)}
i.gsub!(/\\[Cc]\[([0-9]+)\]/) {actor_class($1.to_i)}
i.gsub!(/\\[Aa]\[([0-9]+)\]/) {actor_nickname($1.to_i)}
end
info.each_with_index {|i, y| draw_text(8, 17+y*(17*2), 168, 24, i)}
end
def actor_class(n)
actor = n >= 1 ? $game_actors[n] : nil
actor ? actor.class.name : ""
end
def actor_nickname(n)
actor = n >= 1 ? $game_actors[n] : nil
actor ? actor.nickname : ""
end
def draw_actors_bio
text = @actor.description
text = convert_escape_characters(text)
bio = contents.slice_text(text, 310)
bio.each_index do |i|
draw_text(210, ((@bio_y+5)+20)+i*20, 310, 24, bio, @align)
end
end
def draw_actors_history
text = ACE::CORE.character_history(@actor.id)
text = convert_escape_characters(text)
his = contents.slice_text(text, 310)
his.each_index do |i|
draw_text(210, ((@his_y+5)+20)+i*20, 310, 24, his, @align)
end
end
def draw_actor_portrait(filename, x, y)
bitmap = Cache.portrait("#{actor.name}_P") rescue Cache.portrait("")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y, bitmap, src_rect, 98)
bitmap.dispose
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Scene_Biography
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Scene_Biography < Scene_MenuBase
def start
super
@status_window = Window_Biography.new(@actor)
@status_window.set_handler
@status_window.set_handler
@status_window.set_handler
end
def on_actor_change
@status_window.actor = @actor
@status_window.activate
end
end
if ACE::CORE::BIO_CONFIG[:menu_access]
ACE_COMMAND_INSERTS = {}
ACE_InsertableMenuCommand = Struct.new
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# ■ Game_System
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
class Game_System
def ace_inserted_menu_commands
if !@ace_inserted_menu_commands
@ace_inserted_menu_commands = ACE_COMMAND_INSERTS.keys
@ace_inserted_menu_commands.sort! do |a, b|
ACE_COMMAND_INSERTS[a].index <=> ACE_COMMAND_INSERTS.index
end
end
@ace_inserted_menu_commands
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# ■ Window_MenuCommand
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
class Window_MenuCommand
alias :ace_command_bio_insert :make_command_list unless $@
def make_command_list(*args, &block)
ace_command_bio_insert(*args, &block)
$game_system.ace_inserted_menu_commands.each do |sym|
ace_insert_command(sym)
end
end
def ace_insert_command(symbol)
command = ACE_COMMAND_INSERTS[symbol]
name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
enabled = case command.enable
when Integer then command.enable == 0 ? true : $game_switches[command.enable]
when String then eval(command.enable)
when Symbol then self.send(command.enable)
else enabled = true
end
add_command(name, symbol, enabled)
added = @list.pop
@list.insert([command.index, @list.size].min, added)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# ■ Scene_Menu
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
class Scene_Menu
alias :ace_create_bio_window :create_command_window
alias :ace_personal_bio_ok
def create_command_window(*args, &block)
ace_create_bio_window(*args, &block)
$game_system.ace_inserted_menu_commands.each do |symbol|
ace_set_insert_handler(symbol)
end
end
def ace_set_insert_handler(symbol)
other = ACE_COMMAND_INSERTS[symbol].other
handler = case other
when Symbol then method(other)
when String then lambda { eval(other) }
when TrueClass then method
else method
end
@command_window.set_handler(symbol, handler)
end
def ace_command_insert
SceneManager.call(Kernel.const_get(
ACE_COMMAND_INSERTS[@command_window.current_symbol].scene)
)
end
def on_personal_ok(*args, &block)
if $game_system.maic_inserted_menu_commands.include?(@command_window.current_symbol)
ace_command_insert
else
ace_personal_bio_ok(*args, &block)
end
end
end
ACE_COMMAND_INSERTS[:stateview] = ACE_InsertableMenuCommand.new(
ACE::CORE::BIO_CONFIG[:menu_label],
ACE::CORE::BIO_CONFIG[:menu_index], true, :Scene_Biography, false)
end

