Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################################################
- # ReOrderParty 1.0
- # 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
- end
- ################################################################################
- # CUSTOMIZE END
- ################################################################################
- ################################################################################
- #===============================================================================
- ################################################################################
- #-------------------------------------------------------------------------------
- # Game_Party
- #-------------------------------------------------------------------------------
- class Game_Party < Game_Unit
- def get_reorder(order)
- p 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, 120)
- @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...@item_max
- @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 = []
- for i in 0...$game_party.members.size
- @commands.push("")
- end
- @placed = []
- 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
- @placed[index] = true
- end
- def get_placed
- for i in 0...@commands.size
- @placed.push(false)
- 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(60, 0)
- @win_help = Window_Rop_Help.new(60, 311)
- @win_order = Window_Order.new(60, 60)
- @win_reorder = Window_ReOrder.new(241, 60)
- @win_order.get_disabled
- @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
- $scene = Scene_Map.new
- 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
- @win_order.disableds[@win_order.index] = false
- @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)
- $scene = Scene_Map.new
- 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
- @win_order.disableds[@win_order.index] = false
- @win_reorder.unplace_from_order(@win_reorder.index)
- @wincount = 0
- make_reorder_active(1)
- 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
Advertisement
Add Comment
Please, Sign In to add comment