Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################################################
- # ReOrderParty 1.1a
- # By: Ixfuru
- #
- # As Requested by: Esperhunter
- ################################################################################
- # This script provides a simple, effecient way to manage the position your party
- # is arranged in. THIS IS NOT A PARTY RESERVE SCRIPT! You call the scene by
- # placing a script call command in an event (third page of event commands) and
- # entering the following line:
- #
- # $scene = Scene_ReOrder.new
- #
- # The controls of the scene are listed in a visible help window. From a keyboard,
- # the controls are:
- #
- # A: Shift
- # B: Cancel Button (X, ESC)
- # C: Action Button(Space, Enter or Z)
- #
- # There are few customization options. But the script is pretty simple.
- ################################################################################
- # Feel free to use this script for commercial or NON commercial projects. Just
- # give credit to IXFURU somewhere and send me a link to your project.
- ################################################################################
- ################################################################################
- # CUSTOMIZE BELOW
- ################################################################################
- module IROP
- REORDER_TITLE = "Reorder the Party" #The title displayed on the scene
- ROP_TITLE_COLOR = 22 #The color of the title's text
- ROP_HELP_COLOR = 31 #Help information text color
- ROP_DELETE_SOUND = "Blow2" #sound when an actor is removed from new position
- ROP_FULL_SOUND = "Chime2" #sound when last member is placed into new position
- REORDER_CONFIRM_TEXT = "Continue" #text shown in order to confirm you are finished
- REORDER_CANCEL_TEXT = "Cancel" #text shown as option to cancel finishing the scene
- USE_FROM_MENU = false #Set to true if you want the ability to have the scene from the menu
- # You only have to worry about the last two if you set the USE_FROM_MENU as true
- IROP_NOACCESS_SWITCH = 1 #When this switch is ON, the menu command will be inaccessible
- MENU_REORDER_COMMAND = "Reorder" #String to display as string in menu
- end
- ################################################################################
- # CUSTOMIZE END
- ################################################################################
- ################################################################################
- #===============================================================================
- ################################################################################
- #-------------------------------------------------------------------------------
- # Game_Temp
- #-------------------------------------------------------------------------------
- class Game_Temp
- attr_accessor :reorder_from #make access to value for whether scene reorder is
- #accessed from map or menu
- alias irop_gt_initialize initialize unless $@
- def initialize
- irop_gt_initialize
- @reorder_from = 0
- end
- end
- #-------------------------------------------------------------------------------
- # Game_Party
- #-------------------------------------------------------------------------------
- class Game_Party < Game_Unit
- def get_reorder(order)
- for i in 0...order.size
- add_actor(order[i])
- end
- end
- def remove_all_actors
- for member in members
- remove_actor(member.id)
- end
- end
- end
- #-------------------------------------------------------------------------------
- # WindowRopPopUp
- #-------------------------------------------------------------------------------
- class Window_Rop_Pop < Window_Selectable
- include IROP
- def initialize(x, y)
- super(x, y, 180, 90)
- @commands = [REORDER_CONFIRM_TEXT, REORDER_CANCEL_TEXT]
- @item_max = @commands.size
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.font.color = normal_color
- self.contents.draw_text(rect, @commands[index])
- end
- end
- #-------------------------------------------------------------------------------
- # WindowRopTitle
- #-------------------------------------------------------------------------------
- class Window_Rop_Title < Window_Base
- include IROP
- def initialize(x, y)#pass 60, 0
- super(x, y, 360, 60)
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.color = text_color(ROP_TITLE_COLOR)
- self.contents.draw_text(-8, 0, self.width, WLH, REORDER_TITLE, 1)
- end
- end
- #-------------------------------------------------------------------------------
- # WindowRopHelp
- #-------------------------------------------------------------------------------
- class Window_Rop_Help < Window_Base
- include IROP
- attr_writer :helptext
- def initialize(x, y)#pass 60, 311
- super(x, y, 360, 60)
- @helptext = 0
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.color = text_color(ROP_HELP_COLOR)
- if @helptext == 0
- self.contents.draw_text(-8, 0, self.width, WLH, "C: Select, B:Exit", 1)
- elsif @helptext == 1
- self.contents.draw_text(-8, 0, self.width, WLH, "C:Select, B:Exit, A:Delete", 1)
- elsif @helptext == 2
- self.contents.draw_text(-8, 0, self.width, WLH, "C:Select", 1)
- end
- end
- end
- #-------------------------------------------------------------------------------
- # WindowOrder
- #-------------------------------------------------------------------------------
- class Window_Order < Window_Selectable
- attr_accessor :disableds
- attr_accessor :commands
- def initialize(x, y)
- super(x, y, 180, 230)
- @commands = []
- for i in 0...$game_party.members.size
- @commands.push($game_party.members[i].name)
- end
- @disableds = []
- get_disabled
- @item_max = @commands.size
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- if @disableds != nil
- if @disableds[i] == false
- draw_item(i)
- else
- draw_item(i, false)
- end
- else
- draw_item(i)
- end
- end
- end
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.draw_text(rect, @commands[index])
- end
- def get_disabled
- for i in 0...$game_party.members.size
- @disableds.push(false)
- end
- end
- end
- #-------------------------------------------------------------------------------
- # WindowReOrder
- #-------------------------------------------------------------------------------
- class Window_ReOrder < Window_Selectable
- attr_accessor :placed
- attr_accessor :commands
- def initialize(x, y)
- super(x, y, 180, 230)
- @commands = [] #create array for commands
- for i in 0...$game_party.members.size # in every selection option
- @commands.push("") #create a blank option
- end
- @placed = [] #create array for slots filled in new order
- get_placed
- @item_max = @commands.size
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.draw_text(rect, @commands[index])
- end
- def change_specific_command(index, command_index)
- @commands[index] = $game_party.members[command_index].name # change option to new order actor's name
- @placed[index] = true #flag the new order position as placed
- end
- def get_placed
- for i in 0...@commands.size #once for every position available to place
- @placed.push(false) #flag all positions as unplaced
- end
- end
- def unplace_from_order(where)
- @commands[where] = ""
- @placed[where] = false
- end
- end
- #-------------------------------------------------------------------------------
- # Scene ReOrder
- #-------------------------------------------------------------------------------
- class Scene_ReOrder < Scene_Base
- include IROP
- def start
- super
- @lastplaced = 0
- @wincount = 0
- @new_order = []
- for i in 0...$game_party.members.size
- @new_order.push(0)
- end
- @win_title = Window_Rop_Title.new(100, 0)
- @win_help = Window_Rop_Help.new(100, 291)
- @win_order = Window_Order.new(100, 61)
- @win_reorder = Window_ReOrder.new(281, 61)
- @win_order.active = true
- end
- def update
- if @win_order.active
- @win_help.refresh
- @win_order.update
- if Input.trigger?(Input::C) and @win_order.disableds[@win_order.index] == false
- Sound.play_decision
- make_reorder_active(0)
- elsif Input.trigger?(Input::C) and @win_order.disableds[@win_order.index] == true
- Sound.play_cancel
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- case $game_temp.reorder_from
- when 0
- $scene = Scene_Map.new
- when 1
- $scene = Scene_Menu.new
- $game_temp.reorder_from = 0
- end
- end
- elsif @win_reorder.active
- @win_help.refresh
- @win_reorder.update
- if Input.trigger?(Input::C) and @win_reorder.placed[@win_reorder.index] == false
- Sound.play_decision
- @win_order.disableds[@win_order.index] = true
- @new_order[@win_reorder.index] = $game_party.members[@win_order.index].id
- @win_reorder.change_specific_command(@win_reorder.index, @win_order.index)
- @win_reorder.refresh
- @win_order.refresh
- @win_help.refresh
- @lastplaced = @win_reorder.index
- check_full
- elsif Input.trigger?(Input::C) and @win_reorder.placed[@win_reorder.index] == true
- Sound.play_cancel
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- make_order_active
- elsif Input.trigger?(Input::A) and @win_reorder.placed[@win_reorder.index] == true
- RPG::SE.new(ROP_DELETE_SOUND, 80, 100).play
- @new_order[@win_reorder.index] = -1
- undo_disabled(@win_reorder.commands[@win_reorder.index])
- @win_reorder.unplace_from_order(@win_reorder.index)
- make_order_active
- @win_reorder.refresh
- @win_order.refresh
- @win_help.refresh
- end
- elsif @win_pop.active
- @win_help.refresh
- @win_pop.update
- if Input.trigger?(Input::C) and @win_pop.index == 0
- $game_party.remove_all_actors
- $game_party.get_reorder(@new_order)
- case $game_temp.reorder_from
- when 0
- $scene = Scene_Map.new
- when 1
- $scene = Scene_Menu.new
- $game_temp.reorder_from = 0
- end
- elsif Input.trigger?(Input::C) and @win_pop.index == 1
- RPG::SE.new(ROP_DELETE_SOUND, 80, 100).play # Requires deleting a selection
- @new_order[@win_reorder.index] = -1
- undo_disabled(@win_reorder.commands[@win_reorder.index])
- @win_reorder.unplace_from_order(@win_reorder.index)
- @wincount = 0
- make_reorder_active(1)
- end
- end
- end
- def undo_disabled(name)
- for i in 0...@win_order.commands.size
- if @win_order.commands[i] == name
- @win_order.disableds[i] = false
- end
- end
- end
- def check_full
- spots_full = 0
- for i in 0...@new_order.size
- if @new_order[i] > 0
- spots_full += 1
- end
- end
- if spots_full == @new_order.size
- RPG::SE.new(ROP_FULL_SOUND, 80, 100).play
- @win_pop = Window_Rop_Pop.new(200, 175)
- @wincount = 1
- make_pop_active
- else
- make_order_active
- end
- end
- def make_order_active
- @win_help.helptext = 0
- @win_reorder.active = false
- @win_order.active = true
- end
- def make_reorder_active(from)
- if from == 0
- @win_help.helptext = 1
- @win_order.active = false
- @win_reorder.active = true
- elsif from == 1
- @win_pop.dispose
- @win_help.helptext = 1
- @win_reorder.active = true
- end
- end
- def make_pop_active
- @win_help.helptext = 2
- @win_reorder.active = false
- @win_pop.active = true
- end
- def terminate
- if @wincount == 1
- @win_pop.dispose
- @win_title.dispose
- @win_help.dispose
- @win_order.dispose
- @win_reorder.dispose
- else
- @win_title.dispose
- @win_help.dispose
- @win_order.dispose
- @win_reorder.dispose
- end
- end
- end
- #-------------------------------------------------------------------------------
- # Scene_Menu
- #-------------------------------------------------------------------------------
- class Scene_Menu < Scene_Base
- include IROP
- alias irop_sm_start start unless $@
- def start
- if USE_FROM_MENU
- super
- create_menu_background
- if USE_FROM_MENU
- create_command_window_irop
- else
- create_command_window
- end
- @gold_window = Window_Gold.new(0, 360)
- @status_window = Window_MenuStatus.new(160, 0)
- else
- irop_sm_start
- end
- end
- def create_command_window_irop
- s1 = Vocab::item
- s2 = Vocab::skill
- s3 = Vocab::equip
- s4 = Vocab::status
- s5 = MENU_REORDER_COMMAND
- s6 = Vocab::save
- s7 = Vocab::game_end
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
- @command_window.index = @menu_index
- if $game_party.members.size == 0 # If number of party members is 0
- @command_window.draw_item(0, false) # Disable item
- @command_window.draw_item(1, false) # Disable skill
- @command_window.draw_item(2, false) # Disable equipment
- @command_window.draw_item(3, false) # Disable status
- @command_window.draw_item(4, false) # Disable reorder
- end
- if $game_system.save_disabled # If save is forbidden
- @command_window.draw_item(5, false) # Disable save
- end
- end
- alias irop_sm_update update unless $@
- def update
- if USE_FROM_MENU
- super
- update_menu_background
- @command_window.update
- @gold_window.update
- @status_window.update
- if @command_window.active
- update_command_selection_irop
- elsif @status_window.active
- update_actor_selection
- end
- else
- irop_sm_update
- end
- end
- def update_command_selection_irop
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- if $game_party.members.size == 0 and @command_window.index < 5
- Sound.play_buzzer
- return
- elsif $game_system.save_disabled and @command_window.index == 5
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- case @command_window.index
- when 0 # Item
- $scene = Scene_Item.new
- when 1,2,3 # Skill, equipment, status
- start_actor_selection
- when 4 #ReOrder
- $game_temp.reorder_from = 1
- $scene = Scene_ReOrder.new
- when 5 # Save
- $scene = Scene_File.new(true, false, false)
- when 6 # End Game
- $scene = Scene_End.new
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment