查看: 1467|回复: 4

[已经解决] 该整队脚本如何令右上方窗口里人数比最大战斗人员多1人

[复制链接]

虚空人形

梦石
0
星屑
4866
在线时间
2037 小时
注册时间
2011-8-11
回帖
3260

贵宾

发表于 2014-3-1 09:50:47 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 Sion 于 2014-3-7 10:58 编辑

脚本如下,示意图在脚本下方。
本来试着直接修改窗口内容的列数,
但是会发生错误。

如果可以的话,我希望可以直接指出需要修改的位置及内容。
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Party System v1.08
  4. # -- Last Updated: 2012.01.23
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-PartySystem"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.23 - Bug fixed: Party members are now rearranged when newly added.
  15. # 2012.01.14 - New Feature: Maximum Battle Members Variable added.
  16. # 2012.01.07 - Bug fixed: Error with removing members.
  17. # 2012.01.05 - Bug fixed: Escape skill/item effects no longer counts as death.
  18. # 2011.12.26 - Compatibility Update: New Game+
  19. # 2011.12.17 - Updated Spriteset_Battle to have updated sprite counts.
  20. # 2011.12.13 - Updated to provide better visual display when more than 5 pieces
  21. #              of equipment are equipped on an actor at a time.
  22. # 2011.12.05 - Added functionality to display faces in the Party Select Window.
  23. #            - Fixed bug that doesn't refresh the caterpillar when new members
  24. #              join the party.
  25. # 2011.12.04 - Started Script and Finished.
  26. #
  27. #==============================================================================
  28. # ▼ Introduction
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # RPG Maker VX Ace comes with a very nice party system. However, changing the
  31. # maximum number of members isn't possible without the aid of a script. This
  32. # script enables you the ability to change the maximum number of party members,
  33. # change EXP rates, and/or open up a separate party menu (if desired). In
  34. # addition to that, you can lock the position of actors within a party and
  35. # require other actors to be in the active party before continuing.
  36. #
  37. #==============================================================================
  38. # ▼ Instructions
  39. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40. # To install this script, open up your script editor and copy/paste this script
  41. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  42. #
  43. # -----------------------------------------------------------------------------
  44. # 脚本命令语句 - These commands are used with script calls.
  45. # -----------------------------------------------------------------------------
  46. # *IMPORTANT* These script calls require the new party menu to be enabled to
  47. # use them. Otherwise, nothing will happen.
  48. #
  49. # lock_actor(x)      锁定X角色在队伍中的位置
  50. # unlock_actor(x)
  51. # This will lock actor x in its current position in the party if the actor is
  52. # in the current party. The actor is unable to switch position and must remain
  53. # in that position until the lock is removed. Use the unlock script call to
  54. # remove the locked status. This script requires the actor to have joined and
  55. # in the current party before the script call will work.
  56. #
  57. # require_actor(x)   需要X角色参战
  58. # unrequire_actor(x)
  59. # This will cause the party to require actor x in order to continue. If the
  60. # actor isn't in the current party but is in the reserve party, the party menu
  61. # will open up and prompt the player to add the required actor into the party
  62. # before being able to continue. This script call will not function unless the
  63. # specific actor has joined the party, whether it is in the current or reserve.
  64. #
  65. # call_party_menu    打开队伍菜单
  66. # This will open up the party menu. This script call requires for the party
  67. # menu to be enabled to use.
  68. #
  69. #==============================================================================
  70. # ▼ Compatibility
  71. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  72. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  73. # it will run with RPG Maker VX without adjusting.
  74. #
  75. #==============================================================================

  76. module YEA
  77.   module PARTY
  78.    
  79.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  80.     # - General Party Settings -
  81.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82.     # In this section, you can adjust the general party settings for your game
  83.     # such as the maximum amount of members and whatnot, the EXP rate for
  84.     # party members in the reserve, etc.
  85.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  86.     MAX_BATTLE_MEMBERS   = 5      # 最大参战人员. Default: 4
  87.     SPLIT_EXP            = false  # 平分经验?Splits EXP with more members in the party.
  88.     RESERVE_EXP_RATE     = 0.50   # 休息人员的经验获得率Reserve EXP Rate. Default: 1.00
  89.    
  90.     # If you wish to be able to change the maximum number of battle members
  91.     # during the middle of your game, set this constant to a variable ID. If
  92.     # that variable ID is a number greater than 0, that variable will determine
  93.     # the current maximum number of battle members. Be cautious about using
  94.     # this during battle.
  95.     MAX_MEMBERS_VARIABLE = 0  #设置游戏中改变最大参战人员的变量
  96.    
  97.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  98.     # - Party Menu Settings -
  99.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  100.     # This section contains various menu settings for those who wish to use a
  101.     # menu separate for the party system. Here, adjust the menu command order,
  102.     # icons used, and other settings.
  103.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  104.     ENABLE_MENU = true   # Enables party menu. Default: false
  105.     COMMANDS =[          # The order at which the menu items are shown.
  106.     # [:command,  "Display"],
  107.       [ :change,  "更换",],
  108.       [ :remove,  "移除",],
  109.       [ :revert,  "还原",],
  110.       [ :finish,  "完成",],
  111.     ] # Do not remove this.
  112.     COMMAND_ALIGN    = 1     # 0:左对齐, 1:Center Align, 2:Right Align
  113.    
  114.     # These settings here are used for the upper right window: the Party Select
  115.     # window where the player selects a member to swap out or remove.
  116.     PARTY_FONT_SIZE  = 20    # Font size used for party member names.
  117.     LOCK_FIRST_ACTOR = false # Lock the first actor by default?
  118.     LOCKED_ICON      = 125   # Icon used for locked members.
  119.     REQUIRED_ICON    = 126   # Icon used for required members.
  120.     EMPTY_TEXT = "-Empty-"   # Text used when a member isn't present.
  121.     DISPLAY_FACE     = false # Display faces instead of sprites?
  122.    
  123.     # These settings here are used for the lower left window: the Party List
  124.     # window where the player selects a member to replace.
  125.     REMOVE_ICON      = 185          # Icon used for removing members.
  126.     REMOVE_TEXT      = "-Remove-"   # Text used for remove member command.
  127.     ACTOR_Y_BUFFER   = 12           # Amount the actor graphic be adjusted by.
  128.    
  129.     # These settings here are used for the lower right window: the Party Status
  130.     # window where info about a selected actor is shown.
  131.     NO_DATA         = "- No Data -" # Text used for when no actor is shown.
  132.     IN_PARTY_COLOUR = 6             # Text colour used for in party members.
  133.     STAT_FONT_SIZE  = 20            # Font size used for stats.
  134.     EQUIP_TEXT      = "Equipment"   # Text used to display equipment.
  135.    
  136.   end # PARTY
  137. end # YEA

  138. #==============================================================================
  139. # ▼ Editting anything past this point may potentially result in causing
  140. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  141. # halitosis so edit at your own risk.
  142. #==============================================================================

  143. #==============================================================================
  144. # ■ Icon
  145. #==============================================================================

  146. module Icon
  147.   
  148.   #--------------------------------------------------------------------------
  149.   # self.locked_party
  150.   #--------------------------------------------------------------------------
  151.   def self.locked_party; return YEA::PARTY::LOCKED_ICON; end
  152.   
  153.   #--------------------------------------------------------------------------
  154.   # self.required_party
  155.   #--------------------------------------------------------------------------
  156.   def self.required_party; return YEA::PARTY::REQUIRED_ICON; end
  157.   
  158.   #--------------------------------------------------------------------------
  159.   # self.remove_party
  160.   #--------------------------------------------------------------------------
  161.   def self.remove_party; return YEA::PARTY::REMOVE_ICON; end
  162.    
  163. end # Icon

  164. #==============================================================================
  165. # ■ Variable
  166. #==============================================================================

  167. module Variable
  168.   
  169.   #--------------------------------------------------------------------------
  170.   # self.max_battle_members
  171.   #--------------------------------------------------------------------------
  172.   def self.max_battle_members
  173.     default = YEA::PARTY::MAX_BATTLE_MEMBERS
  174.     return default if YEA::PARTY::MAX_MEMBERS_VARIABLE <= 0
  175.     return default if $game_variables[YEA::PARTY::MAX_MEMBERS_VARIABLE] <= 0
  176.     return $game_variables[YEA::PARTY::MAX_MEMBERS_VARIABLE]
  177.   end
  178.   
  179. end # Variable

  180. #==============================================================================
  181. # ■ Numeric
  182. #==============================================================================

  183. class Numeric
  184.   
  185.   #--------------------------------------------------------------------------
  186.   # new method: group_digits
  187.   #--------------------------------------------------------------------------
  188.   unless $imported["YEA-CoreEngine"]
  189.   def group; return self.to_s; end
  190.   end # $imported["YEA-CoreEngine"]
  191.    
  192. end # Numeric

  193. #==============================================================================
  194. # ■ Game_Actor
  195. #==============================================================================

  196. class Game_Actor < Game_Battler
  197.   
  198.   #--------------------------------------------------------------------------
  199.   # public instance variables
  200.   #--------------------------------------------------------------------------
  201.   attr_accessor :locked
  202.   attr_accessor :required
  203.   
  204.   #--------------------------------------------------------------------------
  205.   # alias method: setup
  206.   #--------------------------------------------------------------------------
  207.   alias game_actor_setup_ps setup
  208.   def setup(actor_id)
  209.     game_actor_setup_ps(actor_id)
  210.     @locked = false
  211.     @required = false
  212.   end
  213.   
  214.   #--------------------------------------------------------------------------
  215.   # overwrite method: final_exp_rate
  216.   #--------------------------------------------------------------------------
  217.   def final_exp_rate
  218.     n = exr * (battle_member? ? 1 : reserve_members_exp_rate)
  219.     if $game_party.in_battle
  220.       n /= [$game_party.battle_members.size, 1].max if YEA::PARTY::SPLIT_EXP
  221.     end
  222.     return n
  223.   end
  224.   
  225.   #--------------------------------------------------------------------------
  226.   # overwrite method: reserve_members_exp_rate
  227.   #--------------------------------------------------------------------------
  228.   def reserve_members_exp_rate
  229.     $data_system.opt_extra_exp ? YEA::PARTY::RESERVE_EXP_RATE : 0
  230.   end
  231.   
  232. end # Game_Actor

  233. #==============================================================================
  234. # ■ Game_Party
  235. #==============================================================================

  236. class Game_Party < Game_Unit
  237.   
  238.   #--------------------------------------------------------------------------
  239.   # public instance variables
  240.   #--------------------------------------------------------------------------
  241.   attr_accessor :battle_members_array
  242.   
  243.   #--------------------------------------------------------------------------
  244.   # alias method: initialize
  245.   #--------------------------------------------------------------------------
  246.   alias game_party_initialize_ps initialize
  247.   def initialize
  248.     game_party_initialize_ps
  249.     @battle_members_array = nil
  250.   end
  251.   
  252.   #--------------------------------------------------------------------------
  253.   # overwrite method: max_battle_members
  254.   #--------------------------------------------------------------------------
  255.   def max_battle_members; return Variable.max_battle_members; end
  256.   
  257.   #--------------------------------------------------------------------------
  258.   # alias method: setup_starting_members
  259.   #--------------------------------------------------------------------------
  260.   alias setup_starting_members_ps setup_starting_members
  261.   def setup_starting_members
  262.     setup_starting_members_ps
  263.     initialize_battle_members
  264.     return unless YEA::PARTY::LOCK_FIRST_ACTOR
  265.     return if members[0].nil?
  266.     members[0].locked = true
  267.   end
  268.   
  269.   #--------------------------------------------------------------------------
  270.   # alias method: setup_battle_test_members
  271.   #--------------------------------------------------------------------------
  272.   alias setup_battle_test_members_ps setup_battle_test_members
  273.   def setup_battle_test_members
  274.     setup_battle_test_members_ps
  275.     return unless YEA::PARTY::LOCK_FIRST_ACTOR
  276.     return if members[0].nil?
  277.     members[0].locked = true
  278.   end
  279.   
  280.   #--------------------------------------------------------------------------
  281.   # overwrite method: battle_members
  282.   #--------------------------------------------------------------------------
  283.   def battle_members
  284.     initialize_battle_members if initialize_battle_members?
  285.     array = []
  286.     for actor_id in @battle_members_array
  287.       break if array.size > max_battle_members
  288.       next if actor_id.nil?
  289.       next if $game_actors[actor_id].nil?
  290.       next unless $game_actors[actor_id].exist?
  291.       array.push($game_actors[actor_id])
  292.     end
  293.     return array
  294.   end
  295.   
  296.   #--------------------------------------------------------------------------
  297.   # new method: initialize_battle_members?
  298.   #--------------------------------------------------------------------------
  299.   def initialize_battle_members?
  300.     return true if @battle_members_array.nil?
  301.     return @battle_members_array.size != max_battle_members
  302.   end
  303.   
  304.   #--------------------------------------------------------------------------
  305.   # new method: initialize_battle_members
  306.   #--------------------------------------------------------------------------
  307.   def initialize_battle_members
  308.     @battle_members_array = []
  309.     for i in 0...max_battle_members
  310.       @battle_members_array.push(@actors[i]) unless @actors[i].nil?
  311.       @battle_members_array.push(0) if @actors[i].nil?
  312.     end
  313.     $game_player.refresh
  314.   end
  315.   
  316.   #--------------------------------------------------------------------------
  317.   # alias method: add_actor
  318.   #--------------------------------------------------------------------------
  319.   alias game_party_add_actor_ps add_actor
  320.   def add_actor(actor_id)
  321.     game_party_add_actor_ps(actor_id)
  322.     return if @battle_members_array.include?(actor_id)
  323.     return unless @battle_members_array.include?(0)
  324.     index = @battle_members_array.index(0)
  325.     @battle_members_array[index] = actor_id
  326.     $game_player.refresh
  327.     $game_map.need_refresh = true
  328.     rearrange_actors
  329.   end
  330.   
  331.   #--------------------------------------------------------------------------
  332.   # alias method: remove_actor
  333.   #--------------------------------------------------------------------------
  334.   alias game_party_remove_actor_ps remove_actor
  335.   def remove_actor(actor_id)
  336.     game_party_remove_actor_ps(actor_id)
  337.     return unless @battle_members_array.include?(actor_id)
  338.     index = @battle_members_array.index(actor_id)
  339.     @battle_members_array[index] = 0
  340.     $game_player.refresh
  341.     $game_map.need_refresh = true
  342.     rearrange_actors
  343.   end
  344.   
  345.   #--------------------------------------------------------------------------
  346.   # new method: rearrange_actors
  347.   #--------------------------------------------------------------------------
  348.   def rearrange_actors
  349.     initialize_battle_members if @battle_members_array.nil?
  350.     array = []
  351.     for actor_id in @battle_members_array
  352.       next if [0, nil].include?(actor_id)
  353.       next if $game_actors[actor_id].nil?
  354.       array.push(actor_id)
  355.     end
  356.     for actor_id in @actors
  357.       next if array.include?(actor_id)
  358.       next if $game_actors[actor_id].nil?
  359.       array.push(actor_id)
  360.     end
  361.     @actors = array
  362.   end
  363.   
  364. end # Game_Party

  365. #==============================================================================
  366. # ■ Game_Interpreter
  367. #==============================================================================

  368. class Game_Interpreter
  369.   
  370.   #--------------------------------------------------------------------------
  371.   # new method: lock_actor
  372.   #--------------------------------------------------------------------------
  373.   def lock_actor(actor_id)
  374.     return unless YEA::PARTY::ENABLE_MENU
  375.     actor = $game_actors[actor_id]
  376.     return unless $game_party.battle_members.include?(actor.id)
  377.     actor.locked = true
  378.   end
  379.   
  380.   #--------------------------------------------------------------------------
  381.   # new method: unlock_actor
  382.   #--------------------------------------------------------------------------
  383.   def unlock_actor(actor_id)
  384.     return unless YEA::PARTY::ENABLE_MENU
  385.     actor = $game_actors[actor_id]
  386.     return unless $game_party.battle_members.include?(actor.id)
  387.     actor.locked = false
  388.   end
  389.   
  390.   #--------------------------------------------------------------------------
  391.   # new method: require_actor
  392.   #--------------------------------------------------------------------------
  393.   def require_actor(actor_id)
  394.     return unless YEA::PARTY::ENABLE_MENU
  395.     return if $game_system.formation_disabled
  396.     actor = $game_actors[actor_id]
  397.     return unless $game_party.all_members.include?(actor)
  398.     actor.required = true
  399.     call_party_menu unless $game_party.battle_members.include?(actor)
  400.   end
  401.   
  402.   #--------------------------------------------------------------------------
  403.   # new method: unrequire_actor
  404.   #--------------------------------------------------------------------------
  405.   def unrequire_actor(actor_id)
  406.     return unless YEA::PARTY::ENABLE_MENU
  407.     return if $game_system.formation_disabled
  408.     actor = $game_actors[actor_id]
  409.     return unless $game_party.all_members.include?(actor)
  410.     actor.required = false
  411.     call_party_menu unless $game_party.battle_members.include?(actor)
  412.   end
  413.   
  414.   #--------------------------------------------------------------------------
  415.   # new method: call_party_menu
  416.   #--------------------------------------------------------------------------
  417.   def call_party_menu
  418.     return unless YEA::PARTY::ENABLE_MENU
  419.     return if $game_system.formation_disabled
  420.     SceneManager.call(Scene_Party)
  421.   end
  422.   
  423. end # Game_Interpreter

  424. #==============================================================================
  425. # ■ Spriteset_Battle
  426. #==============================================================================

  427. class Spriteset_Battle
  428.   
  429.   #--------------------------------------------------------------------------
  430.   # overwrite method: create_actors
  431.   #--------------------------------------------------------------------------
  432.   def create_actors
  433.     total = $game_party.max_battle_members
  434.     @actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) }
  435.   end
  436.   
  437. end # Spriteset_Battle

  438. #==============================================================================
  439. # ■ Window_PartyMenuCommand
  440. #==============================================================================

  441. class Window_PartyMenuCommand < Window_Command
  442.   
  443.   #--------------------------------------------------------------------------
  444.   # window_width
  445.   #--------------------------------------------------------------------------
  446.   def window_width; return 160; end
  447.   
  448.   #--------------------------------------------------------------------------
  449.   # visible_line_number
  450.   #--------------------------------------------------------------------------
  451.   def visible_line_number; 4; end
  452.   
  453.   #--------------------------------------------------------------------------
  454.   # alignment
  455.   #--------------------------------------------------------------------------
  456.   def alignment
  457.     return Menu.command_window_align if $imported["YEA-AceMenuEngine"]
  458.     return YEA::PARTY::COMMAND_ALIGN
  459.   end
  460.   
  461.   #--------------------------------------------------------------------------
  462.   # scene
  463.   #--------------------------------------------------------------------------
  464.   def scene; return SceneManager.scene; end
  465.   
  466.   #--------------------------------------------------------------------------
  467.   # make_command_list
  468.   #--------------------------------------------------------------------------
  469.   def make_command_list
  470.     for command in YEA::PARTY::COMMANDS
  471.       case command[0]
  472.       when :change, :remove, :revert
  473.         add_command(command[1], command[0])
  474.       when :finish
  475.         add_command(command[1], command[0], enable_cancel?)
  476.       else; next
  477.       end
  478.     end
  479.   end
  480.   
  481.   #--------------------------------------------------------------------------
  482.   # process_cancel
  483.   #--------------------------------------------------------------------------
  484.   def process_cancel
  485.     unless enable_cancel?
  486.       Sound.play_buzzer
  487.       return
  488.     end
  489.     super
  490.   end
  491.   
  492.   #--------------------------------------------------------------------------
  493.   # in_party?
  494.   #--------------------------------------------------------------------------
  495.   def in_party?(actor)
  496.     return $game_party.battle_members.include?(actor)
  497.   end
  498.   
  499.   #--------------------------------------------------------------------------
  500.   # enable_cancel?
  501.   #--------------------------------------------------------------------------
  502.   def enable_cancel?
  503.     return false if $game_party.battle_members.size <= 0
  504.     for actor in $game_party.all_members
  505.       next if in_party?(actor)
  506.       return false if actor.required
  507.       return false if actor.locked
  508.     end
  509.     return true
  510.   end
  511.   
  512. end # Window_PartyMenuCommand

  513. #==============================================================================
  514. # ■ Window_PartySelect
  515. #==============================================================================

  516. class Window_PartySelect < Window_Selectable
  517.   
  518.   #--------------------------------------------------------------------------
  519.   # initialize
  520.   #-------------------------------------------------------------------------
  521.   def initialize(command_window)
  522.     @command_window = command_window
  523.     super(160, 0, window_width, fitting_height(visible_line_number))
  524.     select(0)
  525.     deactivate
  526.     refresh
  527.   end
  528.   
  529.   #--------------------------------------------------------------------------
  530.   # col_max
  531.   #--------------------------------------------------------------------------
  532.   def col_max; return $game_party.max_battle_members; end
  533.   
  534.   #--------------------------------------------------------------------------
  535.   # item_max
  536.   #--------------------------------------------------------------------------
  537.   def item_max; return $game_party.max_battle_members; end
  538.   
  539.   #--------------------------------------------------------------------------
  540.   # window_width
  541.   #--------------------------------------------------------------------------
  542.   def window_width; return Graphics.width - 160; end
  543.   
  544.   #--------------------------------------------------------------------------
  545.   # visible_line_number
  546.   #--------------------------------------------------------------------------
  547.   def visible_line_number; 4; end
  548.   
  549.   #--------------------------------------------------------------------------
  550.   # item_rect
  551.   #--------------------------------------------------------------------------
  552.   def item_rect(index)
  553.     rect = Rect.new
  554.     rect.width = contents.width / item_max
  555.     rect.height = contents.height
  556.     rect.x = index * rect.width
  557.     rect.y = 0
  558.     return rect
  559.   end
  560.   
  561.   #--------------------------------------------------------------------------
  562.   # refresh
  563.   #--------------------------------------------------------------------------
  564.   def refresh
  565.     make_item_list
  566.     create_contents
  567.     draw_all_items
  568.   end
  569.   
  570.   #--------------------------------------------------------------------------
  571.   # make_item_list
  572.   #--------------------------------------------------------------------------
  573.   def make_item_list
  574.     @data = $game_party.battle_members_array.clone
  575.   end
  576.   
  577.   #--------------------------------------------------------------------------
  578.   # draw_item
  579.   #--------------------------------------------------------------------------
  580.   def draw_item(index)
  581.     actor = $game_actors[@data[index]]
  582.     rect = item_rect(index)
  583.     if actor.nil?
  584.       draw_empty(rect.clone)
  585.       return
  586.     end
  587.     dx = rect.width / 2
  588.     dy = rect.height - 16
  589.     draw_actor_face(actor, rect.x, rect.y) if display_face?
  590.     draw_actor_graphic(actor, rect.x + dx, rect.y + dy) unless display_face?
  591.     draw_actor_name(actor, rect)
  592.     draw_locked_icon(actor, rect)
  593.     draw_required_icon(actor, rect)
  594.   end
  595.   
  596.   #--------------------------------------------------------------------------
  597.   # display_face?
  598.   #--------------------------------------------------------------------------
  599.   def display_face?
  600.     return YEA::PARTY::DISPLAY_FACE
  601.   end
  602.   
  603.   #--------------------------------------------------------------------------
  604.   # draw_empty
  605.   #--------------------------------------------------------------------------
  606.   def draw_empty(rect)
  607.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  608.     rect.x += 2
  609.     rect.y += 2
  610.     rect.width -= 4
  611.     rect.height -= 4
  612.     contents.fill_rect(rect, colour)
  613.     reset_font_settings
  614.     change_color(system_color)
  615.     text = YEA::PARTY::EMPTY_TEXT
  616.     draw_text(rect, text, 1)
  617.     reset_font_settings
  618.   end
  619.   
  620.   #--------------------------------------------------------------------------
  621.   # draw_actor_name
  622.   #--------------------------------------------------------------------------
  623.   def draw_actor_name(actor, rect)
  624.     contents.font.size = YEA::PARTY::PARTY_FONT_SIZE
  625.     change_color(normal_color, actor.exist?)
  626.     draw_text(rect.x+4, rect.y, rect.width-8, line_height, actor.name, 1)
  627.   end
  628.   
  629.   #--------------------------------------------------------------------------
  630.   # draw_face
  631.   #--------------------------------------------------------------------------
  632.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  633.     bitmap = Cache.face(face_name)
  634.     dw = [96, item_rect(0).width-4].min
  635.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, dw, 92)
  636.     contents.blt(dx+2, dy+2, bitmap, rect, enabled ? 255 : translucent_alpha)
  637.     bitmap.dispose
  638.   end
  639.   
  640.   #--------------------------------------------------------------------------
  641.   # draw_locked_icon
  642.   #--------------------------------------------------------------------------
  643.   def draw_locked_icon(actor, rect)
  644.     return unless actor_locked?(actor)
  645.     draw_icon(Icon.locked_party, rect.x+rect.width-26, rect.height - 26)
  646.   end
  647.   
  648.   #--------------------------------------------------------------------------
  649.   # draw_required_icon
  650.   #--------------------------------------------------------------------------
  651.   def draw_required_icon(actor, rect)
  652.     return if actor_locked?(actor)
  653.     return unless actor_required?(actor)
  654.     draw_icon(Icon.required_party, rect.x+rect.width-26, rect.height - 26)
  655.   end
  656.   
  657.   #--------------------------------------------------------------------------
  658.   # actor_locked?
  659.   #--------------------------------------------------------------------------
  660.   def actor_locked?(actor); return actor.locked; end
  661.   
  662.   #--------------------------------------------------------------------------
  663.   # actor_required?
  664.   #--------------------------------------------------------------------------
  665.   def actor_required?(actor)
  666.     return false if actor.locked
  667.     return actor.required
  668.   end
  669.   
  670.   #--------------------------------------------------------------------------
  671.   # current_item_enabled?
  672.   #--------------------------------------------------------------------------
  673.   def current_item_enabled?; enable?(@data[index]); end
  674.   
  675.   #--------------------------------------------------------------------------
  676.   # enable?
  677.   #--------------------------------------------------------------------------
  678.   def enable?(item)
  679.     case @command_window.current_symbol
  680.     when :change
  681.       return true if item.nil?
  682.       return true if item == 0
  683.     when :remove
  684.       return false if item.nil?
  685.       return false if item == 0
  686.     end
  687.     actor = $game_actors[item]
  688.     return false if actor.locked
  689.     return false if actor.required
  690.     return true
  691.   end
  692.   
  693.   #--------------------------------------------------------------------------
  694.   # process_handling
  695.   #--------------------------------------------------------------------------
  696.   def process_handling
  697.     return unless open? && active
  698.     return process_ok       if ok_enabled?        && Input.trigger?(:C)
  699.     return process_cancel   if cancel_enabled?    && Input.trigger?(:B)
  700.     return process_pagedown if handle?(:pagedown) && Input.repeat?(:R)
  701.     return process_pageup   if handle?(:pageup)   && Input.repeat?(:L)
  702.   end
  703.   
  704.   #--------------------------------------------------------------------------
  705.   # cur_actor
  706.   #--------------------------------------------------------------------------
  707.   def cur_actor
  708.     actor_id = @data[index]
  709.     return $game_actors[actor_id]
  710.   end
  711.   
  712.   #--------------------------------------------------------------------------
  713.   # prev_actor
  714.   #--------------------------------------------------------------------------
  715.   def prev_actor
  716.     id = index == 0 ? @data.size - 1 : index - 1
  717.     actor_id = @data[id]
  718.     return $game_actors[actor_id]
  719.   end
  720.   
  721.   #--------------------------------------------------------------------------
  722.   # next_actor
  723.   #--------------------------------------------------------------------------
  724.   def next_actor
  725.     id = index == @data.size - 1 ? 0 : index + 1
  726.     actor_id = @data[id]
  727.     return $game_actors[actor_id]
  728.   end
  729.   
  730.   #--------------------------------------------------------------------------
  731.   # process_pageup
  732.   #--------------------------------------------------------------------------
  733.   def process_pageup
  734.     allow = true
  735.     allow = false if !prev_actor.nil? && prev_actor.locked
  736.     allow = false if !cur_actor.nil? && cur_actor.locked
  737.     Sound.play_buzzer unless allow
  738.     if allow
  739.       super
  740.       activate
  741.       select(index == 0 ? @data.size - 1 : index - 1)
  742.     end
  743.   end
  744.   
  745.   #--------------------------------------------------------------------------
  746.   # process_pagedown
  747.   #--------------------------------------------------------------------------
  748.   def process_pagedown
  749.     allow = true
  750.     allow = false if !next_actor.nil? && next_actor.locked
  751.     allow = false if !cur_actor.nil? && cur_actor.locked
  752.     Sound.play_buzzer unless allow
  753.     if allow
  754.       super
  755.       activate
  756.       select(index == @data.size - 1 ? 0 : index + 1)
  757.     end
  758.   end
  759.   
  760.   #--------------------------------------------------------------------------
  761.   # item
  762.   #--------------------------------------------------------------------------
  763.   def item; return @data[index]; end
  764.   
  765. end # Window_PartySelect

  766. #==============================================================================
  767. # ■ Window_PartyList
  768. #==============================================================================

  769. class Window_PartyList < Window_Selectable
  770.   
  771.   #--------------------------------------------------------------------------
  772.   # initialize
  773.   #-------------------------------------------------------------------------
  774.   def initialize(party_window)
  775.     super(0, fitting_height(4), window_width, window_height)
  776.     @party_window = party_window
  777.     select(1)
  778.     deactivate
  779.     refresh
  780.   end
  781.   
  782.   #--------------------------------------------------------------------------
  783.   # window_width
  784.   #--------------------------------------------------------------------------
  785.   def window_width; return 200; end
  786.   
  787.   #--------------------------------------------------------------------------
  788.   # window_height
  789.   #--------------------------------------------------------------------------
  790.   def window_height; return Graphics.height - fitting_height(4); end
  791.   
  792.   #--------------------------------------------------------------------------
  793.   # item_max
  794.   #--------------------------------------------------------------------------
  795.   def item_max; return @data ? @data.size : 1; end
  796.   
  797.   #--------------------------------------------------------------------------
  798.   # refresh
  799.   #--------------------------------------------------------------------------
  800.   def refresh
  801.     make_item_list
  802.     create_contents
  803.     draw_all_items
  804.   end
  805.   
  806.   #--------------------------------------------------------------------------
  807.   # make_item_list
  808.   #--------------------------------------------------------------------------
  809.   def make_item_list
  810.     @data = [0]
  811.     for member in $game_party.all_members
  812.       next if member.nil?
  813.       @data.push(member.id)
  814.     end
  815.     @data.push(0)
  816.   end
  817.   
  818.   #--------------------------------------------------------------------------
  819.   # draw_item
  820.   #--------------------------------------------------------------------------
  821.   def draw_item(index)
  822.     clear_item(index)
  823.     rect = item_rect(index)
  824.     if @data[index] == 0
  825.       draw_remove(rect)
  826.       return
  827.     end
  828.     actor = $game_actors[@data[index]]
  829.     draw_actor(actor, rect)
  830.     draw_actor_locked(actor, rect)
  831.     draw_actor_required(actor, rect)
  832.   end
  833.   
  834.   #--------------------------------------------------------------------------
  835.   # draw_remove
  836.   #--------------------------------------------------------------------------
  837.   def draw_remove(rect)
  838.     reset_font_settings
  839.     draw_icon(Icon.remove_party, rect.x+4, rect.y)
  840.     text = YEA::PARTY::REMOVE_TEXT
  841.     draw_text(rect.x+32, rect.y, rect.width-32, line_height, text)
  842.   end
  843.   
  844.   #--------------------------------------------------------------------------
  845.   # draw_actor
  846.   #--------------------------------------------------------------------------
  847.   def draw_actor(actor, rect)
  848.     buffer = YEA::PARTY::ACTOR_Y_BUFFER
  849.     draw_actor_graphic(actor, rect.x + 16, rect.y + rect.height + buffer)
  850.     text = actor.name
  851.     change_color(list_colour(actor), enabled?(actor))
  852.     draw_text(rect.x+32, rect.y, rect.width-32, line_height, text)
  853.   end
  854.   
  855.   #--------------------------------------------------------------------------
  856.   # list_colour
  857.   #--------------------------------------------------------------------------
  858.   def list_colour(actor)
  859.     return text_color(YEA::PARTY::IN_PARTY_COLOUR) if in_party?(actor)
  860.     return normal_color
  861.   end
  862.   
  863.   #--------------------------------------------------------------------------
  864.   # draw_actor_locked
  865.   #--------------------------------------------------------------------------
  866.   def draw_actor_locked(actor, rect)
  867.     return unless actor.locked
  868.     draw_icon(Icon.locked_party, rect.width-24, rect.y)
  869.   end
  870.   
  871.   #--------------------------------------------------------------------------
  872.   # draw_actor_required
  873.   #--------------------------------------------------------------------------
  874.   def draw_actor_required(actor, rect)
  875.     return if actor.locked
  876.     return unless actor.required
  877.     draw_icon(Icon.required_party, rect.width-24, rect.y)
  878.   end
  879.   
  880.   #--------------------------------------------------------------------------
  881.   # enabled?
  882.   #--------------------------------------------------------------------------
  883.   def enabled?(actor)
  884.     return false if actor.locked
  885.     return false if actor.required && in_party?(actor)
  886.     return actor.exist?
  887.   end
  888.   
  889.   #--------------------------------------------------------------------------
  890.   # in_party?
  891.   #--------------------------------------------------------------------------
  892.   def in_party?(actor); return $game_party.battle_members.include?(actor); end
  893.   
  894.   #--------------------------------------------------------------------------
  895.   # current_item_enabled?
  896.   #--------------------------------------------------------------------------
  897.   def current_item_enabled?
  898.     actor = $game_actors[item]
  899.     replace = $game_actors[@party_window.item]
  900.     unless actor.nil?
  901.       return false if actor.locked && in_party?(actor)
  902.       return false if actor.required && in_party?(actor)
  903.     end
  904.     return true if replace.nil?
  905.     return false if replace.locked
  906.     return false if replace.required
  907.     return true if actor.nil?
  908.     return actor.exist?
  909.   end
  910.   
  911.   #--------------------------------------------------------------------------
  912.   # item
  913.   #--------------------------------------------------------------------------
  914.   def item; return @data[index]; end
  915.   
  916. end # Window_PartyList

  917. #==============================================================================
  918. # ** Window_PartyStatus
  919. #==============================================================================

  920. class Window_PartyStatus < Window_Base
  921.   
  922.   #--------------------------------------------------------------------------
  923.   # initialize
  924.   #--------------------------------------------------------------------------
  925.   def initialize(party_window, list_window)
  926.     super(200, fitting_height(4), window_width, window_height)
  927.     @party_window = party_window
  928.     @list_window = list_window
  929.     [url=home.php?mod=space&uid=95897]@actor[/url] = active_actor
  930.     refresh
  931.   end
  932.   
  933.   #--------------------------------------------------------------------------
  934.   # window_width
  935.   #--------------------------------------------------------------------------
  936.   def window_width; Graphics.width - 200; end
  937.   
  938.   #--------------------------------------------------------------------------
  939.   # window_height
  940.   #--------------------------------------------------------------------------
  941.   def window_height; Graphics.height - fitting_height(4); end
  942.   
  943.   #--------------------------------------------------------------------------
  944.   # update
  945.   #--------------------------------------------------------------------------
  946.   def update
  947.     super
  948.     refresh if [url=home.php?mod=space&uid=95897]@actor[/url] != active_actor
  949.   end
  950.   
  951.   #--------------------------------------------------------------------------
  952.   # active_actor
  953.   #--------------------------------------------------------------------------
  954.   def active_actor
  955.     if @list_window.active
  956.       actor = @list_window.item
  957.     else
  958.       actor = @party_window.item
  959.     end
  960.     return nil if [0, nil].include?(actor)
  961.     return actor
  962.   end
  963.   
  964.   #--------------------------------------------------------------------------
  965.   # refresh
  966.   #--------------------------------------------------------------------------
  967.   def refresh
  968.     contents.clear
  969.     [url=home.php?mod=space&uid=95897]@actor[/url] = active_actor
  970.     reset_font_settings
  971.     if @actor.nil?
  972.       draw_nil_actor
  973.       return
  974.     end
  975.     actor = $game_actors[@actor]
  976.     draw_actor_face(actor, 0, 0)
  977.     draw_actor_name(actor, 108, 0)
  978.     draw_actor_class(actor, 228, 0, contents.width-232)
  979.     draw_actor_level(actor, 108, line_height)
  980.     draw_actor_icons(actor, 228, line_height, contents.width-232)
  981.     draw_actor_hp(actor, 108, line_height*2, contents.width-112)
  982.     draw_actor_mp(actor, 108, line_height*3, contents.width-112)
  983.     draw_actor_parameters(actor, 0, line_height*4 + line_height/2)
  984.     draw_equipments(actor, contents.width/2, line_height*4 + line_height/2)
  985.   end
  986.   
  987.   #--------------------------------------------------------------------------
  988.   # draw_nil_actor
  989.   #--------------------------------------------------------------------------
  990.   def draw_nil_actor
  991.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  992.     rect = Rect.new(0, 0, contents.width, contents.height)
  993.     contents.fill_rect(rect, colour)
  994.     change_color(system_color)
  995.     text = YEA::PARTY::NO_DATA
  996.     draw_text(rect, text, 1)
  997.   end
  998.   
  999.   #--------------------------------------------------------------------------
  1000.   # draw_actor_parameters
  1001.   #--------------------------------------------------------------------------
  1002.   def draw_actor_parameters(actor, dx, dy)
  1003.     dw = contents.width/2 - 4
  1004.     rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  1005.     contents.font.size = YEA::PARTY::STAT_FONT_SIZE
  1006.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  1007.     array = [:atk, :def, :mat, :mdf, :agi, :luk]
  1008.     cx = 4
  1009.     for stat in array
  1010.       case stat
  1011.       when :atk
  1012.         param = Vocab::param(2)
  1013.         value = actor.atk.group
  1014.       when :def
  1015.         param = Vocab::param(3)
  1016.         value = actor.def.group
  1017.       when :mat
  1018.         param = Vocab::param(4)
  1019.         value = actor.mat.group
  1020.       when :mdf
  1021.         param = Vocab::param(5)
  1022.         value = actor.mdf.group
  1023.       when :agi
  1024.         param = Vocab::param(6)
  1025.         value = actor.agi.group
  1026.       when :luk
  1027.         param = Vocab::param(7)
  1028.         value = actor.luk.group
  1029.       else; next
  1030.       end
  1031.       contents.fill_rect(rect, colour)
  1032.       change_color(system_color)
  1033.       draw_text(rect.x + cx, rect.y, rect.width-cx*2, line_height, param, 0)
  1034.       change_color(normal_color)
  1035.       draw_text(rect.x + cx, rect.y, rect.width-cx*2, line_height, value, 2)
  1036.       rect.y += line_height
  1037.     end
  1038.     reset_font_settings
  1039.   end
  1040.   
  1041.   #--------------------------------------------------------------------------
  1042.   # draw_equipments
  1043.   #--------------------------------------------------------------------------
  1044.   def draw_equipments(actor, dx, dy)
  1045.     text = YEA::PARTY::EQUIP_TEXT
  1046.     change_color(system_color)
  1047.     draw_text(dx, dy, contents.width - dx, line_height, text, 1)
  1048.     dy += line_height
  1049.     if actor.equips.size <= 5
  1050.       actor.equips.each_with_index do |item, i|
  1051.         draw_item_name(item, dx, dy + line_height * i)
  1052.       end
  1053.     else
  1054.       orig_x = dx
  1055.       actor.equips.each_with_index do |item, i|
  1056.         next if item.nil?
  1057.         draw_icon(item.icon_index, dx, dy)
  1058.         dy += line_height if dx + 48 > contents.width
  1059.         dx = dx + 48 > contents.width ? orig_x : dx + 24
  1060.       end
  1061.     end
  1062.   end
  1063.   
  1064. end # Window_PartyStatus

  1065. #==============================================================================
  1066. # ■ Scene_Menu
  1067. #==============================================================================

  1068. class Scene_Menu < Scene_MenuBase
  1069.   
  1070.   #--------------------------------------------------------------------------
  1071.   # overwrite method: command_formation
  1072.   #--------------------------------------------------------------------------
  1073.   if YEA::PARTY::ENABLE_MENU
  1074.   def command_formation
  1075.     SceneManager.call(Scene_Party)
  1076.   end
  1077.   end # YEA::PARTY::ENABLE_MENU
  1078.   
  1079. end # Scene_Menu

  1080. #==============================================================================
  1081. # ■ Scene_Party
  1082. #==============================================================================

  1083. class Scene_Party < Scene_MenuBase
  1084.   
  1085.   #--------------------------------------------------------------------------
  1086.   # start
  1087.   #--------------------------------------------------------------------------
  1088.   def start
  1089.     super
  1090.     @former_party = $game_party.battle_members_array.clone
  1091.     create_command_window
  1092.     create_party_window
  1093.     create_list_window
  1094.     create_status_window
  1095.   end
  1096.   
  1097.   #--------------------------------------------------------------------------
  1098.   # create_command_window
  1099.   #--------------------------------------------------------------------------
  1100.   def create_command_window
  1101.     @command_window = Window_PartyMenuCommand.new(0, 0)
  1102.     @command_window.set_handler(:change, method(:adjust_members))
  1103.     @command_window.set_handler(:remove, method(:adjust_members))
  1104.     @command_window.set_handler(:revert, method(:revert_party))
  1105.     @command_window.set_handler(:finish, method(:return_scene))
  1106.     @command_window.set_handler(:cancel, method(:return_scene))
  1107.   end
  1108.   
  1109.   #--------------------------------------------------------------------------
  1110.   # create_party_window
  1111.   #--------------------------------------------------------------------------
  1112.   def create_party_window
  1113.     @party_window = Window_PartySelect.new(@command_window)
  1114.     @party_window.set_handler(:ok,       method(:on_party_ok))
  1115.     @party_window.set_handler(:cancel,   method(:on_party_cancel))
  1116.     @party_window.set_handler(:pageup,   method(:on_party_pageup))
  1117.     @party_window.set_handler(:pagedown, method(:on_party_pagedown))
  1118.   end
  1119.   
  1120.   #--------------------------------------------------------------------------
  1121.   # create_list_window
  1122.   #--------------------------------------------------------------------------
  1123.   def create_list_window
  1124.     @list_window = Window_PartyList.new(@party_window)
  1125.     @list_window.set_handler(:ok,     method(:on_list_ok))
  1126.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  1127.   end
  1128.   
  1129.   #--------------------------------------------------------------------------
  1130.   # create_status_window
  1131.   #--------------------------------------------------------------------------
  1132.   def create_status_window
  1133.     @status_window = Window_PartyStatus.new(@party_window, @list_window)
  1134.   end
  1135.   
  1136.   #--------------------------------------------------------------------------
  1137.   # adjust_members
  1138.   #--------------------------------------------------------------------------
  1139.   def adjust_members
  1140.     @party_window.activate
  1141.   end
  1142.   
  1143.   #--------------------------------------------------------------------------
  1144.   # window_refresh
  1145.   #--------------------------------------------------------------------------
  1146.   def window_refresh
  1147.     $game_party.rearrange_actors
  1148.     @command_window.refresh
  1149.     @party_window.refresh
  1150.     @list_window.refresh
  1151.     $game_player.refresh
  1152.     $game_map.need_refresh = true
  1153.   end
  1154.   
  1155.   #--------------------------------------------------------------------------
  1156.   # revert_party
  1157.   #--------------------------------------------------------------------------
  1158.   def revert_party
  1159.     @command_window.activate
  1160.     $game_party.battle_members_array = @former_party.clone
  1161.     window_refresh
  1162.   end
  1163.   
  1164.   #--------------------------------------------------------------------------
  1165.   # on_party_ok
  1166.   #--------------------------------------------------------------------------
  1167.   def on_party_ok
  1168.     case @command_window.current_symbol
  1169.     when :change
  1170.       @list_window.activate
  1171.     when :remove
  1172.       index = @party_window.index
  1173.       actor = $game_actors[$game_party.battle_members_array[index]]
  1174.       Sound.play_equip
  1175.       $game_party.battle_members_array[index] = 0
  1176.       window_refresh
  1177.       @party_window.activate
  1178.     end
  1179.   end
  1180.   
  1181.   #--------------------------------------------------------------------------
  1182.   # on_party_cancel
  1183.   #--------------------------------------------------------------------------
  1184.   def on_party_cancel
  1185.     @command_window.activate
  1186.   end
  1187.   
  1188.   #--------------------------------------------------------------------------
  1189.   # on_party_pageup
  1190.   #--------------------------------------------------------------------------
  1191.   def on_party_pageup
  1192.     Sound.play_equip
  1193.     actor_id1 = @party_window.item
  1194.     actor_id2 = @party_window.prev_actor.nil? ? 0 : @party_window.prev_actor.id
  1195.     max = @party_window.item_max-1
  1196.     index1 = @party_window.index
  1197.     index2 = @party_window.index == 0 ? max : index1-1
  1198.     $game_party.battle_members_array[index1] = actor_id2
  1199.     $game_party.battle_members_array[index2] = actor_id1
  1200.     window_refresh
  1201.   end
  1202.   
  1203.   #--------------------------------------------------------------------------
  1204.   # on_party_pagedown
  1205.   #--------------------------------------------------------------------------
  1206.   def on_party_pagedown
  1207.     Sound.play_equip
  1208.     actor_id1 = @party_window.item
  1209.     actor_id2 = @party_window.next_actor.nil? ? 0 : @party_window.next_actor.id
  1210.     max = @party_window.item_max-1
  1211.     index1 = @party_window.index
  1212.     index2 = @party_window.index == max ? 0 : index1+1
  1213.     $game_party.battle_members_array[index1] = actor_id2
  1214.     $game_party.battle_members_array[index2] = actor_id1
  1215.     window_refresh
  1216.   end
  1217.   
  1218.   #--------------------------------------------------------------------------
  1219.   # on_list_cancel
  1220.   #--------------------------------------------------------------------------
  1221.   def on_list_cancel
  1222.     @party_window.activate
  1223.   end
  1224.   
  1225.   #--------------------------------------------------------------------------
  1226.   # on_list_ok
  1227.   #--------------------------------------------------------------------------
  1228.   def on_list_ok
  1229.     Sound.play_equip
  1230.     replace = $game_actors[@party_window.item]
  1231.     actor = $game_actors[@list_window.item]
  1232.     index1 = @party_window.index
  1233.     actor_id1 = actor.nil? ? 0 : actor.id
  1234.     if actor.nil?
  1235.       $game_party.battle_members_array[index1] = 0
  1236.       window_refresh
  1237.       @party_window.activate
  1238.       return
  1239.     end
  1240.     actor_id2 = replace.nil? ? 0 : replace.id
  1241.     if $game_party.battle_members_array.include?(actor_id1)
  1242.       index2 = $game_party.battle_members_array.index(actor_id1)
  1243.       $game_party.battle_members_array[index2] = actor_id2
  1244.     end
  1245.     $game_party.battle_members_array[index1] = actor_id1
  1246.     window_refresh
  1247.     @party_window.activate
  1248.   end
  1249.   
  1250. end # Scene_Party

  1251. #==============================================================================
  1252. #
  1253. # ▼ End of File
  1254. #
  1255. #==============================================================================
复制代码
未命名2.jpg

点评

修改321行的 def initialize_battle_members中的battle_members_array生成算法,可以加替补人员。  发表于 2014-3-1 20:22
梦石
0
星屑
1478
在线时间
993 小时
注册时间
2011-5-11
回帖
418
发表于 2014-3-2 18:23:16 | 显示全部楼层
本帖最后由 345912390 于 2014-3-3 19:50 编辑

脚本已修改!自行测试看是不是自己想要的。
#***#为修改或增加的部分!为排版好看改为4人参战!

修复了后备队员为空的Bug
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Party System v1.08
  4. # -- Last Updated: 2012.01.23
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-PartySystem"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.23 - Bug fixed: Party members are now rearranged when newly added.
  15. # 2012.01.14 - New Feature: Maximum Battle Members Variable added.
  16. # 2012.01.07 - Bug fixed: Error with removing members.
  17. # 2012.01.05 - Bug fixed: Escape skill/item effects no longer counts as death.
  18. # 2011.12.26 - Compatibility Update: New Game+
  19. # 2011.12.17 - Updated Spriteset_Battle to have updated sprite counts.
  20. # 2011.12.13 - Updated to provide better visual display when more than 5 pieces
  21. #              of equipment are equipped on an actor at a time.
  22. # 2011.12.05 - Added functionality to display faces in the Party Select Window.
  23. #            - Fixed bug that doesn't refresh the caterpillar when new members
  24. #              join the party.
  25. # 2011.12.04 - Started Script and Finished.
  26. #
  27. #==============================================================================
  28. # ▼ Introduction
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # RPG Maker VX Ace comes with a very nice party system. However, changing the
  31. # maximum number of members isn't possible without the aid of a script. This
  32. # script enables you the ability to change the maximum number of party members,
  33. # change EXP rates, and/or open up a separate party menu (if desired). In
  34. # addition to that, you can lock the position of actors within a party and
  35. # require other actors to be in the active party before continuing.
  36. #
  37. #==============================================================================
  38. # ▼ Instructions
  39. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40. # To install this script, open up your script editor and copy/paste this script
  41. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  42. #
  43. # -----------------------------------------------------------------------------
  44. # Script Calls - These commands are used with script calls.
  45. # -----------------------------------------------------------------------------
  46. # *IMPORTANT* These script calls require the new party menu to be enabled to
  47. # use them. Otherwise, nothing will happen.
  48. #
  49. # lock_actor(x)
  50. # unlock_actor(x)
  51. # This will lock actor x in its current position in the party if the actor is
  52. # in the current party. The actor is unable to switch position and must remain
  53. # in that position until the lock is removed. Use the unlock script call to
  54. # remove the locked status. This script requires the actor to have joined and
  55. # in the current party before the script call will work.
  56. #
  57. # require_actor(x)
  58. # unrequire_actor(x)
  59. # This will cause the party to require actor x in order to continue. If the
  60. # actor isn't in the current party but is in the reserve party, the party menu
  61. # will open up and prompt the player to add the required actor into the party
  62. # before being able to continue. This script call will not function unless the
  63. # specific actor has joined the party, whether it is in the current or reserve.
  64. #
  65. # call_party_menu
  66. # This will open up the party menu. This script call requires for the party
  67. # menu to be enabled to use.
  68. #
  69. #==============================================================================
  70. # ▼ Compatibility
  71. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  72. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  73. # it will run with RPG Maker VX without adjusting.
  74. #
  75. #==============================================================================

  76. module YEA
  77.   module PARTY
  78.    
  79.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  80.     # - General Party Settings -
  81.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82.     # In this section, you can adjust the general party settings for your game
  83.     # such as the maximum amount of members and whatnot, the EXP rate for
  84.     # party members in the reserve, etc.
  85.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  86.     MAX_BATTLE_MEMBERS   = 4      # Maximum party members. Default: 4
  87.     SPLIT_EXP            = false  # Splits EXP with more members in the party.
  88.     RESERVE_EXP_RATE     = 0.50   # Reserve EXP Rate. Default: 1.00
  89.    
  90.     # If you wish to be able to change the maximum number of battle members
  91.     # during the middle of your game, set this constant to a variable ID. If
  92.     # that variable ID is a number greater than 0, that variable will determine
  93.     # the current maximum number of battle members. Be cautious about using
  94.     # this during battle.
  95.     MAX_MEMBERS_VARIABLE = 0
  96.    
  97.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  98.     # - Party Menu Settings -
  99.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  100.     # This section contains various menu settings for those who wish to use a
  101.     # menu separate for the party system. Here, adjust the menu command order,
  102.     # icons used, and other settings.
  103.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  104.     ENABLE_MENU = true   # Enables party menu. Default: false
  105.     COMMANDS =[          # The order at which the menu items are shown.
  106.     # [:command,  "Display"],
  107.       [ :change,  "Change",],
  108.       [ :remove,  "Remove",],
  109.       [ :revert,  "Revert",],
  110.       [ :finish,  "Finish",],
  111.     ] # Do not remove this.
  112.     COMMAND_ALIGN    = 1     # 0:Left Align, 1:Center Align, 2:Right Align
  113.    
  114.     # These settings here are used for the upper right window: the Party Select
  115.     # window where the player selects a member to swap out or remove.
  116.     PARTY_FONT_SIZE  = 20    # Font size used for party member names.
  117.     LOCK_FIRST_ACTOR = false # Lock the first actor by default?
  118.     LOCKED_ICON      = 125   # Icon used for locked members.
  119.     REQUIRED_ICON    = 126   # Icon used for required members.
  120.     EMPTY_TEXT = "-Empty-"   # Text used when a member isn't present.
  121.     DISPLAY_FACE     = false # Display faces instead of sprites?
  122.    
  123.     # These settings here are used for the lower left window: the Party List
  124.     # window where the player selects a member to replace.
  125.     REMOVE_ICON      = 185          # Icon used for removing members.
  126.     REMOVE_TEXT      = "-Remove-"   # Text used for remove member command.
  127.     ACTOR_Y_BUFFER   = 12           # Amount the actor graphic be adjusted by.
  128.    
  129.     # These settings here are used for the lower right window: the Party Status
  130.     # window where info about a selected actor is shown.
  131.     NO_DATA         = "- No Data -" # Text used for when no actor is shown.
  132.     IN_PARTY_COLOUR = 6             # Text colour used for in party members.
  133.     STAT_FONT_SIZE  = 20            # Font size used for stats.
  134.     EQUIP_TEXT      = "Equipment"   # Text used to display equipment.
  135.    
  136.   end # PARTY
  137. end # YEA

  138. #==============================================================================
  139. # ▼ Editting anything past this point may potentially result in causing
  140. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  141. # halitosis so edit at your own risk.
  142. #==============================================================================

  143. #==============================================================================
  144. # ■ Icon
  145. #==============================================================================

  146. module Icon
  147.   
  148.   #--------------------------------------------------------------------------
  149.   # self.locked_party
  150.   #--------------------------------------------------------------------------
  151.   def self.locked_party; return YEA::PARTY::LOCKED_ICON; end
  152.   
  153.   #--------------------------------------------------------------------------
  154.   # self.required_party
  155.   #--------------------------------------------------------------------------
  156.   def self.required_party; return YEA::PARTY::REQUIRED_ICON; end
  157.   
  158.   #--------------------------------------------------------------------------
  159.   # self.remove_party
  160.   #--------------------------------------------------------------------------
  161.   def self.remove_party; return YEA::PARTY::REMOVE_ICON; end
  162.    
  163. end # Icon

  164. #==============================================================================
  165. # ■ Variable
  166. #==============================================================================

  167. module Variable
  168.   
  169.   #--------------------------------------------------------------------------
  170.   # self.max_battle_members
  171.   #--------------------------------------------------------------------------
  172.   def self.max_battle_members
  173.     default = YEA::PARTY::MAX_BATTLE_MEMBERS
  174.     return default if YEA::PARTY::MAX_MEMBERS_VARIABLE <= 0
  175.     return default if $game_variables[YEA::PARTY::MAX_MEMBERS_VARIABLE] <= 0
  176.     return $game_variables[YEA::PARTY::MAX_MEMBERS_VARIABLE]
  177.   end
  178.   
  179. end # Variable

  180. #==============================================================================
  181. # ■ Numeric
  182. #==============================================================================

  183. class Numeric
  184.   
  185.   #--------------------------------------------------------------------------
  186.   # new method: group_digits
  187.   #--------------------------------------------------------------------------
  188.   unless $imported["YEA-CoreEngine"]
  189.   def group; return self.to_s; end
  190.   end # $imported["YEA-CoreEngine"]
  191.    
  192. end # Numeric

  193. #==============================================================================
  194. # ■ Game_Actor
  195. #==============================================================================

  196. class Game_Actor < Game_Battler
  197.   
  198.   #--------------------------------------------------------------------------
  199.   # public instance variables
  200.   #--------------------------------------------------------------------------
  201.   attr_accessor :locked
  202.   attr_accessor :required
  203.   
  204.   #--------------------------------------------------------------------------
  205.   # alias method: setup
  206.   #--------------------------------------------------------------------------
  207.   alias game_actor_setup_ps setup
  208.   def setup(actor_id)
  209.     game_actor_setup_ps(actor_id)
  210.     @locked = false
  211.     @required = false
  212.   end
  213.   
  214.   #--------------------------------------------------------------------------
  215.   # overwrite method: final_exp_rate
  216.   #--------------------------------------------------------------------------
  217.   def final_exp_rate
  218.     n = exr * (battle_member? ? 1 : reserve_members_exp_rate)
  219.     if $game_party.in_battle
  220.       n /= [$game_party.battle_members.size, 1].max if YEA::PARTY::SPLIT_EXP
  221.     end
  222.     return n
  223.   end
  224.   
  225.   #--------------------------------------------------------------------------
  226.   # overwrite method: reserve_members_exp_rate
  227.   #--------------------------------------------------------------------------
  228.   def reserve_members_exp_rate
  229.     $data_system.opt_extra_exp ? YEA::PARTY::RESERVE_EXP_RATE : 0
  230.   end
  231.   
  232. end # Game_Actor

  233. #==============================================================================
  234. # ■ Game_Party
  235. #==============================================================================

  236. class Game_Party < Game_Unit
  237.   
  238.   #--------------------------------------------------------------------------
  239.   # public instance variables
  240.   #--------------------------------------------------------------------------
  241.   attr_accessor :battle_members_array
  242.   attr_accessor :tmp_remove_actor#***#
  243.   #--------------------------------------------------------------------------
  244.   # alias method: initialize
  245.   #--------------------------------------------------------------------------
  246.   alias game_party_initialize_ps initialize
  247.   def initialize
  248.     game_party_initialize_ps
  249.     @battle_members_array = nil
  250.     @tmp_remove_actor=nil#***#
  251.   end
  252.   
  253.   #--------------------------------------------------------------------------
  254.   # overwrite method: max_battle_members
  255.   #--------------------------------------------------------------------------
  256.   def max_battle_members; return Variable.max_battle_members; end
  257.   
  258.   #--------------------------------------------------------------------------
  259.   # alias method: setup_starting_members
  260.   #--------------------------------------------------------------------------
  261.   alias setup_starting_members_ps setup_starting_members
  262.   def setup_starting_members
  263.     setup_starting_members_ps
  264.     initialize_battle_members
  265.     return unless YEA::PARTY::LOCK_FIRST_ACTOR
  266.     return if members[0].nil?
  267.     members[0].locked = true
  268.   end
  269.   
  270.   #--------------------------------------------------------------------------
  271.   # alias method: setup_battle_test_members
  272.   #--------------------------------------------------------------------------
  273.   alias setup_battle_test_members_ps setup_battle_test_members
  274.   def setup_battle_test_members
  275.     setup_battle_test_members_ps
  276.     return unless YEA::PARTY::LOCK_FIRST_ACTOR
  277.     return if members[0].nil?
  278.     members[0].locked = true
  279.   end
  280.   
  281.   #--------------------------------------------------------------------------
  282.   # overwrite method: battle_members
  283.   #--------------------------------------------------------------------------
  284.   def battle_members
  285.     initialize_battle_members if initialize_battle_members?
  286.     array = []
  287.     for actor_id in @battle_members_array
  288.       break if array.size > max_battle_members
  289.       next if actor_id.nil?
  290.       next if $game_actors[actor_id].nil?
  291.       next unless $game_actors[actor_id].exist?
  292.       #array.push($game_actors[actor_id])
  293.       #***#
  294.       if max_battle_members<all_members.size then
  295.         if actor_id !=@battle_members_array[@battle_members_array.size-1] then
  296.           array.push($game_actors[actor_id])
  297.         end
  298.       else
  299.         array.push($game_actors[actor_id])
  300.       end
  301.       #***#
  302.     end
  303.     return array
  304.   end
  305.   
  306.   #--------------------------------------------------------------------------
  307.   # new method: initialize_battle_members?
  308.   #--------------------------------------------------------------------------
  309.   def initialize_battle_members?
  310.     return true if @battle_members_array.nil?
  311.     #return @battle_members_array.size != max_battle_members
  312.     #***#
  313.     if max_battle_members<all_members.size then
  314.       return @battle_members_array.size != max_battle_members+1
  315.     else
  316.       return @battle_members_array.size != max_battle_members
  317.     end
  318.     #***#
  319.   end
  320.   
  321.   #--------------------------------------------------------------------------
  322.   # new method: initialize_battle_members
  323.   #--------------------------------------------------------------------------
  324.   def initialize_battle_members
  325.     @battle_members_array = []
  326.     for i in 0...max_battle_members
  327.       @battle_members_array.push(@actors[i]) unless @actors[i].nil?
  328.       @battle_members_array.push(0) if @actors[i].nil?
  329.     end
  330.     #***#
  331.     if max_battle_members<all_members.size then
  332.       @battle_members_array.push(all_members[max_battle_members].id)
  333.     end
  334.     #***#
  335.     $game_player.refresh
  336.   end
  337.   
  338.   #--------------------------------------------------------------------------
  339.   # alias method: add_actor
  340.   #--------------------------------------------------------------------------
  341.   alias game_party_add_actor_ps add_actor
  342.   def add_actor(actor_id)
  343.     game_party_add_actor_ps(actor_id)
  344.     return if @battle_members_array.include?(actor_id)
  345.     return unless @battle_members_array.include?(0)
  346.     index = @battle_members_array.index(0)
  347.     @battle_members_array[index] = actor_id
  348.     $game_player.refresh
  349.     $game_map.need_refresh = true
  350.     rearrange_actors
  351.   end
  352.   
  353.   #--------------------------------------------------------------------------
  354.   # alias method: remove_actor
  355.   #--------------------------------------------------------------------------
  356.   alias game_party_remove_actor_ps remove_actor
  357.   def remove_actor(actor_id)
  358.     game_party_remove_actor_ps(actor_id)
  359.     return unless @battle_members_array.include?(actor_id)
  360.     index = @battle_members_array.index(actor_id)
  361.     @battle_members_array[index] = 0
  362.     $game_player.refresh
  363.     $game_map.need_refresh = true
  364.     rearrange_actors
  365.   end
  366.   
  367.   #--------------------------------------------------------------------------
  368.   # new method: rearrange_actors
  369.   #--------------------------------------------------------------------------
  370.   def rearrange_actors
  371.     initialize_battle_members if @battle_members_array.nil?
  372.     array = []
  373.     for actor_id in @battle_members_array
  374.       next if [0, nil].include?(actor_id)
  375.       next if $game_actors[actor_id].nil?
  376.       array.push(actor_id)
  377.     end
  378.     for actor_id in @actors
  379.       next if array.include?(actor_id)
  380.       next if $game_actors[actor_id].nil?
  381.       next if tmp_remove_actor==actor_id#***#
  382.       array.push(actor_id)
  383.     end
  384.     if not array.include?(tmp_remove_actor) then
  385.       array.push(tmp_remove_actor) if not [0, nil].include?(tmp_remove_actor)#***#
  386.     end
  387.     @actors = array
  388.   end
  389.   
  390. end # Game_Party

  391. #==============================================================================
  392. # ■ Game_Interpreter
  393. #==============================================================================

  394. class Game_Interpreter
  395.   
  396.   #--------------------------------------------------------------------------
  397.   # new method: lock_actor
  398.   #--------------------------------------------------------------------------
  399.   def lock_actor(actor_id)
  400.     return unless YEA::PARTY::ENABLE_MENU
  401.     actor = $game_actors[actor_id]
  402.     return unless $game_party.battle_members.include?(actor.id)
  403.     actor.locked = true
  404.   end
  405.   
  406.   #--------------------------------------------------------------------------
  407.   # new method: unlock_actor
  408.   #--------------------------------------------------------------------------
  409.   def unlock_actor(actor_id)
  410.     return unless YEA::PARTY::ENABLE_MENU
  411.     actor = $game_actors[actor_id]
  412.     return unless $game_party.battle_members.include?(actor.id)
  413.     actor.locked = false
  414.   end
  415.   
  416.   #--------------------------------------------------------------------------
  417.   # new method: require_actor
  418.   #--------------------------------------------------------------------------
  419.   def require_actor(actor_id)
  420.     return unless YEA::PARTY::ENABLE_MENU
  421.     return if $game_system.formation_disabled
  422.     actor = $game_actors[actor_id]
  423.     return unless $game_party.all_members.include?(actor)
  424.     actor.required = true
  425.     call_party_menu unless $game_party.battle_members.include?(actor)
  426.   end
  427.   
  428.   #--------------------------------------------------------------------------
  429.   # new method: unrequire_actor
  430.   #--------------------------------------------------------------------------
  431.   def unrequire_actor(actor_id)
  432.     return unless YEA::PARTY::ENABLE_MENU
  433.     return if $game_system.formation_disabled
  434.     actor = $game_actors[actor_id]
  435.     return unless $game_party.all_members.include?(actor)
  436.     actor.required = false
  437.     call_party_menu unless $game_party.battle_members.include?(actor)
  438.   end
  439.   
  440.   #--------------------------------------------------------------------------
  441.   # new method: call_party_menu
  442.   #--------------------------------------------------------------------------
  443.   def call_party_menu
  444.     return unless YEA::PARTY::ENABLE_MENU
  445.     return if $game_system.formation_disabled
  446.     SceneManager.call(Scene_Party)
  447.   end
  448.   
  449. end # Game_Interpreter

  450. #==============================================================================
  451. # ■ Spriteset_Battle
  452. #==============================================================================

  453. class Spriteset_Battle
  454.   
  455.   #--------------------------------------------------------------------------
  456.   # overwrite method: create_actors
  457.   #--------------------------------------------------------------------------
  458.   def create_actors
  459.     total = $game_party.max_battle_members
  460.     @actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) }
  461.   end
  462.   
  463. end # Spriteset_Battle

  464. #==============================================================================
  465. # ■ Window_PartyMenuCommand
  466. #==============================================================================

  467. class Window_PartyMenuCommand < Window_Command
  468.   
  469.   #--------------------------------------------------------------------------
  470.   # window_width
  471.   #--------------------------------------------------------------------------
  472.   def window_width; return 160; end
  473.   
  474.   #--------------------------------------------------------------------------
  475.   # visible_line_number
  476.   #--------------------------------------------------------------------------
  477.   def visible_line_number; 4; end
  478.   
  479.   #--------------------------------------------------------------------------
  480.   # alignment
  481.   #--------------------------------------------------------------------------
  482.   def alignment
  483.     return Menu.command_window_align if $imported["YEA-AceMenuEngine"]
  484.     return YEA::PARTY::COMMAND_ALIGN
  485.   end
  486.   
  487.   #--------------------------------------------------------------------------
  488.   # scene
  489.   #--------------------------------------------------------------------------
  490.   def scene; return SceneManager.scene; end
  491.   
  492.   #--------------------------------------------------------------------------
  493.   # make_command_list
  494.   #--------------------------------------------------------------------------
  495.   def make_command_list
  496.     for command in YEA::PARTY::COMMANDS
  497.       case command[0]
  498.       when :change, :remove, :revert
  499.         add_command(command[1], command[0])
  500.       when :finish
  501.         add_command(command[1], command[0], enable_cancel?)
  502.       else; next
  503.       end
  504.     end
  505.   end
  506.   
  507.   #--------------------------------------------------------------------------
  508.   # process_cancel
  509.   #--------------------------------------------------------------------------
  510.   def process_cancel
  511.     unless enable_cancel?
  512.       Sound.play_buzzer
  513.       return
  514.     end
  515.     super
  516.   end
  517.   
  518.   #--------------------------------------------------------------------------
  519.   # in_party?
  520.   #--------------------------------------------------------------------------
  521.   def in_party?(actor)
  522.     return $game_party.battle_members.include?(actor)
  523.   end
  524.   
  525.   #--------------------------------------------------------------------------
  526.   # enable_cancel?
  527.   #--------------------------------------------------------------------------
  528.   def enable_cancel?
  529.     return false if $game_party.battle_members.size <= 0
  530.     for actor in $game_party.all_members
  531.       next if in_party?(actor)
  532.       return false if actor.required
  533.       return false if actor.locked
  534.     end
  535.     return true
  536.   end
  537.   
  538. end # Window_PartyMenuCommand

  539. #==============================================================================
  540. # ■ Window_PartySelect
  541. #==============================================================================

  542. class Window_PartySelect < Window_Selectable
  543.   
  544.   #--------------------------------------------------------------------------
  545.   # initialize
  546.   #-------------------------------------------------------------------------
  547.   def initialize(command_window)
  548.     @command_window = command_window
  549.     super(160, 0, window_width, fitting_height(visible_line_number))
  550.     select(0)
  551.     deactivate
  552.     refresh
  553.   end
  554.   
  555.   #--------------------------------------------------------------------------
  556.   # col_max
  557.   #--------------------------------------------------------------------------
  558.   def col_max#; return $game_party.max_battle_members;
  559.     #***#
  560.     if $game_party.max_battle_members<$game_party.all_members.size then
  561.       return  $game_party.max_battle_members+1
  562.     else
  563.       return  $game_party.max_battle_members
  564.     end
  565.     #***#
  566.   end
  567.   
  568.   #--------------------------------------------------------------------------
  569.   # item_max
  570.   #--------------------------------------------------------------------------
  571.   #def item_max; return $game_party.max_battle_members; end
  572.   #***#
  573.   def item_max
  574.     if $game_party.max_battle_members<$game_party.all_members.size then
  575.       return  $game_party.max_battle_members+1
  576.     else
  577.       return  $game_party.max_battle_members
  578.     end
  579.   end
  580.   #***#
  581.   #--------------------------------------------------------------------------
  582.   # window_width
  583.   #--------------------------------------------------------------------------
  584.   def window_width; return Graphics.width - 160; end
  585.   
  586.   #--------------------------------------------------------------------------
  587.   # visible_line_number
  588.   #--------------------------------------------------------------------------
  589.   def visible_line_number; 4; end
  590.   
  591.   #--------------------------------------------------------------------------
  592.   # item_rect
  593.   #--------------------------------------------------------------------------
  594.   def item_rect(index)
  595.     rect = Rect.new
  596.     rect.width = contents.width / item_max
  597.     rect.height = contents.height
  598.     rect.x = index * rect.width
  599.     rect.y = 0
  600.     return rect
  601.   end
  602.   
  603.   #--------------------------------------------------------------------------
  604.   # refresh
  605.   #--------------------------------------------------------------------------
  606.   def refresh
  607.     make_item_list
  608.     create_contents
  609.     draw_all_items
  610.   end
  611.   
  612.   #--------------------------------------------------------------------------
  613.   # make_item_list
  614.   #--------------------------------------------------------------------------
  615.   def make_item_list
  616.     @data = $game_party.battle_members_array.clone
  617.   end
  618.   
  619.   #--------------------------------------------------------------------------
  620.   # draw_item
  621.   #--------------------------------------------------------------------------
  622.   def draw_item(index)
  623.     actor = $game_actors[@data[index]]
  624.     rect = item_rect(index)
  625.     if actor.nil?
  626.       draw_empty(rect.clone)
  627.       return
  628.     end
  629.     dx = rect.width / 2
  630.     dy = rect.height - line_height*3/2#***#
  631.     draw_actor_face(actor, rect.x, rect.y) if display_face?
  632.     draw_actor_graphic(actor, rect.x + dx, rect.y + dy) unless display_face?
  633.     draw_actor_name(actor, rect)
  634.     draw_locked_icon(actor, rect)
  635.     draw_required_icon(actor, rect)
  636.   end
  637.   
  638.   #--------------------------------------------------------------------------
  639.   # display_face?
  640.   #--------------------------------------------------------------------------
  641.   def display_face?
  642.     return YEA::PARTY::DISPLAY_FACE
  643.   end
  644.   
  645.   #--------------------------------------------------------------------------
  646.   # draw_empty
  647.   #--------------------------------------------------------------------------
  648.   def draw_empty(rect)
  649.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  650.     rect.x += 2
  651.     rect.y += 2
  652.     rect.width -= 4
  653.     rect.height -= 4
  654.     contents.fill_rect(rect, colour)
  655.     reset_font_settings
  656.     change_color(system_color)
  657.     text = YEA::PARTY::EMPTY_TEXT
  658.     draw_text(rect, text, 1)
  659.     reset_font_settings
  660.   end
  661.   
  662.   #--------------------------------------------------------------------------
  663.   # draw_actor_name
  664.   #--------------------------------------------------------------------------
  665.   def draw_actor_name(actor, rect)
  666.     contents.font.size = YEA::PARTY::PARTY_FONT_SIZE
  667.     change_color(normal_color, actor.exist?)
  668.     draw_text(rect.x+4, rect.y, rect.width-8, line_height, actor.name, 1)
  669.     #***#
  670.     if $game_party.battle_members.include?(actor) then
  671.       change_color(text_color(YEA::PARTY::IN_PARTY_COLOUR) )
  672.       draw_text(rect.x+4, rect.y+line_height*3, rect.width-8, line_height, "战斗成员", 1)
  673.       change_color(normal_color)
  674.     else
  675.       draw_text(rect.x+4, rect.y+line_height*3, rect.width-8, line_height,"替补成员", 1)
  676.     end
  677.       #***#
  678.   end
  679.   
  680.   #--------------------------------------------------------------------------
  681.   # draw_face
  682.   #--------------------------------------------------------------------------
  683.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  684.     bitmap = Cache.face(face_name)
  685.     dw = [96, item_rect(0).width-4].min
  686.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, dw, 92)
  687.     contents.blt(dx+2, dy+2, bitmap, rect, enabled ? 255 : translucent_alpha)
  688.     bitmap.dispose
  689.   end
  690.   
  691.   #--------------------------------------------------------------------------
  692.   # draw_locked_icon
  693.   #--------------------------------------------------------------------------
  694.   def draw_locked_icon(actor, rect)
  695.     return unless actor_locked?(actor)
  696.     draw_icon(Icon.locked_party, rect.x+rect.width-26, rect.height - 26)
  697.   end
  698.   
  699.   #--------------------------------------------------------------------------
  700.   # draw_required_icon
  701.   #--------------------------------------------------------------------------
  702.   def draw_required_icon(actor, rect)
  703.     return if actor_locked?(actor)
  704.     return unless actor_required?(actor)
  705.     draw_icon(Icon.required_party, rect.x+rect.width-26, rect.height - 26)
  706.   end
  707.   
  708.   #--------------------------------------------------------------------------
  709.   # actor_locked?
  710.   #--------------------------------------------------------------------------
  711.   def actor_locked?(actor); return actor.locked; end
  712.   
  713.   #--------------------------------------------------------------------------
  714.   # actor_required?
  715.   #--------------------------------------------------------------------------
  716.   def actor_required?(actor)
  717.     return false if actor.locked
  718.     return actor.required
  719.   end
  720.   
  721.   #--------------------------------------------------------------------------
  722.   # current_item_enabled?
  723.   #--------------------------------------------------------------------------
  724.   def current_item_enabled?; enable?(@data[index]); end
  725.   
  726.   #--------------------------------------------------------------------------
  727.   # enable?
  728.   #--------------------------------------------------------------------------
  729.   def enable?(item)
  730.     case @command_window.current_symbol
  731.     when :change
  732.       return true if item.nil?
  733.       return true if item == 0
  734.     when :remove
  735.       return false if item.nil?
  736.       return false if item == 0
  737.     end
  738.     actor = $game_actors[item]
  739.     return false if actor.locked
  740.     return false if actor.required
  741.     return true
  742.   end
  743.   
  744.   #--------------------------------------------------------------------------
  745.   # process_handling
  746.   #--------------------------------------------------------------------------
  747.   def process_handling
  748.     return unless open? && active
  749.     return process_ok       if ok_enabled?        && Input.trigger?(:C)
  750.     return process_cancel   if cancel_enabled?    && Input.trigger?(:B)
  751.     return process_pagedown if handle?(:pagedown) && Input.repeat?(:R)
  752.     return process_pageup   if handle?(:pageup)   && Input.repeat?(:L)
  753.   end
  754.   
  755.   #--------------------------------------------------------------------------
  756.   # cur_actor
  757.   #--------------------------------------------------------------------------
  758.   def cur_actor
  759.     actor_id = @data[index]
  760.     return $game_actors[actor_id]
  761.   end
  762.   
  763.   #--------------------------------------------------------------------------
  764.   # prev_actor
  765.   #--------------------------------------------------------------------------
  766.   def prev_actor
  767.     id = index == 0 ? @data.size - 1 : index - 1
  768.     actor_id = @data[id]
  769.     return $game_actors[actor_id]
  770.   end
  771.   
  772.   #--------------------------------------------------------------------------
  773.   # next_actor
  774.   #--------------------------------------------------------------------------
  775.   def next_actor
  776.     id = index == @data.size - 1 ? 0 : index + 1
  777.     actor_id = @data[id]
  778.     return $game_actors[actor_id]
  779.   end
  780.   
  781.   #--------------------------------------------------------------------------
  782.   # process_pageup
  783.   #--------------------------------------------------------------------------
  784.   def process_pageup
  785.     allow = true
  786.     allow = false if !prev_actor.nil? && prev_actor.locked
  787.     allow = false if !cur_actor.nil? && cur_actor.locked
  788.     Sound.play_buzzer unless allow
  789.     if allow
  790.       super
  791.       activate
  792.       select(index == 0 ? @data.size - 1 : index - 1)
  793.     end
  794.   end
  795.   
  796.   #--------------------------------------------------------------------------
  797.   # process_pagedown
  798.   #--------------------------------------------------------------------------
  799.   def process_pagedown
  800.     allow = true
  801.     allow = false if !next_actor.nil? && next_actor.locked
  802.     allow = false if !cur_actor.nil? && cur_actor.locked
  803.     Sound.play_buzzer unless allow
  804.     if allow
  805.       super
  806.       activate
  807.       select(index == @data.size - 1 ? 0 : index + 1)
  808.     end
  809.   end
  810.   
  811.   #--------------------------------------------------------------------------
  812.   # item
  813.   #--------------------------------------------------------------------------
  814.   def item; return @data[index]; end
  815.   
  816. end # Window_PartySelect

  817. #==============================================================================
  818. # ■ Window_PartyList
  819. #==============================================================================

  820. class Window_PartyList < Window_Selectable
  821.   
  822.   #--------------------------------------------------------------------------
  823.   # initialize
  824.   #-------------------------------------------------------------------------
  825.   def initialize(party_window)
  826.     super(0, fitting_height(4), window_width, window_height)
  827.     @party_window = party_window
  828.     select(1)
  829.     deactivate
  830.     refresh
  831.   end
  832.   
  833.   #--------------------------------------------------------------------------
  834.   # window_width
  835.   #--------------------------------------------------------------------------
  836.   def window_width; return 200; end
  837.   
  838.   #--------------------------------------------------------------------------
  839.   # window_height
  840.   #--------------------------------------------------------------------------
  841.   def window_height; return Graphics.height - fitting_height(4); end
  842.   
  843.   #--------------------------------------------------------------------------
  844.   # item_max
  845.   #--------------------------------------------------------------------------
  846.   def item_max; return @data ? @data.size : 1; end
  847.   
  848.   #--------------------------------------------------------------------------
  849.   # refresh
  850.   #--------------------------------------------------------------------------
  851.   def refresh
  852.     make_item_list
  853.     create_contents
  854.     draw_all_items
  855.   end
  856.   
  857.   #--------------------------------------------------------------------------
  858.   # make_item_list
  859.   #--------------------------------------------------------------------------
  860.   def make_item_list
  861.     @data = [0]
  862.     for member in $game_party.all_members
  863.       next if member.nil?
  864.       @data.push(member.id)
  865.     end
  866.     @data.push(0)
  867.   end
  868.   
  869.   #--------------------------------------------------------------------------
  870.   # draw_item
  871.   #--------------------------------------------------------------------------
  872.   def draw_item(index)
  873.     clear_item(index)
  874.     rect = item_rect(index)
  875.     if @data[index] == 0
  876.       draw_remove(rect)
  877.       return
  878.     end
  879.     actor = $game_actors[@data[index]]
  880.     draw_actor(actor, rect)
  881.     draw_actor_locked(actor, rect)
  882.     draw_actor_required(actor, rect)
  883.   end
  884.   
  885.   #--------------------------------------------------------------------------
  886.   # draw_remove
  887.   #--------------------------------------------------------------------------
  888.   def draw_remove(rect)
  889.     reset_font_settings
  890.     draw_icon(Icon.remove_party, rect.x+4, rect.y)
  891.     text = YEA::PARTY::REMOVE_TEXT
  892.     draw_text(rect.x+32, rect.y, rect.width-32, line_height, text)
  893.   end
  894.   
  895.   #--------------------------------------------------------------------------
  896.   # draw_actor
  897.   #--------------------------------------------------------------------------
  898.   def draw_actor(actor, rect)
  899.     buffer = YEA::PARTY::ACTOR_Y_BUFFER
  900.     draw_actor_graphic(actor, rect.x + 16, rect.y + rect.height + buffer)
  901.     text = actor.name
  902.     change_color(list_colour(actor), enabled?(actor))
  903.     draw_text(rect.x+32, rect.y, rect.width-32, line_height, text)
  904.   end
  905.   
  906.   #--------------------------------------------------------------------------
  907.   # list_colour
  908.   #--------------------------------------------------------------------------
  909.   def list_colour(actor)
  910.     return text_color(YEA::PARTY::IN_PARTY_COLOUR) if in_party?(actor)
  911.     return normal_color
  912.   end
  913.   
  914.   #--------------------------------------------------------------------------
  915.   # draw_actor_locked
  916.   #--------------------------------------------------------------------------
  917.   def draw_actor_locked(actor, rect)
  918.     return unless actor.locked
  919.     draw_icon(Icon.locked_party, rect.width-24, rect.y)
  920.   end
  921.   
  922.   #--------------------------------------------------------------------------
  923.   # draw_actor_required
  924.   #--------------------------------------------------------------------------
  925.   def draw_actor_required(actor, rect)
  926.     return if actor.locked
  927.     return unless actor.required
  928.     draw_icon(Icon.required_party, rect.width-24, rect.y)
  929.   end
  930.   
  931.   #--------------------------------------------------------------------------
  932.   # enabled?
  933.   #--------------------------------------------------------------------------
  934.   def enabled?(actor)
  935.     return false if actor.locked
  936.     return false if actor.required && in_party?(actor)
  937.     return actor.exist?
  938.   end
  939.   
  940.   #--------------------------------------------------------------------------
  941.   # in_party?
  942.   #--------------------------------------------------------------------------
  943.   def in_party?(actor); return $game_party.battle_members.include?(actor); end
  944.   
  945.   #--------------------------------------------------------------------------
  946.   # current_item_enabled?
  947.   #--------------------------------------------------------------------------
  948.   def current_item_enabled?
  949.     actor = $game_actors[item]
  950.     replace = $game_actors[@party_window.item]
  951.     unless actor.nil?
  952.       return false if actor.locked && in_party?(actor)
  953.       return false if actor.required && in_party?(actor)
  954.     end
  955.     return true if replace.nil?
  956.     return false if replace.locked
  957.     return false if replace.required
  958.     return true if actor.nil?
  959.     return actor.exist?
  960.   end
  961.   
  962.   #--------------------------------------------------------------------------
  963.   # item
  964.   #--------------------------------------------------------------------------
  965.   def item; return @data[index]; end
  966.   
  967. end # Window_PartyList

  968. #==============================================================================
  969. # ** Window_PartyStatus
  970. #==============================================================================

  971. class Window_PartyStatus < Window_Base
  972.   
  973.   #--------------------------------------------------------------------------
  974.   # initialize
  975.   #--------------------------------------------------------------------------
  976.   def initialize(party_window, list_window)
  977.     super(200, fitting_height(4), window_width, window_height)
  978.     @party_window = party_window
  979.     @list_window = list_window
  980.     [url=home.php?mod=space&uid=95897]@actor[/url] = active_actor
  981.     refresh
  982.   end
  983.   
  984.   #--------------------------------------------------------------------------
  985.   # window_width
  986.   #--------------------------------------------------------------------------
  987.   def window_width; Graphics.width - 200; end
  988.   
  989.   #--------------------------------------------------------------------------
  990.   # window_height
  991.   #--------------------------------------------------------------------------
  992.   def window_height; Graphics.height - fitting_height(4); end
  993.   
  994.   #--------------------------------------------------------------------------
  995.   # update
  996.   #--------------------------------------------------------------------------
  997.   def update
  998.     super
  999.     refresh if @actor != active_actor
  1000.   end
  1001.   
  1002.   #--------------------------------------------------------------------------
  1003.   # active_actor
  1004.   #--------------------------------------------------------------------------
  1005.   def active_actor
  1006.     if @list_window.active
  1007.       actor = @list_window.item
  1008.     else
  1009.       actor = @party_window.item
  1010.     end
  1011.     return nil if [0, nil].include?(actor)
  1012.     return actor
  1013.   end
  1014.   
  1015.   #--------------------------------------------------------------------------
  1016.   # refresh
  1017.   #--------------------------------------------------------------------------
  1018.   def refresh
  1019.     contents.clear
  1020.     @actor = active_actor
  1021.     reset_font_settings
  1022.     if @actor.nil?
  1023.       draw_nil_actor
  1024.       return
  1025.     end
  1026.     actor = $game_actors[@actor]
  1027.     draw_actor_face(actor, 0, 0)
  1028.     draw_actor_name(actor, 108, 0)
  1029.     draw_actor_class(actor, 228, 0, contents.width-232)
  1030.     draw_actor_level(actor, 108, line_height)
  1031.     draw_actor_icons(actor, 228, line_height, contents.width-232)
  1032.     draw_actor_hp(actor, 108, line_height*2, contents.width-112)
  1033.     draw_actor_mp(actor, 108, line_height*3, contents.width-112)
  1034.     draw_actor_parameters(actor, 0, line_height*4 + line_height/2)
  1035.     draw_equipments(actor, contents.width/2, line_height*4 + line_height/2)
  1036.   end
  1037.   
  1038.   #--------------------------------------------------------------------------
  1039.   # draw_nil_actor
  1040.   #--------------------------------------------------------------------------
  1041.   def draw_nil_actor
  1042.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  1043.     rect = Rect.new(0, 0, contents.width, contents.height)
  1044.     contents.fill_rect(rect, colour)
  1045.     change_color(system_color)
  1046.     text = YEA::PARTY::NO_DATA
  1047.     draw_text(rect, text, 1)
  1048.   end
  1049.   
  1050.   #--------------------------------------------------------------------------
  1051.   # draw_actor_parameters
  1052.   #--------------------------------------------------------------------------
  1053.   def draw_actor_parameters(actor, dx, dy)
  1054.     dw = contents.width/2 - 4
  1055.     rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  1056.     contents.font.size = YEA::PARTY::STAT_FONT_SIZE
  1057.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  1058.     array = [:atk, :def, :mat, :mdf, :agi, :luk]
  1059.     cx = 4
  1060.     for stat in array
  1061.       case stat
  1062.       when :atk
  1063.         param = Vocab::param(2)
  1064.         value = actor.atk.group
  1065.       when :def
  1066.         param = Vocab::param(3)
  1067.         value = actor.def.group
  1068.       when :mat
  1069.         param = Vocab::param(4)
  1070.         value = actor.mat.group
  1071.       when :mdf
  1072.         param = Vocab::param(5)
  1073.         value = actor.mdf.group
  1074.       when :agi
  1075.         param = Vocab::param(6)
  1076.         value = actor.agi.group
  1077.       when :luk
  1078.         param = Vocab::param(7)
  1079.         value = actor.luk.group
  1080.       else; next
  1081.       end
  1082.       contents.fill_rect(rect, colour)
  1083.       change_color(system_color)
  1084.       draw_text(rect.x + cx, rect.y, rect.width-cx*2, line_height, param, 0)
  1085.       change_color(normal_color)
  1086.       draw_text(rect.x + cx, rect.y, rect.width-cx*2, line_height, value, 2)
  1087.       rect.y += line_height
  1088.     end
  1089.     reset_font_settings
  1090.   end
  1091.   
  1092.   #--------------------------------------------------------------------------
  1093.   # draw_equipments
  1094.   #--------------------------------------------------------------------------
  1095.   def draw_equipments(actor, dx, dy)
  1096.     text = YEA::PARTY::EQUIP_TEXT
  1097.     change_color(system_color)
  1098.     draw_text(dx, dy, contents.width - dx, line_height, text, 1)
  1099.     dy += line_height
  1100.     if actor.equips.size <= 5
  1101.       actor.equips.each_with_index do |item, i|
  1102.         draw_item_name(item, dx, dy + line_height * i)
  1103.       end
  1104.     else
  1105.       orig_x = dx
  1106.       actor.equips.each_with_index do |item, i|
  1107.         next if item.nil?
  1108.         draw_icon(item.icon_index, dx, dy)
  1109.         dy += line_height if dx + 48 > contents.width
  1110.         dx = dx + 48 > contents.width ? orig_x : dx + 24
  1111.       end
  1112.     end
  1113.   end
  1114.   
  1115. end # Window_PartyStatus

  1116. #==============================================================================
  1117. # ■ Scene_Menu
  1118. #==============================================================================

  1119. class Scene_Menu < Scene_MenuBase
  1120.   
  1121.   #--------------------------------------------------------------------------
  1122.   # overwrite method: command_formation
  1123.   #--------------------------------------------------------------------------
  1124.   if YEA::PARTY::ENABLE_MENU
  1125.   def command_formation
  1126.     SceneManager.call(Scene_Party)
  1127.   end
  1128.   end # YEA::PARTY::ENABLE_MENU
  1129.   
  1130. end # Scene_Menu

  1131. #==============================================================================
  1132. # ■ Scene_Party
  1133. #==============================================================================

  1134. class Scene_Party < Scene_MenuBase
  1135.   
  1136.   #--------------------------------------------------------------------------
  1137.   # start
  1138.   #--------------------------------------------------------------------------
  1139.   def start
  1140.     super
  1141.     @former_party = $game_party.battle_members_array.clone
  1142.     create_command_window
  1143.     create_party_window
  1144.     create_list_window
  1145.     create_status_window
  1146.   end
  1147.   
  1148.   #--------------------------------------------------------------------------
  1149.   # create_command_window
  1150.   #--------------------------------------------------------------------------
  1151.   def create_command_window
  1152.     @command_window = Window_PartyMenuCommand.new(0, 0)
  1153.     @command_window.set_handler(:change, method(:adjust_members))
  1154.     @command_window.set_handler(:remove, method(:adjust_members))
  1155.     @command_window.set_handler(:revert, method(:revert_party))
  1156.     @command_window.set_handler(:finish, method(:return_scene))
  1157.     @command_window.set_handler(:cancel, method(:return_scene))
  1158.   end
  1159.   
  1160.   #--------------------------------------------------------------------------
  1161.   # create_party_window
  1162.   #--------------------------------------------------------------------------
  1163.   def create_party_window
  1164.     @party_window = Window_PartySelect.new(@command_window)
  1165.     @party_window.set_handler(:ok,       method(:on_party_ok))
  1166.     @party_window.set_handler(:cancel,   method(:on_party_cancel))
  1167.     @party_window.set_handler(:pageup,   method(:on_party_pageup))
  1168.     @party_window.set_handler(:pagedown, method(:on_party_pagedown))
  1169.   end
  1170.   
  1171.   #--------------------------------------------------------------------------
  1172.   # create_list_window
  1173.   #--------------------------------------------------------------------------
  1174.   def create_list_window
  1175.     @list_window = Window_PartyList.new(@party_window)
  1176.     @list_window.set_handler(:ok,     method(:on_list_ok))
  1177.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  1178.   end
  1179.   
  1180.   #--------------------------------------------------------------------------
  1181.   # create_status_window
  1182.   #--------------------------------------------------------------------------
  1183.   def create_status_window
  1184.     @status_window = Window_PartyStatus.new(@party_window, @list_window)
  1185.   end
  1186.   
  1187.   #--------------------------------------------------------------------------
  1188.   # adjust_members
  1189.   #--------------------------------------------------------------------------
  1190.   def adjust_members
  1191.     @party_window.activate
  1192.   end
  1193.   
  1194.   #--------------------------------------------------------------------------
  1195.   # window_refresh
  1196.   #--------------------------------------------------------------------------
  1197.   def window_refresh
  1198.     $game_party.rearrange_actors
  1199.     @command_window.refresh
  1200.     @party_window.refresh
  1201.     @list_window.refresh
  1202.     $game_player.refresh
  1203.     $game_map.need_refresh = true
  1204.   end
  1205.   
  1206.   #--------------------------------------------------------------------------
  1207.   # revert_party
  1208.   #--------------------------------------------------------------------------
  1209.   def revert_party
  1210.     @command_window.activate
  1211.     $game_party.battle_members_array = @former_party.clone
  1212.     window_refresh
  1213.   end
  1214.   
  1215.   #--------------------------------------------------------------------------
  1216.   # on_party_ok
  1217.   #--------------------------------------------------------------------------
  1218.   def on_party_ok
  1219.     case @command_window.current_symbol
  1220.     when :change
  1221.       @list_window.activate
  1222.     when :remove
  1223.       index = @party_window.index
  1224.       actor = $game_actors[$game_party.battle_members_array[index]]
  1225.       Sound.play_equip
  1226.       #$game_party.battle_members_array[index] = 0
  1227.       #***#
  1228.       if $game_party.max_battle_members>index then
  1229.         $game_party.tmp_remove_actor=actor.id
  1230.         $game_party.battle_members_array.delete(actor.id)
  1231.         $game_party.battle_members_array.insert($game_party.max_battle_members-1,0)
  1232.       else
  1233.         $game_party.tmp_remove_actor=$game_party.battle_members_array[index]
  1234.         actor = $game_actors[$game_party.tmp_remove_actor]
  1235.         tmp_index=$game_party.all_members.index(actor)
  1236.         if tmp_index <$game_party.all_members.size-1 then
  1237.           actor =$game_party.all_members[tmp_index+1]
  1238.           $game_party.battle_members_array[index]=actor.id
  1239.         end
  1240.       end
  1241.       #***#
  1242.       window_refresh
  1243.       @party_window.activate
  1244.     end
  1245.   end
  1246.   
  1247.   #--------------------------------------------------------------------------
  1248.   # on_party_cancel
  1249.   #--------------------------------------------------------------------------
  1250.   def on_party_cancel
  1251.     @command_window.activate
  1252.   end
  1253.   
  1254.   #--------------------------------------------------------------------------
  1255.   # on_party_pageup
  1256.   #--------------------------------------------------------------------------
  1257.   def on_party_pageup
  1258.     Sound.play_equip
  1259.     actor_id1 = @party_window.item
  1260.     actor_id2 = @party_window.prev_actor.nil? ? 0 : @party_window.prev_actor.id
  1261.     max = @party_window.item_max-1
  1262.     index1 = @party_window.index
  1263.     index2 = @party_window.index == 0 ? max : index1-1
  1264.     $game_party.battle_members_array[index1] = actor_id2
  1265.     $game_party.battle_members_array[index2] = actor_id1
  1266.     window_refresh
  1267.   end
  1268.   
  1269.   #--------------------------------------------------------------------------
  1270.   # on_party_pagedown
  1271.   #--------------------------------------------------------------------------
  1272.   def on_party_pagedown
  1273.     Sound.play_equip
  1274.     actor_id1 = @party_window.item
  1275.     actor_id2 = @party_window.next_actor.nil? ? 0 : @party_window.next_actor.id
  1276.     max = @party_window.item_max-1
  1277.     index1 = @party_window.index
  1278.     index2 = @party_window.index == max ? 0 : index1+1
  1279.     $game_party.battle_members_array[index1] = actor_id2
  1280.     $game_party.battle_members_array[index2] = actor_id1
  1281.     window_refresh
  1282.   end
  1283.   
  1284.   #--------------------------------------------------------------------------
  1285.   # on_list_cancel
  1286.   #--------------------------------------------------------------------------
  1287.   def on_list_cancel
  1288.     @party_window.activate
  1289.   end
  1290.   
  1291.   #--------------------------------------------------------------------------
  1292.   # on_list_ok
  1293.   #--------------------------------------------------------------------------
  1294.   def on_list_ok
  1295.     Sound.play_equip
  1296.     replace = $game_actors[@party_window.item]
  1297.     actor = $game_actors[@list_window.item]
  1298.     index1 = @party_window.index
  1299.     $game_party.tmp_remove_actor=$game_party.battle_members_array[index1]#***#
  1300.     actor_id1 = actor.nil? ? 0 : actor.id
  1301.     if actor.nil?
  1302.       #***#
  1303.       if $game_party.max_battle_members>index1 then
  1304.         $game_party.battle_members_array[index1] = 0
  1305.         i=index1
  1306.         while i<$game_party.battle_members_array.size-2
  1307.           $game_party.battle_members_array[i], $game_party.battle_members_array[i+1] = $game_party.battle_members_array[i+1], $game_party.battle_members_array[i]
  1308.           i+=1
  1309.         end
  1310.       else
  1311.         actor = $game_actors[$game_party.tmp_remove_actor]
  1312.         tmp_index=$game_party.all_members.index(actor)
  1313.         if tmp_index <$game_party.all_members.size-1 then
  1314.           actor =$game_party.all_members[tmp_index+1]
  1315.           $game_party.battle_members_array[index1]=actor.id
  1316.         end
  1317.       end
  1318.       #***#
  1319.       window_refresh
  1320.       @party_window.activate
  1321.       return
  1322.     end
  1323.     actor_id2 = replace.nil? ? 0 : replace.id
  1324.     if $game_party.battle_members_array.include?(actor_id1)
  1325.       index2 = $game_party.battle_members_array.index(actor_id1)
  1326.       #***#
  1327.       if index2==$game_party.battle_members_array.size-1 then
  1328.         $game_party.tmp_remove_actor=$game_party.battle_members_array[index1]#***#
  1329.       end
  1330.       #***#
  1331.       $game_party.battle_members_array[index2] = actor_id2
  1332.     end
  1333.     $game_party.battle_members_array[index1] = actor_id1
  1334.     #***#
  1335.     if [0, nil].include?(actor_id1)
  1336.       i=index1
  1337.       while i<$game_party.battle_members_array.size-2
  1338.         $game_party.battle_members_array[i], $game_party.battle_members_array[i+1] = $game_party.battle_members_array[i+1], $game_party.battle_members_array[i]
  1339.         i+=1
  1340.       end
  1341.     end
  1342.     #***#
  1343.     window_refresh
  1344.     @party_window.activate
  1345.   end
  1346.   
  1347. end # Scene_Party

  1348. #==============================================================================
  1349. #
  1350. # ▼ End of File
  1351. #
  1352. #==============================================================================
复制代码

下为图示
队伍排列图
1.png
移除队列第一人
2.png
移除队列第三人
3.png
移除战斗成员
4.png
  

点评

hcm
确实有点难说明呢,那就能退而求其次好了:简单地说就是去除该脚本中的“移除”功能,后备队在战斗人员离队后会自动跟进补充战斗人员。  发表于 2014-3-3 18:36

评分

参与人数 2星屑 +300 梦石 +1 收起 理由
迷糊的安安 + 1 认可答案
hcm + 300 认可答案

查看全部评分

http://rpg.blue/static/image/smiley/yct/A059.gif中国字认识都不到一半,哪的心情学英语呀!
回复

使用道具 举报

虚空人形

梦石
0
星屑
4866
在线时间
2037 小时
注册时间
2011-8-11
回帖
3260

贵宾

 楼主| 发表于 2014-3-3 08:41:49 | 显示全部楼层
本帖最后由 hcm 于 2014-3-3 08:50 编辑

嗯,感觉非常好,
本来还有一项要求我忘记提的,因为如果队员总数小于等于战斗人员的话替补就没意义了。
所以队员小于战斗人数就不该出现替补,你连这个都考虑进去了。

可惜感觉好像和http://rpg.blue/thread-353463-1-1.html略有冲突之处。

点评

没有看明白你的那一个贴子写的什么意思!  发表于 2014-3-3 17:58
回复

使用道具 举报

梦石
0
星屑
1478
在线时间
993 小时
注册时间
2011-5-11
回帖
418
发表于 2014-3-3 20:12:41 | 显示全部楼层
@hcm 如果改成 替补成员自动加入战斗序列是可以但这样一来这个脚本就大大的失去了它存在的意义了!
http://rpg.blue/static/image/smiley/yct/A059.gif中国字认识都不到一半,哪的心情学英语呀!
回复

使用道具 举报

虚空人形

梦石
0
星屑
4866
在线时间
2037 小时
注册时间
2011-8-11
回帖
3260

贵宾

 楼主| 发表于 2014-3-3 21:04:23 | 显示全部楼层
本帖最后由 hcm 于 2014-3-6 21:33 编辑
345912390 发表于 2014-3-3 20:12
@hcm 如果改成 替补成员自动加入战斗序列是可以但这样一来这个脚本就大大的失去了它存在的意义了!  ...


主要是我需要的主角比较多,如果使用默认的在状态菜单的整队方式不便于队伍的管理,
我做的游戏有些原因需要随时保持这种状态。
未命名.jpg
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部