Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #------------------------------------------------------------------------------
- # Lizzie S Party Changer for RMVXA
- #
- # This script is recreated from scratch on RGSS3 to mimic Lizzie S's Party
- # Changer script on RMXP.
- #
- # https://burningwizard.wordpress.com/2015/02/15/party-changer-menu-script-rmvxace-rgss3/
- #------------------------------------------------------------------------------
- =begin
- #==============================================================================
- # MIT License
- #==============================================================================
- Copyright 2015-2024 Black Mage
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the “Software”), to deal in
- the Software without restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
- Software, and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- #==============================================================================
- =end
- #==============================================================================
- # Changelog
- #==============================================================================
- # Version 1.3
- # – Fix a bug where the reserve party is missing upon loading a save file.
- # – Fixing more bugs.
- # – Tidying up the script.
- #
- # Version 1.2
- # - Make the script to be able to replace the default Formation menu.
- #
- # Version 1.1
- # - Add Face Mode.
- #
- # Version 1.0
- # - Initial version.
- #==============================================================================
- #-------------------------------------------------------------------------------
- # Settings
- #-------------------------------------------------------------------------------
- module BM_Party_Changer
- DisplayMode = 0
- # Put 0 to use walking sprite instead of face.
- # Put 1 to use face instead of walking sprite.
- # Set this to true to replace the Formation option from main menu to Party
- # Changer.
- ReplaceFormation = true
- end
- # End of Settings -------------------------------------------------------------
- #------------------------------------------------------------------------------
- # * Beyond this is the sacred land of code. You need programming qualification
- # to dwelve deeper, or it'll cause many unnecessary problems. Proceed on your
- # own risk.
- #------------------------------------------------------------------------------
- #------------------------------------------------------------------------------
- # * Initialize
- #------------------------------------------------------------------------------
- class Game_System
- attr_accessor :partylock
- attr_accessor :partychanger
- alias bm_party_changer_init initialize
- def initialize
- bm_party_changer_init; @partylock = []; @partychanger = []
- end
- end
- #------------------------------------------------------------------------------
- #------------------------------------------------------------------------------
- # * Change Formation Option to Party Changer.
- #------------------------------------------------------------------------------
- class Window_MenuCommand < Window_Command
- alias b_party_form_enabled formation_enabled
- def formation_enabled
- if BM_Party_Changer::ReplaceFormation
- return party_enabled
- else
- return b_party_form_enabled
- end
- end
- def party_enabled
- $game_party.members.size >= 1 && !$game_system.formation_disabled
- end
- end
- class Scene_Menu < Scene_MenuBase
- alias b_party_command_formation command_formation
- def command_formation
- if BM_Party_Changer::ReplaceFormation
- SceneManager.call(Scene_Changer)
- else
- b_party_command_formation
- end
- end
- end
- #------------------------------------------------------------------------------
- #------------------------------------------------------------------------------
- # * Scene Changer.
- #------------------------------------------------------------------------------
- class Scene_Changer < Scene_MenuBase
- def initialize; end
- def start
- super
- create_help_party_window
- create_current_party_window
- current_party_check
- create_reserve_party_window
- @current_party_window.activate
- @current_party_window.select(0)
- @current_party_window.refresh
- end
- def current_party_check
- $game_party.members.size.times {|i| party_check(i)}
- end
- def party_check(index)
- $game_system.partychanger[$game_party.members[index].id - 1] == true
- end
- def create_help_party_window
- @party_help_window = Window_Help.new(1)
- @party_help_window.set_text('Choose your party.')
- end
- def create_current_party_window
- wy = @party_help_window.height
- wh = Graphics.height - wy
- @current_party_window = Window_CurrentParty.new(0, wy, (Graphics.width)/2, wh)
- @current_party_window.viewport = @viewport
- @current_party_window.set_handler(:ok, method(:current_party_ok))
- @current_party_window.set_handler(:cancel, method(:current_party_cancel))
- end
- def current_party_cancel; SceneManager.return; end
- def current_party_ok
- if $game_party.members[@current_party_window.index].nil?
- @reserve_party_window.activate
- @reserve_party_window.select(0)
- @current_party_window.index
- elsif $game_system.partylock[$game_party.members[@current_party_window.index].id - 1] == true
- Sound.play_buzzer
- @current_party_window.activate
- @current_party_window.select(@current_party_window.index)
- elsif $game_party.members.size == 1 && @current_party_window.index == 0
- Sound.play_buzzer
- @current_party_window.activate
- @current_party_window.select(@current_party_window.index)
- else
- @reserve_party_window.activate
- @reserve_party_window.select(0)
- @current_party_window.index
- end
- end
- def create_reserve_party_window
- wy = @party_help_window.height
- wh = Graphics.height - wy
- @reserve_party_window = Window_ReserveParty.new((Graphics.width)/2, wy, (Graphics.width)/2, wh)
- @reserve_party_window.viewport = @viewport
- @reserve_party_window.refresh
- @reserve_party_window.set_handler(:ok, method(:reserve_party_ok))
- @reserve_party_window.set_handler(:cancel, method(:reserve_party_cancel))
- end
- def reserve_party_cancel
- @reserve_party_window.select(-1)
- @reserve_party_window.deactivate
- @current_party_window.activate
- @current_party_window.select(@current_party_window.index)
- end
- def reserve_party_ok
- if @reserve_party_window.data(@reserve_party_window.index).nil?
- reserve_end_method
- elsif $game_system.partylock[@reserve_party_window.data(@reserve_party_window.index).id - 1] == true
- Sound.play_buzzer
- @reserve_party_window.activate
- @reserve_party_window.select(@reserve_party_window.index)
- else
- reserve_end_method
- end
- end
- def reserve_end_method
- @party = []
- @partytemp = []
- for i in 1..$game_party.members.size
- @party[i-1] = $game_party.members[i-1].id
- @partytemp[i-1] = $game_party.members[i-1].id
- end
- if @reserve_party_window.data(@reserve_party_window.index).nil?
- @party[@current_party_window.index] = nil
- @party2 = []
- for i in 0..@party.size
- @party2.push(@party[i]) if !@party[i].nil?
- end
- @party = @party2
- else
- @party[@current_party_window.index] = @reserve_party_window.data(@reserve_party_window.index).id
- end
- for i in 1..@partytemp.size
- $game_party.remove_actor($game_actors[@partytemp[i-1]].id)
- end
- for i in 1..@party.size
- $game_party.add_actor(@party[i-1])
- end
- @current_party_window.refresh
- @reserve_party_window.refresh
- @reserve_party_window.select(0)
- @reserve_party_window.select(-1)
- @reserve_party_window.deactivate
- @current_party_window.activate
- @current_party_window.select(@current_party_window.index)
- end
- end
- #------------------------------------------------------------------------------
- # * Current Party Window.
- #------------------------------------------------------------------------------
- class Window_CurrentParty < Window_Selectable
- def initialize(x, y, width, height); super; @data = []; end
- def line_height; 86; end
- def item_max
- if $game_party.members.size == 4
- $game_party.members.size
- else
- ($game_party.members.size) + 1
- end
- end
- def draw_all_items; item_max.times {|i| draw_item(i)}; end
- def draw_item(index)
- @actor = $game_party.members[index]
- if !@actor.nil?
- mode = BM_Party_Changer::DisplayMode
- case mode
- when 0
- x_pos = 60; draw_actor_graphic(@actor, 30, index*86 + 60)
- when 1
- x_pos = 90; draw_actor_face(@actor, 2, index*86 + 2)
- end
- draw_actor_name(@actor, x_pos, index*86 - 16)
- draw_actor_level(@actor, x_pos, index*86 + 16)
- end
- end
- # Draw Face Custom
- def draw_face(face_name, face_index, x, y, enabled = true)
- bitmap = Cache.face(face_name)
- rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 82, 82)
- contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
- bitmap.dispose
- end
- def draw_actor_name(actor, x, y, width = 112)
- if $game_system.partylock[@actor.id - 1]
- change_color(normal_color, false)
- else
- change_color(hp_color(actor))
- end
- draw_text(x, y, width, line_height, actor.name)
- end
- def draw_actor_level(actor, x, y)
- if $game_system.partylock[@actor.id - 1]
- change_color(normal_color, false)
- draw_text(x, y, 32, line_height, Vocab::level_a)
- change_color(normal_color, false)
- draw_text(x + 32, y, 24, line_height, actor.level, 2)
- else
- change_color(system_color)
- draw_text(x, y, 32, line_height, Vocab::level_a)
- change_color(normal_color)
- draw_text(x + 32, y, 24, line_height, actor.level, 2)
- end
- end
- def refresh; contents.clear; draw_all_items; end
- end
- #------------------------------------------------------------------------------
- # * Reserve Party Window.
- #------------------------------------------------------------------------------
- class Window_ReserveParty < Window_Selectable
- def initialize(x, y, width, height); super; @data = []; self.oy = 0; end
- def line_height; 86; end
- def item_max; data = @data.nil? ? 1 : @data.size + 1; data; end
- def get_data
- @data = []
- if $game_system.partychanger.size > 0
- for i in 0..$game_system.partychanger.size
- if $game_system.partychanger[i]
- @partycheck = false
- for a in 1..$game_party.members.size
- if $game_party.members[a-1].id == i + 1
- @partycheck = true
- end
- end
- @data.push($game_actors[i+1]) if !@partycheck
- end
- end
- end
- end
- def draw_all_items; item_max.times {|i| draw_item(i)}; end
- def draw_item(index)
- if @data[index] != nil
- @actor = @data[index]
- mode = BM_Party_Changer::DisplayMode
- case mode
- when 0
- x_pos = 60; draw_actor_graphic(@actor, 30, index*86 + 60)
- when 1
- x_pos = 90; draw_actor_face(@actor, 2, index*86 + 2)
- end
- draw_actor_name(@actor, x_pos, index*86 - 16)
- draw_actor_level(@actor, x_pos, index*86 + 16)
- end
- end
- # Draw Face Custom
- def draw_face(face_name, face_index, x, y, enabled = true)
- bitmap = Cache.face(face_name)
- rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 82, 82)
- contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
- bitmap.dispose
- end
- def draw_actor_name(actor, x, y, width = 112)
- if $game_system.partylock[@actor.id - 1]
- change_color(normal_color, false)
- else
- change_color(hp_color(actor))
- end
- draw_text(x, y, width, line_height, actor.name)
- end
- def draw_actor_level(actor, x, y)
- if $game_system.partylock[@actor.id - 1]
- change_color(normal_color, false)
- draw_text(x, y, 32, line_height, Vocab::level_a)
- change_color(normal_color, false)
- draw_text(x + 32, y, 24, line_height, actor.level, 2)
- else
- change_color(system_color)
- draw_text(x, y, 32, line_height, Vocab::level_a)
- change_color(normal_color)
- draw_text(x + 32, y, 24, line_height, actor.level, 2)
- end
- end
- def refresh; contents.clear; get_data; create_contents; draw_all_items; end
- def data(index); @data[index]; end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement