First let me clarify, I'm not asking how to change actor pictures.
I'm looking for a simple script that shows custom actor pictures instead of the ones set in the Actor Database, only in the menu window.
Script is not intended to be used in a commercial game.
Other scripts used: modern algebra Integrated Reserve Party 1.0
I'm looking for a simple script that shows custom actor pictures instead of the ones set in the Actor Database, only in the menu window.
Script is not intended to be used in a commercial game.
Other scripts used: modern algebra Integrated Reserve Party 1.0
Code:
#==============================================================================
# Integrated Reserve Party
# Version 1.0d
# Author: modern algebra (rmrk.net)
# Date: June 11, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows you to have a reserve party. Basically, this means that
# it allows you to have a larger number of actors in the party than are
# active at any given time, and it allows the player to choose which actors
# are active. This is a system implemented in a number of games in the
# Final Fantasy series, as well as the Tales series and numerous other RPGs.
# Characters in reserve can be swapped into the active party by the player at
# any time and vice versa.
#
# As the game maker, you have a number of options to limit this. You can set
# a minimum size for the active party, so if you wish the player cannot have
# fewer than whatever number you set, and as well you can set a maximum size
# for the reserve party. Further, you can set the percentage of exp received
# by characters in the reserve party, thus allowing you to limit how much exp
# is received by characters not in the active party. You can also lock
# individual actors to either the active party or the reserve.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Place above Main and below all other custom scripts in the Script editor.
#
# To change the default configuration, go to line x and read the descriptions
# to see what they do.
#
# There are a number of codes you can use in a call script. They are:
#
# lock_to_active_party (actor_id)
# actor_id : The ID of the actor who can only be in Active Party
# lock_to_reserve_party (actor_id)
# actor_id : The ID of the actor who can only be in Reserve Party
# unlock_actor_party (actor_id)
# actor_id : The ID of the actor you no longer want locked to a Party
# change_active_minimum (new_minimum)
# new_minimum : the new minimum number of actors in the active party
# change_reserve_maximum (new_maximum)
# new_maximum : the new maximum number of actors allowed in reserve
# toggle_party_access (boolean)
# boolean : true => enable, false => disable; if left blank, will toggle
#==============================================================================
#==============================================================================
# CONSTANTS
#==============================================================================
PARTY_CHANGE_RESERVE_EXP_PERCENT = 80 # Percentage of EXP received by reserve actors
PARTY_CHANGE_MENU_INDEX = 5 # The position of the Party option in Menu
PARTY_CHANGE_LABEL = "Party" # The label of the Party option in Menu
PARTY_CHANGE_MIN_ACTIVE_SIZE = 1 # The minimum number of actors in active
PARTY_CHANGE_MAX_RESERVE_SIZE = 4 # The maximum size of reserve party
PARTY_CHANGE_LOCK_ICON_INDEX = 80 # The icon to draw for locked actors
#==============================================================================
# ** Game Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new accessor instance variable - reserve_exp_percent
# aliased method - index, setup
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :reserve_exp_percent
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Setup
# actor_id : actor ID
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modernalgebra_resrv_party_stup_resrvexp_52b4 setup
def setup(actor_id)
# Run Original Method
modernalgebra_resrv_party_stup_resrvexp_52b4 (actor_id)
@reserve_exp_percent = PARTY_CHANGE_RESERVE_EXP_PERCENT
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Index
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias molge_rsrv_prty_indx_actr_7b53 index
def index
if $game_party.ma_reserve_actors.include? (@actor_id)
size = $game_party.ma_draw_party_space ? $game_party.ma_max_active_size : $game_party.actors.size
return size + $game_party.ma_reserve_actors.index (@actor_id)
else
return molge_rsrv_prty_indx_actr_7b53
end
end
end
#==============================================================================
# ** Game Party
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new public instance variables : ma_reserve_actors, ma_min_active_size,
# ma_max_reserve_size, ma_locked_actors, actors, ma_party_access,
# ma_locked_actors
# aliased methods - initialize, add_actor, remove_actor, members
# new methods - lock_party, unlock_party, add_to_active, remove_from_active,
# switch_actors_by_index, ma_reserve_members
#==============================================================================
class Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :actors
attr_reader :ma_reserve_actors
attr_reader :ma_locked_actors
attr_accessor :ma_max_active_size
attr_accessor :ma_min_active_size
attr_accessor :ma_max_reserve_size
attr_accessor :ma_return_reserve_members
attr_accessor :ma_draw_party_space
attr_accessor :ma_party_access
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdagr_init_resrv_prt_trvst1 initialize
def initialize
# Run Original Method
mdagr_init_resrv_prt_trvst1
# Initialize Variables
@ma_reserve_actors = []
@ma_max_active_size = MAX_MEMBERS
@ma_min_active_size = PARTY_CHANGE_MIN_ACTIVE_SIZE
@ma_max_reserve_size = PARTY_CHANGE_MAX_RESERVE_SIZE
@ma_locked_actors = []
@ma_party_access = true
@ma_return_reserve_members = false
@ma_draw_party_space = false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Add an Actor
# actor_id : actor ID
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malg_plus_actr_resrv_pty add_actor
def add_actor(actor_id)
# Do nothing if actor in reserve
if !@ma_reserve_actors.include? (actor_id)
# Run Original Method
malg_plus_actr_resrv_pty (actor_id)
if !@actors.include?(actor_id) && @ma_reserve_actors.size < @ma_max_reserve_size
@ma_reserve_actors.push (actor_id)
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Remove Actor
# actor_id : actor ID
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_rmv_actr_pary_reseve_orn54 remove_actor
def remove_actor(actor_id)
@ma_reserve_actors.delete (actor_id)
@ma_locked_actors.delete (actor_id)
# Run Original Method
modalg_rmv_actr_pary_reseve_orn54 (actor_id)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Members
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnlg_membrs_reserve_party_scrpt_8un5 members
def members (return_reserve = nil)
@ma_return_reserve_members = return_reserve if return_reserve != nil
mmbrs = mdrnlg_membrs_reserve_party_scrpt_8un5
return mmbrs + ma_reserve_members if @ma_return_reserve_members
return mmbrs
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Reserve Members
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_reserve_members
result = []
@ma_reserve_actors.each { |i| result.push($game_actors[i]) }
return result
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Lock Party
# *args - indices to lock
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_lock_party (*args)
args.each { |i| @ma_locked_actors.push (i) if !@ma_locked_actors.include? (i) }
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Unlock Party
# *args - indices to unlock
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_unlock_party (*args)
args.each { |i| @ma_locked_actors.delete (i) }
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Add To Active Party
# actor_id : The ID of Actor being moved
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_add_to_active (actor_id, insert_index = nil)
return true if actor_id == nil
return false if @ma_locked_actors.include? (actor_id)
return false unless @ma_reserve_actors.include? (actor_id)
return false if @actors.size >= @ma_max_active_size
insert_index = @actors.size if insert_index == nil ||
insert_index > @actors.size
@ma_reserve_actors.delete (actor_id)
@actors.insert (insert_index, actor_id)
return true
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Remove From Active Party
# actor_id : The ID of Actor being moved
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_remove_from_active (actor_id, insert_index = nil)
# If Character not in Party, do nothing
return true if actor_id == nil
return false if @ma_locked_actors.include? (actor_id)
return false unless @actors.include? (actor_id)
return false if @ma_reserve_actors.size >= @ma_max_reserve_size
insert_index = @ma_reserve_actors.size if insert_index == nil ||
insert_index > @ma_reserve_actors.size
# Remove Actor from actors
@actors.delete (actor_id)
@ma_reserve_actors.insert (insert_index, actor_id)
return true
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Switch Actors By Index
# active_index : the index in the active party
# reserve_index : the index in the reserve party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_switch_actors_by_index (active_index, reserve_index)
return false if @ma_locked_actors.include? (@actors[active_index]) ||
@ma_locked_actors.include? (@ma_reserve_actors[reserve_index]) ||
(reserve_index > @ma_reserve_actors.size &&
active_index < @actors.size && @actors.size <= @ma_min_active_size)
@ma_max_reserve_size += 1
reserve_actor_id = @ma_reserve_actors[reserve_index]
removable = ma_remove_from_active (@actors[active_index], reserve_index)
ma_add_to_active (reserve_actor_id, active_index ) if removable
@ma_max_reserve_size -= 1
$game_player.refresh if active_index == 0
return removable
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Switch Actor Order
# array_boolean : true => @actors; false => @ma_reserve_actors
# index1 : the first actor to change
# index2 : the second actor to change
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_switch_actor_order (array_boolean, index1, index2)
# Get array
array = array_boolean ? @actors : @ma_reserve_actors
# Set indices in order
if index1 < index2
i1, i2 = index1, index2
else
i1, i2 = index2, index1
end
# Check if both slots are empty
return false if i1 >= array.size
val = array[i1]
# If one slot is empty, place other at end of array
if i2 >= array.size
# Remove index2 from order and place at
array.delete_at (i1)
array.push (val)
else # Both slots chosen are actors
val2 = array[i2]
# Delete i2 and insert i1
array.delete_at (i2)
array.insert (i2, val)
# Delete i1 and insert i2
array.delete_at (i1)
array.insert (i1, val2)
end
$game_player.refresh if i1 == 0 && array == @actors
end
end
#==============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new methods - lock_to_active_party, lock_to_reserve_party,
# unlock_actor_party, change_active_minimum, change_reserve_maximum
#==============================================================================
class Game_Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Lock To Active Party
# actor_id : ID of actor to lock to active party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def lock_to_active_party (actor_id)
# If actor not in party, do nothing
return if actor_id == nil || (!$game_party.actors.include? (actor_id) &&
!$game_party.ma_reserve_actors.include? (actor_id))
if $game_party.ma_reserve_actors.include? (actor_id)
# Delete from locked actors in case previously locked to reserve
$game_party.ma_locked_actors.delete (actor_id)
# If no room in active party
unless $game_party.ma_add_to_active (actor_id)
# Get index in whichever array actor resides
r_index = $game_actors[actor_id].index - $game_party.actors.size
a_index = nil
# Switch first actor not locked out of party
for id in $game_party.actors.reverse
next if $game_party.ma_locked_actors.include? (id)
a_index = $game_actors[id].index
break
end
return if a_index == nil
$game_party.ma_switch_actors_by_index (a_index, r_index)
end
else
return if $game_party.ma_locked_actors.include? (actor_id)
end
# Lock actor
$game_party.ma_lock_party (actor_id)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Lock To Reserve Party
# actor_id : ID of actor to lock to reserve party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def lock_to_reserve_party (actor_id)
# If actor not in party, do nothing
return if actor_id == nil || (!$game_party.actors.include? (actor_id) &&
!$game_party.ma_reserve_actors.include? (actor_id))
if $game_party.actors.include? (actor_id)
# Delete from locked actors in case previously locked to active
$game_party.ma_locked_actors.delete (actor_id)
# If no room in reserve party
unless $game_party.ma_remove_from_active (actor_id)
# Get index in whichever array actor resides
a_index = $game_actors[actor_id].index
r_index = nil
# Switch first actor not locked out of party
for id in $game_party.ma_reserve_actors.reverse
next if $game_party.ma_locked_actors.include? (id)
r_index = $game_actors[id].index - $game_party.actors.size
break
end
return if r_index == nil
$game_party.ma_switch_actors_by_index (a_index, r_index)
end
else
return if $game_party.ma_locked_actors.include? (actor_id)
end
# Lock actor
$game_party.ma_lock_party (actor_id)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Unlock Actor Party
# actor_id : ID of actor to unlock
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def unlock_actor_party (actor_id)
$game_party.ma_unlock_party (actor_id)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Change Active Minimum
# val : new minimum value for party size
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def change_active_minimum (val)
$game_party.ma_min_active_size = val
# Restore Active Party to minimum size if necessary
while $game_party.actors.size < val && !$game_party.ma_reserve_actors.empty?
$game_party.ma_add_to_active ($game_party.ma_reserve_actors[0])
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Change Reserve Maximum
# val : new maximum value for reserve party size
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def change_reserve_maximum (val)
$game_party.ma_max_reserve_size = val
while $game_party.ma_reserve_actors.size > val && $game_party.actors.size < $game_party.ma_max_active_size
$game_party.ma_add_to_active ($game_party.ma_reserve_actors[0])
end
# If still actors, remove them
if $game_party.ma_reserve_actors.size > val
lost_actors = $game_party.ma_reserve_actors[val, $game_party.ma_reserve_actors.size - val]
lost_actors.each { |id| $game_party.remove_actor (id) }
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Disable/enable Party Switching
# boolean : true => enable, false => disable, nil => toggle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def toggle_party_access (boolean = nil)
$game_party.ma_party_access = boolean == nil ? !$game_party.ma_party_access : boolean
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Actor iterator (ID)
# param : If 1 or more, ID. If 0, all
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdnagr_itrt_actrid_party_resrv_52g4 iterate_actor_id
def iterate_actor_id (*args)
$game_party.ma_return_reserve_members = true
mdnagr_itrt_actrid_party_resrv_52g4 (*args) do |actor|
yield actor
end
$game_party.ma_return_reserve_members = false
end
end
#==============================================================================
# ** Sprite MenuActorsDisabled
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This class draws a sprite over disabled actors for the reserve party.
#==============================================================================
class Sprite_MenuActorsDisabled < Sprite
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Initialize
# coordinates
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (y)
viewport = Viewport.new (0, 0, 544, 400)
viewport.z = 120
super (viewport)
create_bitmap (false, y)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Create Bitmap
# reserve_input : whether or not it is changing party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def create_bitmap (reserve_input = false, y = self.y)
return if $game_party.ma_reserve_actors.size == 0 && !reserve_input
self.bitmap.dispose if (self.bitmap != nil && !self.bitmap.disposed?)
size = reserve_input ? $game_party.ma_max_reserve_size : $game_party.ma_reserve_actors.size
self.bitmap = Bitmap.new (352, size*96)
disabled_colour = Color.new (127, 127, 127, 105)
self.bitmap.fill_rect (0, 0, 352, size*96, disabled_colour)
self.x = 176
self.y = y
self.blend_type = 2
end
end
#==============================================================================
# ** Window_Command
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new instance variable - ma_disabled_commands
# aliased method - initialize, draw_item
#==============================================================================
class Window_Command
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :ma_disabled_commands
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Initialize
# width : window width
# commands : command string array
# column_max : digit count (if 2 or more, horizontal selection)
# row_max : row count (0: match command count)
# spacing : blank space when items are arrange horizontally
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrbra_intgrte_prtychng_menu_init_74b2 initialize
def initialize(*args)
# Initialize new instance variable
@ma_disabled_commands = []
# Run Original Method
mdrbra_intgrte_prtychng_menu_init_74b2 (*args)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Draw Item
# index : item number
# enabled : enabled flag. When false, draw semi-transparently
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mrnalr_prtchng_intgrtin_menu_drw_itm_6gb3 draw_item
def draw_item (index, enabled = true)
# Run Original Method
mrnalr_prtchng_intgrtin_menu_drw_itm_6gb3 (index, enabled)
enabled ? @ma_disabled_commands.delete (index) : @ma_disabled_commands.push (index)
end
end
#==============================================================================
# ** Window_MenuStatus
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# overwritten super method - create_contents, top_row, top_row=
# aliased method - refresh, update_cursor
#==============================================================================
class Window_MenuStatus < Window_Selectable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Create Window Contents
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def create_contents (reserve_input = false)
self.contents.dispose
if reserve_input
@scrn_item_max = $game_party.ma_max_reserve_size + Game_Party::MAX_MEMBERS
else
$game_party.ma_return_reserve_members = true
@scrn_item_max = $game_party.members.size
$game_party.ma_return_reserve_members = false
end
self.contents = Bitmap.new(width - 32, @scrn_item_max * 96)
refresh (reserve_input)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_reserve_prty_rfrsh_menu refresh
def refresh (reserve_input = false)
$game_party.ma_draw_party_space = reserve_input
$game_party.ma_return_reserve_members = true
# Run Original Method with Reserve Members
modalg_reserve_prty_rfrsh_menu ()
# For all locked actors, draw an icon
$game_party.ma_locked_actors.each { |actor_id|
index = $game_actors[actor_id].index
draw_icon (PARTY_CHANGE_LOCK_ICON_INDEX, self.contents.width - 32, index*96 + 8)
}
$game_party.ma_return_reserve_members = false
$game_party.ma_draw_party_space = false
@item_max = @scrn_item_max
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Cursor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modlg_upd_csor_reserve_prty_9rn3 update_cursor
def update_cursor
@index -= top_row
# Run Original Method
modlg_upd_csor_reserve_prty_9rn3
@index += top_row
# Scroll
row = (@index > 100 ? (@index - 100) : @index) / @column_max # Get current row
if row < top_row # If before the currently displayed
self.top_row = row # Scroll up
end
if row > top_row + 3 # If after the currently displayed
self.top_row = row - 3 # Scroll down
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Top Row
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def top_row
return self.oy / 96
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Set Top Row
# row : row shown on top
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def top_row=(row)
old_oy = self.oy
row = 0 if row < 0
row = row_max - 1 if row > row_max - 1
self.oy = row * 96
end
end
#==============================================================================
# ** Window Blank Cursor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This window draws a cursor over a selected actor.
#==============================================================================
class Window_BlankCursor < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize
super(160, 0, 384, 128)
self.visible = false
self.opacity = 0
self.cursor_rect.set(0, 0, contents.width, 96)
end
end
#==============================================================================
# ** Scene Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - display_level_up
#==============================================================================
class Scene_Battle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Display Level Up
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malgbr_rsrvprty_expgn_dsply_lvlup_9gg2 display_level_up
def display_level_up
for actor in $game_party.ma_reserve_members
last_level = actor.level
last_skills = actor.skills
actor.gain_exp(($game_troop.exp_total*actor.reserve_exp_percent) / 100, true)
end
# Run Original Method
malgbr_rsrvprty_expgn_dsply_lvlup_9gg2
end
end
#==============================================================================
# ** Scene_Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - start, determine_target, next_actor, prev_actor
#==============================================================================
class Scene_Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Start Processing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modnalbr_resepar_strt_7vs2 start
def start (*args)
$game_party.ma_return_reserve_members = true
modnalbr_resepar_strt_7vs2 (*args)
$game_party.ma_return_reserve_members = false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Determine Target
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnalbr_rsrvprty_trgtdtrmnt_8b53 determine_target
def determine_target (*args)
$game_party.ma_return_reserve_members = true
mdrnalbr_rsrvprty_trgtdtrmnt_8b53 (*args)
$game_party.ma_return_reserve_members = false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Switch to Next Actor Screen
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias algebramdrn_partvr_nxtactor_9k32 next_actor
def next_actor (*args)
$game_party.ma_return_reserve_members = true
algebramdrn_partvr_nxtactor_9k32 (*args)
$game_party.ma_return_reserve_members = false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Switch to Previous Actor Screen
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_reserveparty_prevactor_4nm2 prev_actor
def prev_actor (*args)
$game_party.ma_return_reserve_members = true
modalg_reserveparty_prevactor_4nm2 (*args)
$game_party.ma_return_reserve_members = false
end
end
#==============================================================================
# ** Scene_Item
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - determine_target
#==============================================================================
class Scene_Item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Determine Target
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalga_dtrmtrgt_reserveparty_74b3 determine_target
def determine_target (*args)
$game_party.ma_return_reserve_members = true
modalga_dtrmtrgt_reserveparty_74b3 (*args)
$game_party.ma_return_reserve_members = false
end
end
#==============================================================================
# ** Scene Menu
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - initialize, start, terminate, update_actor_selection,
# update
# new methods - ma_start_party_switch
#==============================================================================
class Scene_Menu < Scene_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_rrve_party_init_scene_h43 initialize
def initialize (*args)
@selected_index = -1
$game_party.ma_return_reserve_members = false
@switching_party = false
# Run Original Method
ma_rrve_party_init_scene_h43 (*args)
if @menu_index >= PARTY_CHANGE_MENU_INDEX
@menu_index += 1
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Start Processing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias moag_5nd_rsrv_prty_strt start
def start
# Run Original Method
moag_5nd_rsrv_prty_strt
y = $game_party.members.size*96 + 16
@disabledactors_sprite = Sprite_MenuActorsDisabled.new (y)
@selected_actorcursor = Window_BlankCursor.new
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Termination Processing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_prty_reserve_term_sdpdprites terminate
def terminate
# Run Original Method
modalg_prty_reserve_term_sdpdprites
# Dispose disable sprite
@disabledactors_sprite.dispose
@selected_actorcursor.dispose
$game_party.ma_return_reserve_members = false if $scene.is_a? (Scene_Map)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Frame Update
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_frm_upd_resrv_prty_94n5 update
def update
top_row = @status_window.top_row
# Run Original Method
modalg_frm_upd_resrv_prty_94n5
if top_row != @status_window.top_row
s = @switching_party ? $game_party.ma_max_active_size : $game_party.members.size
@disabledactors_sprite.y = (s - @status_window.top_row)*96 + 16
@selected_actorcursor.y = @selected_index*96 - @status_window.oy
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Actor Selection
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_resev_prty_upd_actr_selct update_actor_selection
def update_actor_selection
# If in Party switching mode
if @switching_party
# If exiting the scene
if Input.trigger? (Input::B)
Sound.play_cancel
# If no other position selected already, exit party arrangement
if @selected_index == -1
@status_window.create_contents (false)
y = ($game_party.members.size - @status_window.top_row)*96 + 16
@disabledactors_sprite.create_bitmap (false, y)
@switching_party = false
end_actor_selection
else
# Remove previously selected index
@selected_index = -1
@selected_actorcursor.visible = false
end
# If an actor is selected
elsif Input.trigger? (Input::C)
index = @status_window.index
# If selecting previously selected slot
if index == @selected_index
Sound.play_cancel
@selected_index = -1
@selected_actorcursor.visible = false
return
end
# If selecting from a reserve slot
if index >= $game_party.ma_max_active_size
ma_select_reserve (index)
else # If selecting from active party
ma_select_active (index)
end
end
else
changed = false
if @command_window.index > PARTY_CHANGE_MENU_INDEX
@command_window.index = (@command_window.index - 1) % @command_window.commands.size
changed = true
end
# Run Original Method
modalg_resev_prty_upd_actr_selct
@command_window.index = (@command_window.index + 1) % @command_window.commands.size if changed
$game_party.ma_return_reserve_members = true unless $scene.is_a? (Scene_Menu)
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Create Command Window
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnaba_prtychn_intgr_menu_crt_cmnd_window_8hb3 create_command_window
def create_command_window
mdrnaba_prtychn_intgr_menu_crt_cmnd_window_8hb3
# Get commands from the command window
c = @command_window.commands
# Add Party Change Command
c.insert (PARTY_CHANGE_MENU_INDEX, PARTY_CHANGE_LABEL)
width = @command_window.width
disabled = @command_window.ma_disabled_commands
@command_window.dispose
@command_window = @command_window.class.new(width, c)
@command_window.index = @menu_index
# Disable all of the old commands as well
disabled.each { |i|
i += 1 if i >= PARTY_CHANGE_MENU_INDEX
@command_window.draw_item (i, false)
}
# Draw Disabled if Party Changer disabled
if ($game_party.ma_reserve_actors.empty? && $game_party.actors.size <= 1) ||
!$game_party.ma_party_access
@command_window.draw_item (PARTY_CHANGE_MENU_INDEX, false)
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Command Selection
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modrnalg_prtychng_updcmndslect_62n4 update_command_selection
def update_command_selection
changed = false
if Input.trigger? (Input::C) && @command_window.index == PARTY_CHANGE_MENU_INDEX
# If Party Change is disabled
if ($game_party.ma_reserve_actors.empty? && $game_party.actors.size <= 1) ||
!$game_party.ma_party_access
Sound.play_buzzer
else
# Open Quest Window
Sound.play_decision
ma_start_party_switch
end
return
end
# If the command index is greater than it ought to be, make sure
if @command_window.index > PARTY_CHANGE_MENU_INDEX
@command_window.index = (@command_window.index - 1) % @command_window.commands.size
changed = true
end
modrnalg_prtychng_updcmndslect_62n4
@command_window.index = (@command_window.index + 1) % @command_window.commands.size if changed
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Select Reserve
# index : the index selected
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_select_reserve (index)
# If another slot from reserve already picked.
if @selected_index >= $game_party.ma_max_active_size
Sound.play_decision
# Switch actor order
$game_party.ma_switch_actor_order (false, @selected_index - $game_party.ma_max_active_size, index - $game_party.ma_max_active_size)
ma_start_party_switch
return
end
# If selecting an empty slot:
if index - $game_party.ma_max_active_size >= $game_party.ma_reserve_actors.size
# If no other option already selected.
if @selected_index == -1
Sound.play_decision
@selected_index = index
@selected_actorcursor.y = index*96 - @status_window.oy
@selected_actorcursor.visible = true
else # If selecting a reserve member
# If other selected slot also empty
if @selected_index >= $game_party.actors.size
Sound.play_decision
@selected_index = -1
@selected_actorcursor.visible = false
else
# If successful switch
if $game_party.ma_switch_actors_by_index (@selected_index, index - $game_party.ma_max_active_size)
Sound.play_decision
ma_start_party_switch
else
Sound.play_buzzer
end
end
end
else # If actor slot selected
# If active slot not already selected
if @selected_index == -1
Sound.play_decision
# Set as selected and choose next
@selected_index = index
@selected_actorcursor.y = index*96 - @status_window.oy
@selected_actorcursor.visible = true
else # If an active slot already picked
# If successful switch
if $game_party.ma_switch_actors_by_index (@selected_index, index - $game_party.ma_max_active_size)
Sound.play_decision
ma_start_party_switch
else
Sound.play_buzzer
end
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Select Active
# index : the index selected
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_select_active (index)
# If another slot from active already picked.
if @selected_index != -1 && @selected_index < $game_party.ma_max_active_size
Sound.play_decision
# Switch actor order
$game_party.ma_switch_actor_order (true, @selected_index, index)
ma_start_party_switch
return
end
# If selecting an empty slot:
if index >= $game_party.actors.size
# If no other option already selected.
if @selected_index == -1
Sound.play_decision
@selected_index = index
@selected_actorcursor.y = index*96 - @status_window.oy
@selected_actorcursor.visible = true
else
# If other selected slot also empty
if @selected_index >= $game_party.ma_max_active_size + $game_party.ma_reserve_actors.size
Sound.play_decision
@selected_index = -1
@selected_actorcursor.visible = false
else
# If successful switch
if $game_party.ma_switch_actors_by_index (index, @selected_index - $game_party.ma_max_active_size)
Sound.play_decision
ma_start_party_switch
else
Sound.play_buzzer
end
end
end
else # If actor slot selected
# If reserve slot not already selected
if @selected_index == -1
Sound.play_decision
# Set autocursor and choose next actor
@selected_index = index
@selected_actorcursor.y = index*96 - @status_window.oy
@selected_actorcursor.visible = true
else # If a reserve slot already picked
# If successful switch
if $game_party.ma_switch_actors_by_index (index, @selected_index - $game_party.ma_max_active_size)
Sound.play_decision
ma_start_party_switch
else
Sound.play_buzzer
end
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Start Party Switch
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_start_party_switch
@selected_index = -1
status_index = @status_window.index
@selected_actorcursor.visible = false
@status_window.create_contents (true)
y = ($game_party.ma_max_active_size - @status_window.top_row)*96 + 16
@disabledactors_sprite.create_bitmap (true, y)
@switching_party = true
@status_window.active = true
@status_window.index = status_index < 0 ? 0 : status_index
@command_window.active = false
end
end