Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ------------------------------------------------------------------------------
- # Script: Party System (v1.0)
- # Author: flixbeat
- #
- # Description:
- # This script allows you to manage your party members, by
- # adding, removing or swapping members.
- #
- # Compatibility issues:
- # This script is incompatible with other scripts that adds a new command in
- # the menu window as well. This script adds a new command "party" to the menu
- # window and it should be at the bottom of status command. Any new commands
- # that are also being added after the status command will be overriden, in order
- # to avoid this issue read the installation instructions.
- #
- # Installation:
- # 1) This script is plug and play, just be sure to place it above ▼ Main Process
- # 2) If there are other scripts that add new commands like this script does,
- # be sure to put this script above that script, an example of a script that
- # adds a new command is KCG quest journal script. It adds a 'quest' command
- # on the menu. If this script is placed below KGC quest journal script
- # the 'quest' command will be overriden.
- #
- # Default Controls:
- # Button "C" - select an actor (Key "Z","Enter" for keyboard)
- # Button "A" - remove an actor (Key "Shift" for keyboard)
- #
- # Relase Date: July 30
- #
- # Updates:
- #
- # ------------------------------------------------------------------------------
- # ======================== START OF CUSTOMIZATION ==============================
- # If you will change the number of your max party members here, be sure to
- # change the value of MAX_MEMBERS constant in the Game_Party Script as well. Make
- # sure that the MAX_MEMBERS value matches with SIZE value.
- module Flix_Max_Party
- SIZE = 4
- end
- # If you want to disable some actors from being removed or replace from the
- # party, place their IDs here, each actor's ID can be found in the actor tab
- # in the database, by default the actor who has an ID of 1 is ralph and 2 for
- # ulrika
- # to add actor IDs see syntax and example below
- # syntax : key => actor_id
- # example : 5 => 5
- # - in this case, whoever actor that has an id of 5 will not
- # be removed or replaced in party.
- # I recommend that you match the key and the actor id
- # NOTE: Don't forget to place a comma right after you add new key and actor id
- module Flix_Disable_Actors
- ACTOR_ID = {
- 1=>1,
- 2=>2,
- }
- end
- # Place actor id's here, actors that are present in this section will show
- # in standby actors, watch for the comma here as well.
- module Flix_Standby_Actors
- ACTOR_ID = [5,6,7,8]
- end
- # You can customize texts guides that are being displayed on party window
- module Flix_Text
- VACANT_TEXT = "-vacant-" # text for a vacant slot
- TITLE_TEXT = "Party" # the title of the window
- PARTY_TEXT = "Active" # members that are currenly in the party
- STANDBY_ACTORS_TITLE_TEXT = "Standby" # members that are in standby for future use
- BUTTON_GUIDE = "(Press C to select or A to remove a character)" # button guide
- # NOTE: changing the text button like C or A will not change the controls.
- end
- # ======================== END OF CUSTOMIZATION ================================
- # ------------------------------------------------------------------------------
- # * Title Window
- # ------------------------------------------------------------------------------
- class Window_Title < Window_Base
- def initialize
- super(0,0,544,50)
- self.contents.draw_text(0,-5,self.width,WLH,Flix_Text::TITLE_TEXT + " " + Flix_Text::BUTTON_GUIDE)
- end
- end
- # ------------------------------------------------------------------------------
- # * Party Name Window (Title)
- # ------------------------------------------------------------------------------
- class Window_Party_Title < Window_Base
- def initialize
- super(0,50,160,50)
- self.contents.draw_text(0,-5,self.width,WLH,Flix_Text::PARTY_TEXT)
- end
- end
- # ------------------------------------------------------------------------------
- # * Party Names Window
- # ------------------------------------------------------------------------------
- class Window_Party_Command < Window_Selectable
- def initialize
- @actor = $game_actors
- @party = $game_party
- super(0,100,160,130)
- self.alias_func
- self.prepare_party_member_selection
- end
- def alias_func
- alias :prepare_party_member_selection :select
- end
- def select
- @selections = []
- if @party.members.size == Flix_Max_Party::SIZE
- for i in 0..@party.members.size-1
- @selections.push(@party.members[i].name)
- end
- else
- for i in 0..@party.members.size-1
- @selections.push(@party.members[i].name)
- end
- slot = Flix_Max_Party::SIZE - @party.members.size
- for i in 0..slot-1
- @selections.push("-vacant-")
- end
- end
- self.index = 0
- @item_max = @selections.size
- for i in 0..@selections.size-1
- rect = self.item_rect(i)
- self.contents.draw_text(rect,@selections[i])
- end
- end
- end
- # ------------------------------------------------------------------------------
- # * Standby Window (Title)
- # ------------------------------------------------------------------------------
- class Window_Standby_Title < Window_Base
- def initialize
- super(0,230,160,50)
- self.contents.draw_text(0,-5,self.width,WLH,Flix_Text::STANDBY_ACTORS_TITLE_TEXT)
- end
- end
- # ------------------------------------------------------------------------------
- # * Standby Window Command
- # ------------------------------------------------------------------------------
- class Window_Standby_Selectable < Window_Selectable
- def initialize
- super(0,280,160,130)
- self.setup_selectables
- end
- def setup_selectables
- if Flix_Standby_Actors::ACTOR_ID!=[]
- @selectables = []
- for i in 0..Flix_Standby_Actors::ACTOR_ID.size-1
- @selectables.push($game_actors[Flix_Standby_Actors::ACTOR_ID[i]].name)
- end
- self.index = 0
- @item_max = @selectables.size
- self.create_contents
- for i in 0..@selectables.size-1
- rect = item_rect(i)
- self.contents.draw_text(rect,@selectables[i])
- end
- end
- end
- end
- # ------------------------------------------------------------------------------
- # * Actor Info Window (In Party)
- # ------------------------------------------------------------------------------
- class Window_Show_Actor_Info < Window_Base
- def initialize
- super(160,50,384,180)
- @actor = $game_actors
- end
- def show_actor_info(actor_index)
- self.contents.clear
- if actor_index == nil
- self.contents.clear
- else
- self.draw_actor_face(@actor[actor_index],0,0)
- self.draw_actor_graphic(@actor[actor_index], 13, 96)
- self.draw_actor_level(@actor[actor_index], 260, 0)
- self.draw_actor_name(@actor[actor_index],0,100)
- self.draw_actor_class(@actor[actor_index], 0, 124)
- self.draw_actor_hp(@actor[actor_index], 120, 0)
- self.draw_actor_mp(@actor[actor_index], 120, 24)
- self.contents.draw_text(120,50,self.width,WLH,"ATK: "+@actor[actor_index].base_atk.to_s)
- self.contents.draw_text(120,74,self.width,WLH,"DEF: "+@actor[actor_index].base_def.to_s)
- self.contents.draw_text(120,98,self.width,WLH,"AGI: "+@actor[actor_index].base_agi.to_s)
- self.contents.draw_text(120,122,self.width,WLH,"SPI: "+@actor[actor_index].base_spi.to_s)
- self.contents.draw_text(240,50,self.width,WLH,"EVA: "+@actor[actor_index].agi.to_s)
- self.contents.draw_text(240,74,self.width,WLH,"CRI: "+@actor[actor_index].cri.to_s)
- self.contents.draw_text(240,98,self.width,WLH,"HTR: "+@actor[actor_index].hit.to_s)
- end
- end
- end
- # ------------------------------------------------------------------------------
- # * Actor Info Window (In Standby)
- # ------------------------------------------------------------------------------
- class Window_Show_Actor_Info_ST < Window_Base
- def initialize
- super(160,230,384,186)
- @actor = $game_actors
- end
- def show_actor_info(actor_index)
- self.contents.clear
- self.draw_actor_face(@actor[actor_index],0,0)
- self.draw_actor_graphic(@actor[actor_index], 13, 96)
- self.draw_actor_level(@actor[actor_index], 260, 0)
- self.draw_actor_name(@actor[actor_index],0,100)
- self.draw_actor_class(@actor[actor_index], 0, 124)
- self.draw_actor_hp(@actor[actor_index], 120, 0)
- self.draw_actor_mp(@actor[actor_index], 120, 24)
- self.contents.draw_text(120,50,self.width,WLH,"ATK: "+@actor[actor_index].base_atk.to_s)
- self.contents.draw_text(120,74,self.width,WLH,"DEF: "+@actor[actor_index].base_def.to_s)
- self.contents.draw_text(120,98,self.width,WLH,"AGI: "+@actor[actor_index].base_agi.to_s)
- self.contents.draw_text(120,122,self.width,WLH,"SPI: "+@actor[actor_index].base_spi.to_s)
- self.contents.draw_text(240,50,self.width,WLH,"EVA: "+@actor[actor_index].agi.to_s)
- self.contents.draw_text(240,74,self.width,WLH,"CRI: "+@actor[actor_index].cri.to_s)
- self.contents.draw_text(240,98,self.width,WLH,"HTR: "+@actor[actor_index].hit.to_s)
- end
- end
- class Scene_Menu < Scene_Menu
- def initialize
- print "scene menu called"
- end
- end
- # ------------------------------------------------------------------------------
- # * Scene Menu - This scene is identical to the original Scene_Menu for easy
- # customization
- # ------------------------------------------------------------------------------
- class Scene_Menu < Scene_Base
- def initialize(menu_index = 0)
- @menu_index = menu_index
- if @menu_index > 4
- self.menu_index(@menu_index+=1)
- end
- end
- def menu_index(previous_selection_index)
- @menu_index = previous_selection_index
- end
- def create_command_window
- s1 = Vocab::item # 0
- s2 = Vocab::skill # 1
- s3 = Vocab::equip # 2
- s4 = Vocab::status # 3
- party = "Party" # 4
- save = Vocab::save # 5
- game_end = Vocab::game_end #6
- @main_selectables = [s1,s2,s3,s4,party,save,game_end]
- # create commands < window selectable
- @command_window = Window_Command.new(160, @main_selectables)
- @command_window.index = @menu_index
- if $game_party.members.size == 0 # If number of party members is 0
- @command_window.draw_item(@main_selectables[0], false) # Disable item
- @command_window.draw_item(@main_selectables[1], false) # Disable skill
- @command_window.draw_item(@main_selectables[2], false) # Disable equipment
- @command_window.draw_item(@main_selectables[3], false) # Disable status
- @command_window.draw_item(@main_selectables[4], false) # Disable party
- end
- if $game_system.save_disabled # If save is forbidden
- @command_window.draw_item(5, false) # Disable save
- end
- end
- def update_command_selection
- 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 # Flix Party
- self.menu_index(@menu_index)
- $scene = Flix_Scene_Party.new
- when 5 # Save
- $scene = Scene_File.new(true, false, false)
- when 6 # End Game
- $scene = Scene_End.new
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Start Actor Selection
- #--------------------------------------------------------------------------
- def start_actor_selection
- @command_window.active = false
- @status_window.active = true
- if $game_party.last_actor_index < @status_window.item_max
- @status_window.index = $game_party.last_actor_index
- else
- @status_window.index = 0
- end
- end
- #--------------------------------------------------------------------------
- # * End Actor Selection
- #--------------------------------------------------------------------------
- def end_actor_selection
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- end
- #--------------------------------------------------------------------------
- # * Update Actor Selection
- #--------------------------------------------------------------------------
- def update_actor_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_actor_selection
- elsif Input.trigger?(Input::C)
- $game_party.last_actor_index = @status_window.index
- Sound.play_decision
- case @command_window.index
- when 1 # skill
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # equipment
- $scene = Scene_Equip.new(@status_window.index)
- when 3 # status
- $scene = Scene_Status.new(@status_window.index)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Start processing
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- create_command_window
- @gold_window = Window_Gold.new(0, 360)
- @status_window = Window_MenuStatus.new(160, 0)
- end
- #--------------------------------------------------------------------------
- # * Termination Processing
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @command_window.dispose
- @gold_window.dispose
- @status_window.dispose
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @command_window.update
- @gold_window.update
- @status_window.update
- if @command_window.active
- update_command_selection
- elsif @status_window.active
- update_actor_selection
- end
- end
- end
- # ==============================================================================
- # * Scene
- # ==============================================================================
- class Flix_Scene_Party < Scene_Base
- def start
- self.create_menu_background
- #---------------------------------------------
- @win_title = Window_Title.new
- @win_ptitle = Window_Party_Title.new
- @win_cparty = Window_Party_Command.new
- @win_show_actor = Window_Show_Actor_Info.new
- #---------------------------------------------
- @win_stitle = Window_Standby_Title.new
- @win_cstandby = Window_Standby_Selectable.new
- @win_show_actor_st = Window_Show_Actor_Info_ST.new
- #---------------------------------------------
- @members = []
- for i in 0..$game_party.members.size-1
- @members.push($game_party.members[i].id)
- end
- @win_cstandby.active = false
- self.refresh_selection
- end
- def update
- @win_cparty.update
- @win_cstandby.update
- if Input.trigger?(Input::C)
- if Flix_Disable_Actors::ACTOR_ID.has_value?@members[@win_cparty.index] or
- Flix_Standby_Actors::ACTOR_ID==[]
- Sound.play_buzzer
- else
- if @win_cparty.active
- Sound.play_decision
- @win_cstandby.active = true
- @win_cparty.active = false
- elsif @win_cstandby.active
- Sound.play_equip
- @win_cstandby.active = false
- @win_cparty.active = true
- if @members[@win_cparty.index] == nil
- @members.delete_at(@win_cparty.index)
- @members.push(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
- $game_party.add_actor(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
- Flix_Standby_Actors::ACTOR_ID.delete(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
- else
- actor_id_buffer = @members[@win_cparty.index]
- $game_party.remove_actor(@members[@win_cparty.index])
- @members.delete(@members[@win_cparty.index])
- @members.push(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
- $game_party.add_actor(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
- Flix_Standby_Actors::ACTOR_ID.delete(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
- Flix_Standby_Actors::ACTOR_ID.push(actor_id_buffer)
- end
- self.refresh_selection
- self.command_window_refresh
- end
- end
- elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
- if @win_cparty.active
- @win_show_actor.show_actor_info(@members[@win_cparty.index])
- elsif @win_cstandby.active
- @win_show_actor_st.show_actor_info(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
- end
- elsif Input.trigger?(Input::A)
- if @win_cstandby.active
- Sound.play_buzzer
- else
- if Flix_Disable_Actors::ACTOR_ID.has_value?@members[@win_cparty.index] or
- @members[@win_cparty.index] == nil
- Sound.play_buzzer
- else
- Sound.play_equip
- actor_id_buffer = @members[@win_cparty.index]
- @members.delete(@members[@win_cparty.index])
- $game_party.remove_actor(actor_id_buffer)
- Flix_Standby_Actors::ACTOR_ID.push(actor_id_buffer)
- self.command_window_refresh
- self.refresh_selection
- end
- end
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- if @win_cstandby.active
- @win_cstandby.active = false
- @win_cparty.active = true
- else
- $scene = Scene_Menu.new(4)
- end
- end
- end
- def command_window_refresh
- @win_cparty.dispose
- @win_cstandby.dispose
- @win_cparty = Window_Party_Command.new
- @win_cstandby = Window_Standby_Selectable.new
- @win_cstandby.active = false
- end
- def refresh_selection
- @win_show_actor.show_actor_info(@members[0])
- if Flix_Standby_Actors::ACTOR_ID!=[]
- @win_show_actor_st.show_actor_info(Flix_Standby_Actors::ACTOR_ID[0])
- end
- end
- def terminate
- @win_show_actor.dispose
- @win_cparty.dispose
- @win_title.dispose
- @win_ptitle.dispose
- @win_stitle.dispose
- @win_cstandby.dispose
- @win_show_actor_st.dispose
- dispose_menu_background
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement