Advertisement
flixbeat

Flixbeat Party System

Jul 30th, 2013
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 18.72 KB | None | 0 0
  1. # ------------------------------------------------------------------------------
  2. # Script: Party System (v1.0)
  3. # Author: flixbeat
  4. #
  5. # Description:
  6. # This script allows you to manage your party members, by
  7. # adding, removing or swapping members.
  8. #
  9. # Compatibility issues:
  10. # This script is incompatible with other scripts that adds a new command in
  11. # the menu window as well. This script adds a new command "party" to the menu
  12. # window and it should be at the bottom of status command. Any new commands
  13. # that are also being added after the status command will be overriden, in order
  14. # to avoid this issue read the installation instructions.
  15. #
  16. # Installation:
  17. # 1) This script is plug and play, just be sure to place it above ▼ Main Process
  18. # 2) If there are other scripts that add new commands like this script does,
  19. #    be sure to put this script above that script, an example of a script that
  20. #    adds a new command is KCG quest journal script. It adds a 'quest' command
  21. #    on the menu. If this script is placed below KGC quest journal script
  22. #    the 'quest' command will be overriden.
  23. #
  24. # Default Controls:
  25. # Button "C" - select an actor (Key "Z","Enter" for keyboard)
  26. # Button "A" - remove an actor (Key "Shift" for keyboard)
  27. #
  28. # Relase Date: July 30
  29. #
  30. # Updates:
  31. #
  32. # ------------------------------------------------------------------------------
  33.  
  34. # ======================== START OF CUSTOMIZATION ==============================
  35.  
  36. # If you will change the number of your max party members here, be sure to
  37. # change the value of MAX_MEMBERS constant in the Game_Party Script as well. Make
  38. # sure that the MAX_MEMBERS value matches with SIZE value.
  39. module Flix_Max_Party
  40.   SIZE = 4
  41. end
  42.  
  43. # If you want to disable some actors from being removed or replace from the
  44. # party, place their IDs here, each actor's ID can be found in the actor tab
  45. # in the database, by default the actor who has an ID of 1 is ralph and 2 for
  46. # ulrika
  47.  
  48. # to add actor IDs see syntax and example below
  49. # syntax : key => actor_id
  50. # example : 5 => 5
  51. # - in this case, whoever actor that has an id of 5 will not
  52. # be removed or replaced in party.
  53. # I recommend that you match the key and the actor id
  54. # NOTE: Don't forget to place a comma right after you add new key and actor id
  55. module Flix_Disable_Actors
  56.   ACTOR_ID = {
  57.   1=>1,
  58.   2=>2,
  59.   }
  60. end
  61.  
  62. # Place actor id's here, actors that are present in this section will show
  63. # in standby actors, watch for the comma here as well.
  64. module Flix_Standby_Actors
  65.   ACTOR_ID = [5,6,7,8]
  66. end
  67.  
  68. # You can customize texts guides that are being displayed on party window
  69. module Flix_Text
  70.     VACANT_TEXT = "-vacant-" # text for a vacant slot
  71.     TITLE_TEXT = "Party" # the title of the window
  72.     PARTY_TEXT = "Active" # members that are currenly in the party
  73.     STANDBY_ACTORS_TITLE_TEXT = "Standby" # members that are in standby for future use
  74.     BUTTON_GUIDE = "(Press C to select or A to remove a character)" # button guide
  75.     # NOTE: changing the text button like C or A will not change the controls.
  76. end
  77.  
  78. # ======================== END OF CUSTOMIZATION ================================
  79.  
  80. # ------------------------------------------------------------------------------
  81. # * Title Window
  82. # ------------------------------------------------------------------------------
  83. class Window_Title < Window_Base
  84.   def initialize
  85.     super(0,0,544,50)
  86.     self.contents.draw_text(0,-5,self.width,WLH,Flix_Text::TITLE_TEXT + " " + Flix_Text::BUTTON_GUIDE)
  87.   end
  88. end
  89.  
  90. # ------------------------------------------------------------------------------
  91. # * Party Name Window (Title)
  92. # ------------------------------------------------------------------------------
  93. class Window_Party_Title < Window_Base
  94.   def initialize
  95.     super(0,50,160,50)
  96.     self.contents.draw_text(0,-5,self.width,WLH,Flix_Text::PARTY_TEXT)
  97.   end
  98. end
  99.  
  100. # ------------------------------------------------------------------------------
  101. # * Party Names Window
  102. # ------------------------------------------------------------------------------
  103. class Window_Party_Command < Window_Selectable
  104.  
  105.   def initialize
  106.     @actor = $game_actors
  107.     @party = $game_party
  108.     super(0,100,160,130)
  109.     self.alias_func
  110.     self.prepare_party_member_selection
  111.   end
  112.  
  113.   def alias_func
  114.     alias :prepare_party_member_selection :select
  115.   end
  116.  
  117.   def select
  118.     @selections = []
  119.    
  120.     if @party.members.size == Flix_Max_Party::SIZE
  121.       for i in 0..@party.members.size-1
  122.         @selections.push(@party.members[i].name)
  123.       end
  124.     else
  125.       for i in 0..@party.members.size-1
  126.         @selections.push(@party.members[i].name)
  127.       end  
  128.    
  129.       slot = Flix_Max_Party::SIZE - @party.members.size
  130.      
  131.       for i in 0..slot-1
  132.         @selections.push("-vacant-")
  133.       end
  134.      
  135.     end
  136.    
  137.     self.index = 0
  138.     @item_max = @selections.size
  139.  
  140.     for i in 0..@selections.size-1
  141.       rect = self.item_rect(i)
  142.       self.contents.draw_text(rect,@selections[i])
  143.     end
  144.    
  145.   end
  146. end
  147.  
  148. # ------------------------------------------------------------------------------
  149. # * Standby Window (Title)
  150. # ------------------------------------------------------------------------------
  151. class Window_Standby_Title < Window_Base
  152.   def initialize
  153.     super(0,230,160,50)
  154.     self.contents.draw_text(0,-5,self.width,WLH,Flix_Text::STANDBY_ACTORS_TITLE_TEXT)
  155.   end
  156. end
  157.  
  158. # ------------------------------------------------------------------------------
  159. # * Standby Window Command
  160. # ------------------------------------------------------------------------------
  161. class Window_Standby_Selectable < Window_Selectable
  162.   def initialize
  163.     super(0,280,160,130)
  164.     self.setup_selectables
  165.   end
  166.  
  167.   def setup_selectables
  168.    
  169.     if Flix_Standby_Actors::ACTOR_ID!=[]
  170.      
  171.       @selectables = []
  172.       for i in 0..Flix_Standby_Actors::ACTOR_ID.size-1
  173.         @selectables.push($game_actors[Flix_Standby_Actors::ACTOR_ID[i]].name)
  174.       end
  175.      
  176.       self.index = 0
  177.       @item_max = @selectables.size
  178.       self.create_contents
  179.      
  180.       for i in 0..@selectables.size-1
  181.         rect = item_rect(i)
  182.         self.contents.draw_text(rect,@selectables[i])
  183.       end
  184.      
  185.     end
  186.      
  187.   end
  188. end
  189.  
  190. # ------------------------------------------------------------------------------
  191. # * Actor Info Window (In Party)
  192. # ------------------------------------------------------------------------------
  193. class Window_Show_Actor_Info < Window_Base
  194.   def initialize
  195.     super(160,50,384,180)
  196.     @actor = $game_actors
  197.   end
  198.  
  199.   def show_actor_info(actor_index)
  200.     self.contents.clear
  201.     if actor_index == nil
  202.       self.contents.clear
  203.     else
  204.       self.draw_actor_face(@actor[actor_index],0,0)
  205.       self.draw_actor_graphic(@actor[actor_index], 13, 96)
  206.       self.draw_actor_level(@actor[actor_index], 260, 0)
  207.       self.draw_actor_name(@actor[actor_index],0,100)
  208.       self.draw_actor_class(@actor[actor_index], 0, 124)
  209.       self.draw_actor_hp(@actor[actor_index], 120, 0)
  210.       self.draw_actor_mp(@actor[actor_index], 120, 24)
  211.       self.contents.draw_text(120,50,self.width,WLH,"ATK: "+@actor[actor_index].base_atk.to_s)
  212.       self.contents.draw_text(120,74,self.width,WLH,"DEF: "+@actor[actor_index].base_def.to_s)
  213.       self.contents.draw_text(120,98,self.width,WLH,"AGI: "+@actor[actor_index].base_agi.to_s)
  214.       self.contents.draw_text(120,122,self.width,WLH,"SPI: "+@actor[actor_index].base_spi.to_s)
  215.       self.contents.draw_text(240,50,self.width,WLH,"EVA: "+@actor[actor_index].agi.to_s)
  216.       self.contents.draw_text(240,74,self.width,WLH,"CRI: "+@actor[actor_index].cri.to_s)
  217.       self.contents.draw_text(240,98,self.width,WLH,"HTR: "+@actor[actor_index].hit.to_s)
  218.     end
  219.    
  220.   end
  221. end
  222.  
  223. # ------------------------------------------------------------------------------
  224. # * Actor Info Window (In Standby)
  225. # ------------------------------------------------------------------------------
  226. class Window_Show_Actor_Info_ST < Window_Base
  227.   def initialize
  228.     super(160,230,384,186)
  229.     @actor = $game_actors
  230.   end
  231.  
  232.   def show_actor_info(actor_index)
  233.     self.contents.clear
  234.     self.draw_actor_face(@actor[actor_index],0,0)
  235.     self.draw_actor_graphic(@actor[actor_index], 13, 96)
  236.     self.draw_actor_level(@actor[actor_index], 260, 0)
  237.     self.draw_actor_name(@actor[actor_index],0,100)
  238.     self.draw_actor_class(@actor[actor_index], 0, 124)
  239.     self.draw_actor_hp(@actor[actor_index], 120, 0)
  240.     self.draw_actor_mp(@actor[actor_index], 120, 24)
  241.     self.contents.draw_text(120,50,self.width,WLH,"ATK: "+@actor[actor_index].base_atk.to_s)
  242.     self.contents.draw_text(120,74,self.width,WLH,"DEF: "+@actor[actor_index].base_def.to_s)
  243.     self.contents.draw_text(120,98,self.width,WLH,"AGI: "+@actor[actor_index].base_agi.to_s)
  244.     self.contents.draw_text(120,122,self.width,WLH,"SPI: "+@actor[actor_index].base_spi.to_s)
  245.     self.contents.draw_text(240,50,self.width,WLH,"EVA: "+@actor[actor_index].agi.to_s)
  246.     self.contents.draw_text(240,74,self.width,WLH,"CRI: "+@actor[actor_index].cri.to_s)
  247.     self.contents.draw_text(240,98,self.width,WLH,"HTR: "+@actor[actor_index].hit.to_s)
  248.   end
  249. end
  250.  
  251. class Scene_Menu < Scene_Menu
  252.   def initialize
  253.     print "scene menu called"
  254.   end
  255. end
  256.  
  257.  
  258. # ------------------------------------------------------------------------------
  259. # * Scene Menu - This scene is identical to the original Scene_Menu for easy
  260. #                customization
  261. # ------------------------------------------------------------------------------
  262.  
  263. class Scene_Menu < Scene_Base
  264.   def initialize(menu_index = 0)
  265.     @menu_index = menu_index
  266.     if @menu_index > 4
  267.       self.menu_index(@menu_index+=1)
  268.     end
  269.   end
  270.  
  271.   def menu_index(previous_selection_index)
  272.     @menu_index = previous_selection_index
  273.   end
  274.  
  275.   def create_command_window
  276.     s1 = Vocab::item      # 0
  277.     s2 = Vocab::skill     # 1
  278.     s3 = Vocab::equip     # 2
  279.     s4 = Vocab::status    # 3
  280.     party = "Party"       # 4
  281.    
  282.     save = Vocab::save    # 5
  283.     game_end = Vocab::game_end #6
  284.    
  285.     @main_selectables = [s1,s2,s3,s4,party,save,game_end]
  286.     # create commands < window selectable
  287.     @command_window = Window_Command.new(160, @main_selectables)
  288.     @command_window.index = @menu_index
  289.     if $game_party.members.size == 0          # If number of party members is 0
  290.       @command_window.draw_item(@main_selectables[0], false)     # Disable item
  291.       @command_window.draw_item(@main_selectables[1], false)     # Disable skill
  292.       @command_window.draw_item(@main_selectables[2], false)     # Disable equipment
  293.       @command_window.draw_item(@main_selectables[3], false)     # Disable status
  294.       @command_window.draw_item(@main_selectables[4], false)     # Disable party
  295.     end
  296.     if $game_system.save_disabled             # If save is forbidden
  297.       @command_window.draw_item(5, false)     # Disable save
  298.     end
  299.   end
  300.  
  301.   def update_command_selection
  302.     if Input.trigger?(Input::B)
  303.       Sound.play_cancel
  304.       $scene = Scene_Map.new
  305.     elsif Input.trigger?(Input::C)
  306.       if $game_party.members.size == 0 and @command_window.index < 5
  307.         Sound.play_buzzer
  308.         return
  309.       elsif $game_system.save_disabled and @command_window.index == 5
  310.         Sound.play_buzzer
  311.         return
  312.       end
  313.       Sound.play_decision
  314.       case @command_window.index
  315.       when 0      # Item
  316.         $scene = Scene_Item.new
  317.       when 1,2,3  # Skill, equipment, status
  318.         start_actor_selection
  319.       when 4      # Flix Party
  320.         self.menu_index(@menu_index)
  321.         $scene = Flix_Scene_Party.new
  322.       when 5      # Save
  323.         $scene = Scene_File.new(true, false, false)
  324.       when 6      # End Game
  325.         $scene = Scene_End.new
  326.       end
  327.     end
  328.   end
  329.  
  330.   #--------------------------------------------------------------------------
  331.   # * Start Actor Selection
  332.   #--------------------------------------------------------------------------
  333.   def start_actor_selection
  334.     @command_window.active = false
  335.     @status_window.active = true
  336.     if $game_party.last_actor_index < @status_window.item_max
  337.       @status_window.index = $game_party.last_actor_index
  338.     else
  339.       @status_window.index = 0
  340.     end
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # * End Actor Selection
  344.   #--------------------------------------------------------------------------
  345.   def end_actor_selection
  346.     @command_window.active = true
  347.     @status_window.active = false
  348.     @status_window.index = -1
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # * Update Actor Selection
  352.   #--------------------------------------------------------------------------
  353.   def update_actor_selection
  354.     if Input.trigger?(Input::B)
  355.       Sound.play_cancel
  356.       end_actor_selection
  357.     elsif Input.trigger?(Input::C)
  358.       $game_party.last_actor_index = @status_window.index
  359.       Sound.play_decision
  360.       case @command_window.index
  361.       when 1  # skill
  362.         $scene = Scene_Skill.new(@status_window.index)
  363.       when 2  # equipment
  364.         $scene = Scene_Equip.new(@status_window.index)
  365.       when 3  # status
  366.         $scene = Scene_Status.new(@status_window.index)
  367.       end
  368.     end
  369.   end
  370.  
  371.   #--------------------------------------------------------------------------
  372.   # * Start processing
  373.   #--------------------------------------------------------------------------
  374.   def start
  375.     super
  376.     create_menu_background
  377.     create_command_window
  378.     @gold_window = Window_Gold.new(0, 360)
  379.     @status_window = Window_MenuStatus.new(160, 0)
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # * Termination Processing
  383.   #--------------------------------------------------------------------------
  384.   def terminate
  385.     super
  386.     dispose_menu_background
  387.     @command_window.dispose
  388.     @gold_window.dispose
  389.     @status_window.dispose
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # * Frame Update
  393.   #--------------------------------------------------------------------------
  394.   def update
  395.     super
  396.     update_menu_background
  397.     @command_window.update
  398.     @gold_window.update
  399.     @status_window.update
  400.     if @command_window.active
  401.       update_command_selection
  402.     elsif @status_window.active
  403.       update_actor_selection
  404.     end
  405.   end
  406.  
  407.  
  408. end
  409.  
  410. # ==============================================================================
  411. # * Scene
  412. # ==============================================================================
  413. class Flix_Scene_Party < Scene_Base
  414.  
  415.   def start
  416.    
  417.     self.create_menu_background
  418.     #---------------------------------------------
  419.     @win_title = Window_Title.new
  420.     @win_ptitle = Window_Party_Title.new
  421.     @win_cparty = Window_Party_Command.new
  422.     @win_show_actor = Window_Show_Actor_Info.new
  423.     #---------------------------------------------
  424.     @win_stitle = Window_Standby_Title.new
  425.     @win_cstandby = Window_Standby_Selectable.new
  426.     @win_show_actor_st = Window_Show_Actor_Info_ST.new
  427.     #---------------------------------------------
  428.    
  429.    
  430.     @members = []
  431.     for i in 0..$game_party.members.size-1
  432.       @members.push($game_party.members[i].id)
  433.     end
  434.    
  435.     @win_cstandby.active = false
  436.     self.refresh_selection
  437.    
  438.   end
  439.  
  440.   def update
  441.     @win_cparty.update
  442.     @win_cstandby.update
  443.     if Input.trigger?(Input::C)
  444.       if Flix_Disable_Actors::ACTOR_ID.has_value?@members[@win_cparty.index] or
  445.         Flix_Standby_Actors::ACTOR_ID==[]
  446.         Sound.play_buzzer
  447.       else
  448.        
  449.         if @win_cparty.active
  450.           Sound.play_decision
  451.           @win_cstandby.active = true
  452.           @win_cparty.active = false
  453.         elsif @win_cstandby.active
  454.           Sound.play_equip
  455.           @win_cstandby.active = false
  456.           @win_cparty.active = true
  457.          
  458.           if @members[@win_cparty.index] == nil
  459.             @members.delete_at(@win_cparty.index)
  460.             @members.push(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
  461.             $game_party.add_actor(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
  462.             Flix_Standby_Actors::ACTOR_ID.delete(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
  463.           else
  464.            
  465.             actor_id_buffer = @members[@win_cparty.index]
  466.             $game_party.remove_actor(@members[@win_cparty.index])
  467.             @members.delete(@members[@win_cparty.index])
  468.             @members.push(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
  469.             $game_party.add_actor(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
  470.             Flix_Standby_Actors::ACTOR_ID.delete(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
  471.             Flix_Standby_Actors::ACTOR_ID.push(actor_id_buffer)
  472.           end
  473.      
  474.         self.refresh_selection
  475.         self.command_window_refresh
  476.        
  477.         end
  478.        
  479.       end
  480.      
  481.     elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  482.       if @win_cparty.active
  483.         @win_show_actor.show_actor_info(@members[@win_cparty.index])
  484.       elsif @win_cstandby.active
  485.         @win_show_actor_st.show_actor_info(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
  486.       end
  487.  
  488.     elsif Input.trigger?(Input::A)
  489.       if @win_cstandby.active
  490.         Sound.play_buzzer
  491.       else
  492.  
  493.         if Flix_Disable_Actors::ACTOR_ID.has_value?@members[@win_cparty.index] or
  494.           @members[@win_cparty.index] == nil
  495.           Sound.play_buzzer
  496.         else
  497.           Sound.play_equip
  498.           actor_id_buffer = @members[@win_cparty.index]
  499.           @members.delete(@members[@win_cparty.index])
  500.           $game_party.remove_actor(actor_id_buffer)
  501.           Flix_Standby_Actors::ACTOR_ID.push(actor_id_buffer)
  502.          
  503.           self.command_window_refresh
  504.           self.refresh_selection
  505.          
  506.         end
  507.       end
  508.      
  509.     elsif Input.trigger?(Input::B)
  510.      
  511.       Sound.play_cancel
  512.      
  513.       if @win_cstandby.active
  514.         @win_cstandby.active = false
  515.         @win_cparty.active = true
  516.       else
  517.         $scene = Scene_Menu.new(4)
  518.       end
  519.  
  520.     end
  521.   end
  522.  
  523.   def command_window_refresh
  524.     @win_cparty.dispose
  525.     @win_cstandby.dispose
  526.     @win_cparty = Window_Party_Command.new
  527.     @win_cstandby = Window_Standby_Selectable.new
  528.     @win_cstandby.active = false
  529.   end
  530.  
  531.   def refresh_selection
  532.   @win_show_actor.show_actor_info(@members[0])
  533.     if Flix_Standby_Actors::ACTOR_ID!=[]
  534.       @win_show_actor_st.show_actor_info(Flix_Standby_Actors::ACTOR_ID[0])
  535.     end
  536.   end
  537.  
  538.   def terminate
  539.     @win_show_actor.dispose
  540.     @win_cparty.dispose
  541.     @win_title.dispose
  542.     @win_ptitle.dispose
  543.    
  544.     @win_stitle.dispose
  545.     @win_cstandby.dispose
  546.     @win_show_actor_st.dispose
  547.    
  548.     dispose_menu_background
  549.   end
  550.  
  551. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement