Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IRS_DISBAND_LABEL = "Disband"
- IRS_CHANGE_LABEL = "Change"
- # Actor ids who can be discarded
- IRS_DISCARDABLES = [1, 2]
- # // $game_actors[id].discardable = bool
- # // $game_actors[8].discardable = true
- # // $game_actors[1].discardable = false
- module PartyManage
- module_function
- def discard_member(actor_id)
- $game_party.remove_actor(actor_id)
- end
- def discardable_member?(actor_id)
- $game_actors[actor_id].discardable
- end
- end
- class Game_Actor < Game_Battler
- attr_accessor :discardable
- alias irp_ga_initialize initialize unless $@
- def initialize(*args)
- irp_ga_initialize(*args)
- @discardable = false
- @discardable = true if IRS_DISCARDABLES.include?(@actor_id)
- end
- end
- class Window_MenuStatus
- def actor_at(index)
- mems = $game_party.members
- memsrev = $game_party.ma_reserve_members
- case index
- when 0...4
- return mems[index]
- when 4...PARTY_CHANGE_MAX_RESERVE_SIZE+4
- return memsrev[index-4]
- end
- return nil
- end
- end
- class Scene_Menu < Scene_Base
- def create_irs_window
- Sound.play_decision
- @irs_window = Window_Command.new(160, [IRS_CHANGE_LABEL, IRS_DISBAND_LABEL])
- @irs_window.x = @status_window.x + ((@status_window.width-@irs_window.width)/2)
- @irs_window.y = @status_window.y + ((@status_window.height-@irs_window.height)/2)
- update_irs_command
- end
- def update_irs_command
- actor_at_index = @status_window.actor_at(@status_window.index)
- if actor_at_index.nil?
- @irs_window.draw_item(1, false)
- elsif !actor_at_index.discardable
- @irs_window.draw_item(1, false)
- end
- loop do
- Graphics.update
- Input.update
- @irs_window.update
- if Input.trigger?(Input::C)
- case @irs_window.index
- when 1
- if actor_at_index != nil
- if PartyManage.discardable_member?(actor_at_index.id)
- Sound.play_decision
- PartyManage.discard_member(actor_at_index.id)
- @status_window.refresh
- @irs_window.dispose
- return 2
- else ; Sound.play_buzzer end
- else ; Sound.play_buzzer end
- when 0
- Sound.play_decision
- @irs_window.dispose
- return 1
- end
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- @irs_window.dispose
- return 0
- end
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 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
- ans = create_irs_window
- return if [0, 2].include?(ans)
- # 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
- end
Advertisement
Add Comment
Please, Sign In to add comment