Code:
#==============================================================================
# ** Character Select
#==============================================================================
# Raziel
# Version 1.1
# 2006-10-24
#------------------------------------------------------------------------------
# Instructions:
# Actor 1 - 7 are the actors in your database, so Actor1 = 1 means
# that the first character shown is the first actor in your database.
# Just exchange the numbers to change the actors
#
# Actor1_Text is the displayed text for the actor.
# You can write up to four lines.
# Only edit the lines within the module.
#
# To call it use $scene = Scene_CharacterSelect.new in a call script command
#==============================================================================
# ** Actor_Select module
#==============================================================================
# Changes can be done here
#------------------------------------------------------------------------------
module Actor_Select
# loading actor and classes
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
#----BEGIN EDIT-----
# select actors from your database
Actor1 = 1
Actor2 = 2
Actor3 = 3
Actor4 = 4
Actor5 = 5
Actor6 = 6
Actor7 = 7
# select your text to be shown when you select an actor
Selection_Text = "Do you want to choose this player?"
# text that will show your characters name, class and info
Actor1_Text = ["Name: " + $data_actors[Actor1].name,
"Class: " + $data_classes[$data_actors[Actor1].class_id].name,
"Info: ",
""]
Actor2_Text = ["Name: " + $data_actors[Actor2].name,
"Class: " + $data_classes[$data_actors[Actor2].class_id].name,
"Info: ",
""]
Actor3_Text = ["Name: " + $data_actors[Actor3].name,
"Class: " + $data_classes[$data_actors[Actor3].class_id].name,
"Info: ",
""]
Actor4_Text = ["Name: " + $data_actors[Actor4].name,
"Class: " + $data_classes[$data_actors[Actor4].class_id].name,
"Info: ",
""]
Actor5_Text = ["Name: " + $data_actors[Actor5].name,
"Class: " + $data_classes[$data_actors[Actor5].class_id].name,
"Info: ",
""]
Actor6_Text = ["Name: " + $data_actors[Actor6].name,
"Class: " + $data_classes[$data_actors[Actor6].class_id].name,
"Info: ",
""]
Actor7_Text = ["Name: " + $data_actors[Actor7].name,
"Class: " + $data_classes[$data_actors[Actor7].class_id].name,
"Info: ",
""]
# choose the actor's reating from 1 to 5
Actor1_Rating = 1
Actor2_Rating = 2
Actor3_Rating = 3
Actor4_Rating = 4
Actor5_Rating = 5
Actor6_Rating = 5
Actor7_Rating = 5
#se plays when you made your actor decision
SE = "056-Right02"
#background bgm plays during these scene
BGM = "013-Theme02"
#scene's background picture
Background = "" #background picture must be in the pictures folder
#change it to battler to show the battler
Graphic = "battler" #change it to character to show the character
end
#----STOP EDIT-----
#==============================================================================
# ** Window_CharacterChoose
#==============================================================================
class Window_CharacterChoose < Window_Selectable
attr_accessor :sprite
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.index = 0
self.opacity = 0
@column_max = 7
@item_max = 7
@sprite = 1
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 1..7
x2 = Actor_Select::Graphic == "character" ? i * 80 - 40 : i * 80 - 80
y2 = Actor_Select::Graphic == "character" ? 180 : 50
@back_sprite = eval("$data_actors[Actor_Select::Actor#{i}]")
bitmap2 = eval("RPG::Cache.#{Actor_Select::Graphic}(@back_sprite.#{Actor_Select::Graphic}_name, @back_sprite.#{Actor_Select::Graphic}_hue)")
bw2 = Actor_Select::Graphic == "character" ? bitmap2.width / 4 : bitmap2.width
bh2 = Actor_Select::Graphic == "character" ? bitmap2.height / 4 : bitmap2.height
self.contents.blt(x2, y2, bitmap2, Rect.new(0,0,bw2, bh2), 100)
end
x = Actor_Select::Graphic == "character" ? @sprite * 80 - 40 : @sprite * 80 - 80
@actor_sprite = eval("$data_actors[Actor_Select::Actor#{@sprite}]")
bitmap = eval("RPG::Cache.#{Actor_Select::Graphic}(@actor_sprite.#{Actor_Select::Graphic}_name, @actor_sprite.#{Actor_Select::Graphic}_hue)")
bw = Actor_Select::Graphic == "character" ? bitmap.width / 4 : bitmap.width
bh = Actor_Select::Graphic == "character" ? bitmap.height / 4 : bitmap.height
self.contents.blt(x, y2, bitmap, Rect.new(0,0,bw, bh))
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.empty
end
end
#==============================================================================
# ** Window_ShowText
#==============================================================================
class Window_ShowText < Window_Base
attr_accessor :actor_rating
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@actor_rating = 0
end
#--------------------------------------------------------------------------
# * Set Text
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text(text, align = 0)
@text = text
@align = align
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for text in @text
self.contents.font.color = normal_color
self.contents.draw_text(4, @text.index(text)*32, 640, 32, text, @align)
for y in 1..5
x = y * 32 + 420
bitmap = RPG::Cache.icon("rating_star")
self.contents.blt(x, 0, bitmap, Rect.new(0, 0,bitmap.width, bitmap.height), 25)
end
for i in 1..@actor_rating
x2 = i * 32 + 420
bitmap2 = RPG::Cache.icon("rating_star")
self.contents.blt(x2, 0, bitmap2, Rect.new(0, 0,bitmap2.width, bitmap2.height))
end
end
end
end
#==============================================================================
# ** Scene_CharacterSelect
#==============================================================================
class Scene_CharacterSelect
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
$game_temp.map_bgm = $game_system.playing_bgm
Audio.bgm_play("Audio/BGM/" + Actor_Select::BGM, 100, 100)
@background = Sprite.new
@background.bitmap = RPG::Cache.picture(Actor_Select::Background)
@text_window = Window_Base.new(145,0,350,64)
@text_window.contents = Bitmap.new(318, 32)
@text_window.contents.draw_text(4, 0, 350, 32, Actor_Select::Selection_Text)
@choice_window = Window_Command.new(160,["Yes", "No"])
@choice_window.x = 240
@choice_window.y = 64
@choice_window.z = 9998
@character_window = Window_CharacterChoose.new
@help_window = Window_ShowText.new
@help_window.y = 320
@help_window.height = 160
@text_window.visible = false
@choice_window.visible = false
@choice_window.active = false
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@character_window.dispose
@help_window.dispose
@choice_window.dispose
@text_window.dispose
@background.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@character_window.update
@help_window.update
@choice_window.update
@help_window.actor_rating = eval("Actor_Select::Actor#{@character_window.index + 1}_Rating")
if @character_window.active
update_character
return
elsif @choice_window.active
update_choice
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when character window is active)
#--------------------------------------------------------------------------
def update_character
eval("@help_window.set_text(Actor_Select::Actor#{@character_window.index + 1}_Text)")
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
Audio.bgm_stop
$game_system.bgm_play($game_temp.map_bgm)
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@choice_window.visible = true
@choice_window.active = true
@text_window.visible = true
@character_window.active = false
end
if Input.repeat?(Input::RIGHT)
unless @character_window.sprite == 7
@character_window.sprite += 1
end
@character_window.refresh
end
if Input.repeat?(Input::LEFT)
unless @character_window.sprite == 1
@character_window.sprite -= 1
end
@character_window.refresh
end
end
#--------------------------------------------------------------------------
# * Frame Update (when choice window is active)
#--------------------------------------------------------------------------
def update_choice
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@choice_window.active = false
@choice_window.visible = false
@choice_window.index = 0
@text_window.visible = false
@character_window.active = true
return
end
if Input.trigger?(Input::C)
case @choice_window.index
when 0
eval("$game_party.actors[0] = $game_actors[Actor_Select::Actor#{@character_window.index + 1}]")
Audio.se_play("Audio/SE/" + Actor_Select::SE)
$game_player.refresh
$scene = Scene_Map.new
Audio.bgm_stop
$game_system.bgm_play($game_temp.map_bgm)
when 1
$game_system.se_play($data_system.cancel_se)
@choice_window.active = false
@choice_window.visible = false
@choice_window.index = 0
@text_window.visible = false
@character_window.active = true
end
end
end
end