Random Character Generator [RMXP]
Publicado em 3 de julho de 2012.Random Character Generator é um script pro RPG Maker XP, feito por SephirothSpawn que permite a criação de personagens aleatórios, em diferentes classes, etc, num jogo ou projeto desenvolvido com esta ferramenta!
A instalação é muito simples, basta copiar o script acima do Main, e abaixo do SDK, que é necessário (na demo ele usa o SDK 1.4). Daí basta você criar um evento em qualquer lugar do mapa que chama o script $scene = Scene_Character_Generator.new.
Na demo, você vai com o herói no evento (este carinha de cabelo azul que está na thumb deste post) e aperta [ENTER]. Daí você procura por personagens e contrata-os (“hire”). Pode ser interessante para colocar mercenários no seu jogo, como no minigame.
#==============================================================================
# ** Random Character Generator
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1
# 2006-03-20
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Random Character Generator', 'SephirothSpawn', 1, '2006-03-20')
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('Random Character Generator') == true
#==============================================================================
# ** Character_Generator
#==============================================================================
module Character_Generator
#--------------------------------------------------------------------------
# * Scout Groups
#--------------------------------------------------------------------------
SCOUT_GROUPS = ['Fighters', 'Lancers', 'Warriors', 'Thiefs',
'Hunters', 'Gunners', 'Clerics', 'Mages']
#--------------------------------------------------------------------------
# * Scouting Prices
# ~ group_name => price to scout
#--------------------------------------------------------------------------
DEFAULT_SCOUTING_PRICE = 250
SCOUTING_PRICES = {
'Fighters' => 250, 'Clerics' => 650, 'Mages' => 750
}
#--------------------------------------------------------------------------
# * Hiring Prices
# ~ group_name => price to hire
#--------------------------------------------------------------------------
DEFAULT_HIRING_PRICE = 2500
HIRING_PRICES = {
'Fighters' => 2500, 'Clerics' => 6500, 'Mages' => 7500
}
#--------------------------------------------------------------------------
# * Default Actor Parameters
#--------------------------------------------------------------------------
DEFAULT_PARAMETERS = {
'Names' => ['Name 1', 'Name 2'],
'Sprites' => ['001-Fighter01', '002-Fighter02', '003-Fighter03', '004-Fighter04',
'005-Fighter05', '006-Fighter06', '007-Fighter07', '008-Fighter08'],
'Hues' => [0],
'Class ID' => 1,
'Start Levels' => [1, 2, 3, 4, 5],
'Final Levels' => [99],
'Exp Basis' => [10, 20, 30, 40, 50],
'Exp Inflation' => [10, 20, 30, 40, 50],
'Weapons' => [0, 1, 2],
'Shields' => [0, 1, 2],
'Helmets' => [0, 5, 6],
'Armors' => [0, 13, 14],
'Accessories' => [0, 25, 26, 27, 28, 29, 30, 31, 32],
'Weapon Fix' => false,
'Shield Fix' => false,
'Helmet Fix' => false,
'Armor Fix' => false,
'Accessory Fix' => false
}
#--------------------------------------------------------------------------
# * Actor Parameters
# ~ group_name => { param_name =>
} }
#--------------------------------------------------------------------------
ACTOR_PARAMETERS = {
'Fighters' => {
'Names' => ['Fighter A', 'Fighter B', 'Fighter C', 'Fighter D']
},
'Lancers' => {
'Names' => ['Lancer A', 'Lancer B', 'Lancer C', 'Lancer D'],
'Sprites' => ['009-Lancer01', '010-Lancer02', '011-Lancer03', '012-Lancer04'],
'Class ID' => 2,
'Weapons' => [0, 5, 6]
},
'Warriors' => {
'Names' => ['Warrior A', 'Warrior B', 'Warrior C', 'Warrior D'],
'Sprites' => ['013-Warrior01', '014-Warrior02', '015-Warrior03'],
'Class ID' => 3,
'Weapons' => [0, 9, 10],
},
'Thiefs' => {
'Names' => ['Thief A', 'Thief B', 'Thief C', 'Thief D'],
'Sprites' => ['016-Thief01', '017-Thief02', '018-Thief03', '019-Thief04'],
'Class ID' => 4,
'Weapons' => [0, 13, 14],
'Shields' => [0],
'Armors' => [0, 17, 18],
},
'Hunters' => {
'Names' => ['Hunter A', 'Hunter B', 'Hunter C', 'Hunter D'],
'Sprites' => ['020-Hunter01', '021-Hunter02', '022-Hunter03'],
'Class ID' => 5,
'Weapons' => [0, 17, 18],
'Shields' => [0],
'Armors' => [0, 17, 18],
},
'Gunners' => {
'Names' => ['Gunner A', 'Gunner B', 'Gunner C', 'Gunner D'],
'Sprites' => ['023-Gunner01', '024-Gunner02'],
'Class ID' => 6,
'Weapons' => [0, 21, 22],
'Shields' => [0],
'Armors' => [0, 17, 18],
},
'Clerics' => {
'Names' => ['Cleric A', 'Cleric B', 'Cleric C', 'Cleric D'],
'Sprites' => ['025-Cleric01', '026-Cleric02', '027-Cleric03', '028-Cleric04',
'029-Cleric05', '030-Cleric06', '031-Cleric07', '032-Cleric08'],
'Class ID' => 7,
'Weapons' => [0, 25, 26],
'Shields' => [0],
'Helmets' => [0, 9, 10],
'Armors' => [0, 21, 22],
},
'Mages' => {
'Names' => ['Mage A', 'Mage B', 'Mage C', 'Mage D'],
'Sprites' => ['033-Mage01', '034-Mage02', '035-Mage03', '036-Mage04',
'037-Mage05', '038-Mage06', '039-Mage07', '040-Mage08', '041-Mage09'],
'Class ID' => 8,
'Weapons' => [0, 29, 30],
'Shields' => [0],
'Helmets' => [0, 9, 10],
'Armors' => [0, 21, 22],
},
}
#--------------------------------------------------------------------------
# * Generate Random Character
#--------------------------------------------------------------------------
def self.generate_random_character(group = 'Level 1')
# Starts Actor Creation
actor = RPG::Actor.new
# Sets Name
names = DEFAULT_PARAMETERS['Names']
actor.name = names[rand(names.size)]
# Sets Sprites
sprites = DEFAULT_PARAMETERS['Sprites']
actor.character_name =
actor.battler_name = sprites[rand(sprites.size)]
# Sets Hue
hues = DEFAULT_PARAMETERS['Hues']
actor.character_hue =
actor.battler_hue = hues[rand(hues.size)]
# Sets Class ID
actor.class_id = DEFAULT_PARAMETERS['Class ID']
# Sets Initial Level
s_levels = DEFAULT_PARAMETERS['Start Levels']
actor.initial_level = s_levels[rand(s_levels.size)]
# Sets Final Level
f_levels = DEFAULT_PARAMETERS['Final Levels']
actor.final_level = f_levels[rand(f_levels.size)]
# Sets Exp Basis
e_basis = DEFAULT_PARAMETERS['Exp Basis']
actor.exp_basis = e_basis[rand(e_basis.size)]
# Sets Exp Inflation
e_inflation = DEFAULT_PARAMETERS['Exp Inflation']
actor.exp_inflation = e_inflation[rand(e_inflation.size)]
# Sets Weapons
weapons = DEFAULT_PARAMETERS['Weapons']
actor.weapon_id = weapons[rand(weapons.size)]
# Sets Shields
shields = DEFAULT_PARAMETERS['Shields']
actor.armor1_id = shields[rand(shields.size)]
# Sets Helmets
helmets = DEFAULT_PARAMETERS['Helmets']
actor.armor2_id = helmets[rand(helmets.size)]
# Sets Armors
armors = DEFAULT_PARAMETERS['Armors']
actor.armor3_id = armors[rand(armors.size)]
# Sets Accessories
accessories = DEFAULT_PARAMETERS['Accessories']
actor.armor4_id = accessories[rand(accessories.size)]
# Weapon Fix
actor.weapon_fix = DEFAULT_PARAMETERS['Weapon Fix']
# Shield Fix
actor.armor1_fix = DEFAULT_PARAMETERS['Shield Fix']
# Helmet Fix
actor.armor2_fix = DEFAULT_PARAMETERS['Helmet Fix']
# Armor Fix
actor.armor3_fix = DEFAULT_PARAMETERS['Armor Fix']
# Accessory Fix
actor.armor4_fix = DEFAULT_PARAMETERS['Accessory Fix']
# Sets Up Actor Parameters
if ACTOR_PARAMETERS.has_key?(group)
group = ACTOR_PARAMETERS[group]
# Gets Random Name
if group.has_key?('Names')
unless group['Names'].empty?
actor.name = group['Names'][rand(group['Names'].size)]
end
end
# Gets Random Sprite Information
if group.has_key?('Sprites')
unless group['Sprites'].empty?
actor.character_name =
actor.battler_name = group['Sprites'][rand(group['Sprites'].size)]
end
end
# Gets Random Sprite Hue
if group.has_key?('Hues')
unless group['Hues'].empty?
actor.character_hue =
actor.battler_hue = group['Hues'][rand(group['Hues'].size)]
end
end
# Specified Class ID
if group.has_key?('Class ID')
actor.class_id = group['Class ID']
end
# Specified Initial Level Values
if group.has_key?('Start Levels')
unless group['Start Levels'].empty?
actor.initial_level = group['Start Levels'][rand(group['Start Levels'].size)]
end
end
# Specified Final Level Values
if group.has_key?('Final Levels')
unless group['Final Levels'].empty?
actor.final_level = group['Final Levels'][rand(group['Final Levels'].size)]
end
end
# Specified Exp Basis
if group.has_key?('Exp Basis')
unless group['Exp Basis'].empty?
actor.exp_basis = group['Exp Basis'][rand(group['Exp Basis'].size)]
end
end
# Specified Exp Inflamation
if group.has_key?('Exp Inflation')
unless group['Exp Inflation'].empty?
actor.exp_inflation = group['Exp Inflation'][rand(group['Exp Inflation'].size)]
end
end
# Specifed Weapons
if group.has_key?('Weapons')
unless group['Weapons'].empty?
actor.weapon_id = group['Weapons'][rand(group['Weapons'].size)]
end
end
# Specified Armors
if group.has_key?('Shields')
unless group['Shields'].empty?
actor.armor1_id = group['Shields'][rand(group['Shields'].size)]
end
end
if group.has_key?('Helmets')
unless group['Helmets'].empty?
actor.armor2_id = group['Helmets'][rand(group['Helmets'].size)]
end
end
if group.has_key?('Armors')
unless group['Armors'].empty?
actor.armor3_id = group['Armors'][rand(group['Armors'].size)]
end
end
if group.has_key?('Accessories')
unless group['Accessories'].empty?
actor.armor4_id= group['Accessories'][rand(group['Accessories'].size)]
end
end
# Specified Weapon Fixes
if group.has_key?('Weapon Fix')
actor.weapon_fix = group['Weapon Fix']
end
# Specified Armor Fixes
if group.has_key?('Shield Fix')
actor.armor1_fix = group['Shield Fix']
end
if group.has_key?('Helmet Fix')
actor.armor2_fix = group['Helmet Fix']
end
if group.has_key?('Armor Fix')
actor.armor3_fix = group['Armor Fix']
end
if group.has_key?('Accessory Fix')
actor.armor4_fix = group['Accessory Fix']
end
# Random Stastics
parameters = Table.new(6,100)
# Sets Starting HP
parameters[0, 0] = 375 + rand(251)
# Sets Starting SP
parameters[1, 0] = 375 + rand(251)
# Sets Starting Str, Dex, Agi, Int
for i in 2..5
parameters[i, 0] = 40 + rand(21)
end
# Sets Random Stats
for i in 1..99
for j in 0..5
x = i < 2 ? 40 : 4
parameters[j, i] = parameters[j, i - 1] + i * (x + rand(x / 2 + 1))
end
end
actor.parameters = parameters
end
return actor
end
#--------------------------------------------------------------------------
# * Generate Random Character
#--------------------------------------------------------------------------
def self.finialize_character(actor)
# Configures ID
actor.id = $data_actors.size
# Adds to Data Actors
$data_actors << actor
# Adds To Character Generator Class
$game_chargenerator.hired_characters << actor
# Adds to Game_Actors
$game_party.add_actor(actor.id)
end
end
#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Scale Blt
#--------------------------------------------------------------------------
def scale_blt(dest_rect, src_bitmap,
src_rect = Rect.new(0, 0, src_bitmap.width, src_bitmap.height), opacity = 255)
w, h = src_rect.width, src_rect.height
scale = [w / dest_rect.width.to_f, h / dest_rect.height.to_f].max
ow, oh = (w / scale).to_i, (h / scale).to_i
ox, oy = (dest_rect.width - ow) / 2, (dest_rect.height - oh) / 2
stretch_blt(Rect.new(ox + dest_rect.x, oy + dest_rect.y, ow, oh),
src_bitmap, src_rect )
end
end
#==============================================================================
# ** Game_CharacterGenerator
#==============================================================================
class Game_CharacterGenerator
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :scouted_characters
attr_accessor :hired_characters
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@scouted_characters = {}
@hired_characters = []
end
#--------------------------------------------------------------------------
# * Scout Character
#--------------------------------------------------------------------------
def scout_character(group, actor)
unless @scouted_characters.has_key?(group)
@scouted_characters[group] = []
end
@scouted_characters[group] << actor
end
#--------------------------------------------------------------------------
# * Hire Character
#--------------------------------------------------------------------------
def hire_character(group, index)
# Gets Character
actor = @scouted_characters[group][index]
# Delets Character from Scout Report
@scouted_characters[group].delete_at(index)
# Adds Character to Hired State
@hired_characters << actor
return actor
end
end
#==============================================================================
# ** Window_CharacterPrice
#==============================================================================
class Window_CharacterPrice < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(640, 328, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160
end
#--------------------------------------------------------------------------
# * Get Price
#--------------------------------------------------------------------------
def price
return @price
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(price = 0)
self.contents.clear
return if price.nil?
@price = price
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 128, 32, 'Cost:')
self.contents.font.color = $game_party.gold < price ?
text_color(2) : text_color(1)
self.contents.draw_text(- 4, 0, 128, 32, price.to_s, 2)
end
end
#==============================================================================
# ** Window_CharacterGenerator
#==============================================================================
class Window_CharacterGenerator < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(- 432, 96, 432, 368)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity, self.active = 160, false
@frame, @actor = 0, nil
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor)
self.contents.clear
# Stores Actor
@actor = actor
return unless actor.is_a?(RPG::Actor)
# Draws Animated Sprite
draw_sprite(0, 0, 96, 80, actor.character_name, actor.character_hue, 0, @frame)
# Draws Battler
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
self.contents.scale_blt(Rect.new(96, 0, 96, 80), bitmap)
# Draws Name
self.contents.font.color = normal_color
self.contents.draw_text(0, 80, 192, 24,
"#{actor.name} [#{$data_classes[actor.class_id].name}]", 1)
# Draws Levels
self.contents.draw_text(0, 104, 192, 24,
"Level #{actor.initial_level} (Max #{actor.final_level })", 1)
# Draws Exp Basis & Inflation
self.contents.font.color = system_color
self.contents.draw_text(4, 128, 192, 24, 'Experience Basis')
self.contents.draw_text(4, 152, 192, 24, 'Experience Inflation')
self.contents.font.color = actor.exp_basis > 30 ? text_color(2) : text_color(1)
self.contents.draw_text(- 4, 128, 192, 24, actor.exp_basis.to_s, 2)
self.contents.font.color = actor.exp_inflation > 30 ? text_color(2) : text_color(1)
self.contents.draw_text(- 4, 152, 192, 24, actor.exp_inflation.to_s, 2)
# Gets Actors Parameters
parameters = actor.parameters
hp = parameters[0, actor.initial_level]
sp = parameters[1, actor.initial_level]
str = parameters[2, actor.initial_level]
dex = parameters[3, actor.initial_level]
agi = parameters[4, actor.initial_level]
int = parameters[5, actor.initial_level]
# Draws Start HP & SP
stat_names = ['hp', 'sp'].collect! {|x| eval "$data_system.words.#{x}"}
stats = [hp, sp]
for i in 0..1
self.contents.font.color = system_color
self.contents.draw_text(212, i * 40, 192, 24, stat_names[i])
self.contents.font.color = normal_color
self.contents.draw_text(204, i * 40, 192, 24, "#{stats[i]} / #{stats[i]}", 2)
s_color = i == 0 ? Color.new(150, 0, 0) : Color.new(25, 25, 160)
f_color = i == 0 ? Color.new(255, 255, 60) : Color.new(25, 160, 25)
draw_slant_bar(240, i * 40 + 24, stats[i], stats[i], 152, 8, s_color, f_color)
end
# Draws Start Str, Dex, Agi * Int
stat_names = ['str', 'dex', 'agi', 'int'].collect! {|x| eval "$data_system.words.#{x}"}
stats = [str, dex, agi, int]
for i in 0..3
self.contents.font.color = system_color
self.contents.draw_text(212, 80 + i * 24, 192, 24, stat_names[i])
self.contents.font.color = normal_color
self.contents.draw_text(204, 80 + i * 24, 192, 24, stats[i].to_s, 2)
end
# Draws Equipment
self.contents.font.color = normal_color
weapon = $data_weapons[actor.weapon_id]
armor1 = $data_armors[actor.armor1_id]
armor2 = $data_armors[actor.armor2_id]
armor3 = $data_armors[actor.armor3_id]
armor4 = $data_armors[actor.armor4_id]
draw_equipment(weapon, 0, 176, 192, 1, 0)
draw_equipment(armor1, 0, 208, 192, 1, 1)
draw_equipment(armor2, 0, 240, 192, 1, 2)
draw_equipment(armor3, 0, 272, 192, 1, 3)
draw_equipment(armor4, 0, 304, 192, 1, 4)
# Draws Equipment Fix
self.contents.font.color = system_color
self.contents.draw_text(212, 176, 192, 32, "#{$data_system.words.weapon} Fix?")
self.contents.draw_text(212, 208, 192, 32, "#{$data_system.words.armor1} Fix?")
self.contents.draw_text(212, 240, 192, 32, "#{$data_system.words.armor2} Fix?")
self.contents.draw_text(212, 272, 192, 32, "#{$data_system.words.armor3} Fix?")
self.contents.draw_text(212, 304, 192, 32, "#{$data_system.words.armor4} Fix?")
self.contents.font.color = normal_color
self.contents.draw_text(204, 176, 192, 32, (actor.weapon_fix ? 'Fixed' : 'Unfixed'), 2)
self.contents.draw_text(204, 208, 192, 32, (actor.armor1_fix ? 'Fixed' : 'Unfixed'), 2)
self.contents.draw_text(204, 240, 192, 32, (actor.armor2_fix ? 'Fixed' : 'Unfixed'), 2)
self.contents.draw_text(204, 272, 192, 32, (actor.armor3_fix ? 'Fixed' : 'Unfixed'), 2)
self.contents.draw_text(204, 304, 192, 32, (actor.armor4_fix ? 'Fixed' : 'Unfixed'), 2)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
return unless @actor.is_a?(RPG::Actor)
# Checks to Refresh Sprite
if Graphics.frame_count % 10 == 0
@frame == 3 ? @frame = 0 : @frame += 1
draw_sprite(0, 0, 96, 80, @actor.character_name, @actor.character_hue, 0, @frame)
end
end
#--------------------------------------------------------------------------
# * Draw Equipment
# item : item
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw text width
# align : text align
#--------------------------------------------------------------------------
def draw_equipment(item, x, y, width = 212, align = 0, type = 0, txt = 'Nothing')
if item.nil?
case type
when 0 # Weapon
bitmap = RPG::Cache.icon("001-Weapon01")
when 1 # Shield
bitmap = RPG::Cache.icon("009-Shield01")
when 2 # Helmet
bitmap = RPG::Cache.icon("010-Head01")
when 3 # Armor
bitmap = RPG::Cache.icon("014-Body02")
when 4 # Accessory
bitmap = RPG::Cache.icon("016-Accessory01")
end
contents.font.color, alpha = disabled_color, disabled_color.alpha
else
bitmap = RPG::Cache.icon(item.icon_name)
contents.font.color, alpha, txt = normal_color, 255, item.name
end
# Draws Icon
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), alpha)
self.contents.draw_text(x + 28, y, width - 28, 24, txt, align)
end
#--------------------------------------------------------------------------
# * Draw Sprite
#--------------------------------------------------------------------------
def draw_sprite(x, y, w, h, name, hue, stance, frame)
# Gets Bitmap
bitmap = RPG::Cache.character(name, hue)
# Bitmap Division
cw, ch = bitmap.width / 4, bitmap.height / 4
# Gets Animation Offsets
x_off, y_off = cw * frame, ch * stance
# Clears Area
self.contents.fill_rect(Rect.new(x, y, w, h), Color.new(0, 0, 0, 0))
# Draws Bitmap
self.contents.scale_blt(Rect.new(x, y, w, h), bitmap, Rect.new(x_off, y_off, cw, ch))
end
#--------------------------------------------------------------------------
# * Draw Slant Bar
#--------------------------------------------------------------------------
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
# Draw Border
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
# Draws Bar
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
#==============================================================================
# ** Window_ScoutList
#==============================================================================
class Window_ScoutList < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :item_max
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(640, 96, 160, 64)
self.opacity, self.active = 160, false
end
#--------------------------------------------------------------------------
# * Get Actor
#--------------------------------------------------------------------------
def actor
return @actors[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(group)
@actors = []
if $game_chargenerator.scouted_characters.has_key?(group)
@actors = $game_chargenerator.scouted_characters[group].dup
end
@actors << 'Back'
self.height = [[@actors.size * 32 + 32, 64].max, 224].min
self.contents = Bitmap.new(128, @actors.size * 32)
@item_max = @actors.size
self.index = 0
for i in 0...@actors.size
cmd, y = @actors[i], 32 * i
if cmd.is_a?(RPG::Actor)
bitmap = RPG::Cache.character(cmd.character_name , cmd.character_hue)
x = bitmap.width / 8 - 12
self.contents.blt(4, y + 4, bitmap, Rect.new(x, 0, 24, 24))
self.contents.draw_text(32, y, 96, 32, cmd.name)
else
self.contents.draw_text(4, y, 120, 32, 'Back')
end
end
end
end
#==============================================================================
# ** Scene_Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_randchargen_scenetitle_cmg command_new_game
#--------------------------------------------------------------------------
# * Command : New Game
#--------------------------------------------------------------------------
def command_new_game
# Original Command : New Game
seph_randchargen_scenetitle_cmg
# Adds Character Generator Data
$game_chargenerator = Game_CharacterGenerator.new
end
end
#==============================================================================
# ** Scene_Save
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_randchargen_scenesave_wd write_data
#--------------------------------------------------------------------------
# * Write Data
#--------------------------------------------------------------------------
def write_data(file)
# Original Write Save Data
seph_randchargen_scenesave_wd(file)
# Dumps Character Generator Data
Marshal.dump($game_chargenerator, file)
end
end
#==============================================================================
# ** Scene_Load
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_randchargen_sceneload_rd read_data
#--------------------------------------------------------------------------
# * Read Data
#--------------------------------------------------------------------------
def read_data(file)
# Original Read Save Data
seph_randchargen_sceneload_rd(file)
# Loads Character Generator Data
$game_chargenerator = Marshal.load(file)
# Adds Generated Actors
for actor in $game_chargenerator.hired_characters
# Adds to Data Class
$data_actors << actor
end
end
end
#==============================================================================
# ** Scene_Character_Generator
#==============================================================================
class Scene_Character_Generator
#--------------------------------------------------------------------------
# * Include Random Character Generator
#--------------------------------------------------------------------------
include Character_Generator
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Creates Spriteset
@spriteset = Spriteset_Map.new
# Creates Help Window
@help_window = Window_Help.new
@help_window.x, @help_window.y = 16, - 64
@help_window.width, @help_window.opacity = 608, 160
@help_window.contents = Bitmap.new(576, 32)
@help_window.set_text('Welcome to the Soilder Office', 1)
# Creates Main Command
@main_command = Window_Command.new(160, ['Scout', 'Hire', 'Exit'])
@main_command.x, @main_command.y = 640, 96
@main_command.opacity = 160
# Creates Scout Level Window
commands = SCOUT_GROUPS.dup << 'Back'
@scout_command = Window_Command.new(160, commands)
@scout_command.x, @scout_command.y = 640, 96
@scout_command.opacity, @scout_command.active = 160, false
@scout_command.height = 224 if @scout_command.height > 224
# Creates Scout List Window
@scout_list_window = Window_ScoutList.new
# Creates Scout Price Window
@scout_price_window = Window_CharacterPrice.new
# Creates Gold Window
@gold_window = Window_Gold.new
@gold_window.x, @gold_window.y = 640, 400
@gold_window.opacity = 160
# Character Profile Window
@character_profile_window = Window_CharacterGenerator.new
# Organizes Scene Objects
@objects = [@spriteset, @help_window, @main_command, @scout_command, @scout_list_window, @scout_price_window, @gold_window, @character_profile_window]
# Execute transition
Graphics.transition
# Main loop
while $scene == self
# Update game screen
Graphics.update
# Update input information
Input.update
# Updates Scene Objects
@objects.each {|x| x.update}
# Frame update
update
end
# Prepare for transition
Graphics.freeze
# Dispose of Scene Objects
@objects.each {|x| x.dispose}
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Main Commands
if @main_command.active
update_main_command
return
# Scout Selection
elsif @scout_command.active
update_scout_command
return
# Scout Profile Viewing
elsif @character_profile_window.active
update_scout_viewing
return
# Scout List Update
elsif @scout_list_window.active
update_hiring_command
return
end
# Exits Scene
update_exit
end
#--------------------------------------------------------------------------
# * Frame Update : Main Command
#--------------------------------------------------------------------------
def update_main_command
# Moves Windows
@help_window.y += 10 if @help_window.y < 16
@main_command.x -= 22 if @main_command.x > 464
@gold_window.x -= 22 if @gold_window.x > 464
@scout_list_window.x += 22 if @scout_list_window.x < 640
@scout_command.x += 22 if @scout_command.x < 640
@scout_list_window.x += 22 if @scout_list_window.x < 640
@scout_price_window.x += 22 if @scout_price_window.x < 640
@character_profile_window.x -= 56 if @character_profile_window.x > - 432
# If B Button Is Pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Turns Off Main Command
@main_command.active = false
# Sets Help Text
@help_window.set_text('Thank You!', 1)
end
# If C button Is Pressed
if Input.trigger?(Input::C)
# Play Decision SE
$game_system.se_play($data_system.decision_se)
# Turns Off Main Command
@main_command.active = false
# Checks Commands
case @main_command.index
when 0 # Scout
# Turns On Scout Command
@scout_command.active = true
# Refresh Scout Price Window
if @scout_command.index == SCOUT_GROUPS.size
price = nil
else
group = SCOUT_GROUPS[@scout_command.index]
price = SCOUTING_PRICES.has_key?(group) ?
SCOUTING_PRICES[group] : DEFAULT_SCOUTING_PRICE
end
@scout_price_window.refresh(price)
# Sets Scouting Flag
@scouting = true
# Sets Help Text
@help_window.set_text('Select Troop Group to Scout', 1)
when 1 # Hire
# Turns On Scout Command
@scout_command.active = true
# Refresh Scout Price Window
if @scout_command.index == SCOUT_GROUPS.size
price = nil
else
group = SCOUT_GROUPS[@scout_command.index]
price = HIRING_PRICES.has_key?(group) ?
HIRING_PRICES[group] : DEFAULT_HIRING_PRICE
end
@scout_price_window.refresh(price)
# Sets Hiring Flag
@scouting = false
# Sets Help Text
@help_window.set_text('Select Troop Group to Hire From', 1)
when 2 # Exit
# Sets Help Text
@help_window.set_text('Thank You!', 1)
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update : Scout Command
#--------------------------------------------------------------------------
def update_scout_command
# Moves Windows
@help_window.y += 10 if @help_window.y < 16
@gold_window.x -= 22 if @gold_window.x > 464
@scout_command.x -= 22 if @scout_command.x > 464
@scout_price_window.x -= 22 if @scout_price_window.x > 464
@main_command.x += 22 if @main_command.x < 640
@scout_list_window.x += 22 if @scout_list_window.x < 640
@character_profile_window.x -= 56 if @character_profile_window.x > - 432
# If Up or Down is Pressed
if Input.press?(Input::UP) || Input.press?(Input::DOWN)
# Gets Prices
if @scout_command.index == SCOUT_GROUPS.size
price = nil
else
group = SCOUT_GROUPS[@scout_command.index]
if @scouting
price = SCOUTING_PRICES.has_key?(group) ?
SCOUTING_PRICES[group] : DEFAULT_SCOUTING_PRICE
else
price = HIRING_PRICES.has_key?(group) ?
HIRING_PRICES[group] : DEFAULT_HIRING_PRICE
end
end
# Refreshes Scout Price Window
@scout_price_window.refresh(price)
end
# If B Button Is Pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Turns Off Scout Command
@scout_command.active = false
# Turns On Main Command
@main_command.active = true
# Sets Help Text
@help_window.set_text('Welcome to the Soilder Office', 1)
end
# If C button Is Pressed
if Input.trigger?(Input::C)
# If Back
if @scout_command.index == SCOUT_GROUPS.size
# Play Decision SE
$game_system.se_play($data_system.decision_se)
# Turns Off Scout Command
@scout_command.active = false
# Turns On Main Command
@main_command.active = true
# Sets Help Text
@help_window.set_text('Welcome to the Soilder Office', 1)
return
end
# Gets Scout Group
group = SCOUT_GROUPS[@scout_command.index]
# Souting
if @scouting
# Checks Price
price = SCOUTING_PRICES.has_key?(group) ?
SCOUTING_PRICES[group] : DEFAULT_SCOUTING_PRICE
if $game_party.gold < price
# Play Buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Set Help Text
@help_window.set_text('Cannot Afford to Scout from this Group', 1)
return
end
# Play Decision SE
$game_system.se_play($data_system.decision_se)
# Turns Off Scout Command
@scout_command.active = false
# Lose Gold
$game_party.lose_gold(price)
# Refresh Gold Window
@gold_window.refresh
# Gets Random Actor
actor = Character_Generator.generate_random_character(group)
# Adds Actor to Scout Report
$game_chargenerator.scout_character(group, actor)
# Refreshes Profile Window
@character_profile_window.refresh(actor)
@character_profile_window.active = true
# Sets Help Text
@help_window.set_text('Press B or C to Continue', 1)
# Hiring
else
# Turns Off Scout Command
@scout_command.active = false
# Play Decision SE
$game_system.se_play($data_system.decision_se)
# Refreshes Scout
@scout_list_window.refresh(group)
# Makes Active
@scout_list_window.active = true
# Refreshes Window
@character_profile_window.refresh(@scout_list_window.actor)
# Sets Help Text
@help_window.set_text('Select Troop To Hire', 1)
end
end
end
#--------------------------------------------------------------------------
# * Frame Update : Scout Viewing
#--------------------------------------------------------------------------
def update_scout_viewing
# Moves Windows
@help_window.y += 10 if @help_window.y < 16
@gold_window.x -= 22 if @gold_window.x > 464
@scout_price_window.x -= 22 if @scout_price_window.x > 464
@main_command.x += 22 if @main_command.x < 640
@character_profile_window.x += 56 if @character_profile_window.x < 16
# If B or C button is pressed
if Input.trigger?(Input::B) || Input.trigger?(Input::C)
# Play Decision SE
$game_system.se_play($data_system.decision_se)
# Turns Off Profile Window
@character_profile_window.active = false
# Turns On Main Command
@main_command.active = true
# Sets Help Text
@help_window.set_text('Welcome to the Soilder Office', 1)
end
end
#--------------------------------------------------------------------------
# * Frame Update : Hiring Command
#--------------------------------------------------------------------------
def update_hiring_command
# Moves Objects
@help_window.y += 10 if @help_window.y < 16
@gold_window.x -= 22 if @gold_window.x > 464
@scout_command.x += 22 if @scout_command.x < 640
@main_command.x += 22 if @main_command.x < 640
@scout_list_window.x -= 22 if @scout_list_window.x > 464
@scout_price_window.x -= 22 if @scout_price_window.x > 464
@character_profile_window.x += 56 if @character_profile_window.x < 16
# If Up or Down is pressed
if Input.press?(Input::UP) || Input.press?(Input::DOWN)
# Gets Actor
actor = @scout_list_window.actor
# Refreshes Window
@character_profile_window.refresh(actor)
end
# If A Button Is Pressed
if Input.trigger?(Input::A)
# If Back
if @scout_list_window.index == @scout_list_window.item_max - 1
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Gets Scout Group
group = SCOUT_GROUPS[@scout_command.index]
# Gets Index
index = @scout_list_window.index
# Deletes Actor
$game_chargenerator.scouted_characters[group].delete_at(index)
# Refreshes Windows
@scout_list_window.refresh(group)
# Refreshes Window
@character_profile_window.refresh(@scout_list_window.actor)
end
# If B Button Is Pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Turns On Main Command
@scout_command.active = true
# Turn off Scout List
@scout_list_window.active = false
# Sets Help Text
@help_window.set_text('Select Troop Group to Hire From', 1)
end
# If C buton is Pressed
if Input.trigger?(Input::C)
# If Back
if @scout_list_window.index == @scout_list_window.item_max - 1
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Turns On Scout Command
@scout_command.active = true
# Turn off Scout List
@scout_list_window.active = false
# Sets Help Text
@help_window.set_text('Select Troop Group to Hire From', 1)
return
end
# Checks Price
if $game_party.gold < @scout_price_window.price
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Sets Help Text
@help_window.set_text('Not Enough Gold', 1)
return
end
# Play Decision SE
$game_system.se_play($data_system.decision_se)
# Turn Off Scout List Command
@scout_list_window.active = false
# Lose Gold
$game_party.lose_gold(@scout_price_window.price)
# Refresh Gold Window
@gold_window.refresh
# Gets Group
group = SCOUT_GROUPS[@scout_command.index]
# Gets Random Actor
actor = $game_chargenerator.hire_character(group, @scout_list_window.index)
# Refreshes Profile Window
@character_profile_window.refresh(actor)
@character_profile_window.active = true
# Generates Character
Character_Generator.finialize_character(actor)
# Sets Help Text
@help_window.set_text('Press B or C to Continue', 1)
end
end
#--------------------------------------------------------------------------
# * Frame Update : Exit
#--------------------------------------------------------------------------
def update_exit
# Moves Out Objects
@help_window.y -= 10 if @help_window.y > - 64
@main_command.x += 22 if @main_command.x < 640
@gold_window.x += 22 if @gold_window.x < 640
@scout_command.x += 22 if @scout_command.x < 640
# Changes to Map Scene
$scene = Scene_Map.new unless @help_window.y > - 64
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
endDownload e ficha técnica
- Download (clique com o botão esquerdo do mouse ou toque no link)
- Desenvolvedor, publisher e/ou distribuidor: SephirothSpawn
- Sistema(s): Windows 98/98SE/Me/2000/XP/Vista/7
- Tamanho: 1,955 KB (pacote de instalação e/ou espaço em disco)
- Licença: Grátis
- Categoria: Programação XP
- Tag: RPG Maker XP
- Adicionado por: LichKing
- Acessos: 124
Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Acesse aqui e saiba como. Obrigado!
