Alright. Version 2 of the actor selection tool is up. It has a couple nifty new features which I'll have to explain.
Basically, this script let's you select one of your party members from a list and will then store valueble information about the character in a variable that can be accessed by events ($game_variables.) It is called like this:
CODE
$scene = Scene_MemberSelect.new(use, var)
I should probably explain what the 2 variables do.
use is a string that controls what part of the character's data will be stored. Currently, "name" will store the character's name in a variable, "id" stores the character's id, and "party" store the character's position in the party (remember that the top position is 0!)
The second variable, var, determines which of the $game_variables will store the data. For example, seting use to "name" and var to 3 will store the selected character's name in $game_variables[3].
I have included a demo and a script. Unfortunatly, I don't have a good place to upload the demo onto the internet. Any sugestions? The script is as follows:
CODE
#==============================================================================
# ** Scene_Memberselect
#------------------------------------------------------------------------------
# This class allows you to select a party member from a menu.
#==============================================================================
class Scene_MemberSelect < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# use : what you want to store as a variable
# "name" : The character's name
# "id" : The character's id
# "party" : The character's party position
# var : The variable # to store it in
#--------------------------------------------------------------------------
def initialize(use, var)
$event_select = true
$use = use
$var = var
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@status_window = Window_MenuStatus.new(160, 0)
#Now for the command selection
s1 = "Status"
s2 = "Skills"
s3 = "Confirm"
@command_window = Window_Command.new(160, [s1, s2, s3])
hide_command_menu
start_actor_selection
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@status_window.dispose
@command_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@status_window.update
@command_window.update
if @command_window.active
update_command_selection
end
if @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# * Start Actor Selection
#--------------------------------------------------------------------------
def start_actor_selection
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# * End Actor Selection
#--------------------------------------------------------------------------
def end_actor_selection
@status_window.active = false
@status_window.index = -1
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Update Actor Selection
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::C)
#$game_party.last_actor_index = @status_window.index
Sound.play_decision
command_menu
end
end
#--------------------------------------------------------------------------
# * Hide Command Menu
#--------------------------------------------------------------------------
def hide_command_menu
@status_window.active = true
@command_window.active = false
@command_window.visible = false
@command_window.index = -1
end
#--------------------------------------------------------------------------
# * Start Command Menu
#--------------------------------------------------------------------------
def command_menu
@status_window.active = false
@command_window.active = true
@command_window.visible = true
@command_window.index = 0
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
hide_command_menu
@status_window.active = true
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when 0 # status
$scene = Scene_Status.new(@status_window.index)
when 1 # skills
$scene = Scene_Skill.new(@status_window.index, -1)
when 2 # confirm
store_information
end_actor_selection
end
end
end
#--------------------------------------------------------------------------
# * Store Information
#--------------------------------------------------------------------------
def store_information
case $use
when "name" #name
$game_variables[$var] = $game_party.members[@status_window.index].name
when "id" #id
$game_variables[$var] = $game_party.members[@status_window.index].id
when "party" #party position
$game_variables[$var] = @status_window.index
end
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs the skill screen processing.
#==============================================================================
class Scene_Skill < Scene_Base
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
if $event_select #If called from Memberselect
$scene = Scene_MemberSelect.new($use,$var)
else #If called from the menu
$scene = Scene_Menu.new(1)
end
end
end
#==============================================================================
# ** Scene_Status
#------------------------------------------------------------------------------
# This class performs the status screen processing.
#==============================================================================
class Scene_Status < Scene_Base
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
if $event_select #If called from Memberselect
$scene = Scene_MemberSelect.new($use,$var)
else #If called from the menu
$scene = Scene_Menu.new(3)
end
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
$event_select = false
end
end
Compatibility:
I would assume this is combatible with most scripts, although it might not work with scripts that change the instructions passed to the menu, but this can easily be patched.
Put the script above main, like most other online scripts.
Version Updates:
Unless someone has something they really want to see, this will be the final version.
This script is free to use, just be used to use my name to give me credit for it.
Final Notes: This is the first script I have made. Furute plans include a script that improves class changing, and introduces multiclassing (being more than one class) See you then.
This post has been edited by PK8: Sep 15 2012, 04:08 PM