查看: 2844|回复: 7

[已经过期] 角色仓库的问题

[复制链接]
梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
回帖
1077
发表于 2016-10-3 20:33:18 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 fjm 于 2016-10-3 22:22 编辑

怎样使仓库里的角色在不出战的情况下,也能获得和出战人员相同的经验


  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ■ Interpreter (分割定义 4)
  6. #------------------------------------------------------------------------------
  7. #  执行事件命令的解释器。本类在 Game_System 类
  8. # 和 Game_Event 类的内部使用。
  9. #==============================================================================
  10. class Interpreter
  11.     #--------------------------------------------------------------------------
  12.     # ● 角色的替换
  13.     #--------------------------------------------------------------------------
  14.     def command_129
  15.         # 获取角色
  16.         actor = $game_actors[@parameters[0]]
  17.         # 角色有效的情况下
  18.         if actor != nil
  19.             # 操作分支
  20.             if @parameters[1] == 0
  21.                 if @parameters[2] == 1
  22.                     $game_actors[@parameters[0]].setup(@parameters[0])
  23.                 end
  24.                 if $game_party.actors.size == 3
  25.                     $game_party.add_actor(@parameters[0],2)
  26.                 else
  27.                     $game_party.add_actor(@parameters[0])
  28.                 end
  29.             else
  30.                 $game_party.remove_actor(@parameters[0],3)
  31.             end
  32.         end
  33.         # 继续
  34.         return true
  35.     end
  36. end
  37. #==============================================================================
  38. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  39. #==============================================================================
复制代码


  1. [code][code]#==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ■ Interpreter (分割定义 4)
  6. #------------------------------------------------------------------------------
  7. #  执行事件命令的解释器。本类在 Game_System 类
  8. # 和 Game_Event 类的内部使用。
  9. #==============================================================================
  10. class Interpreter
  11.     #--------------------------------------------------------------------------
  12.     # ● 角色的替换
  13.     #--------------------------------------------------------------------------
  14.     def command_129
  15.         # 获取角色
  16.         actor = $game_actors[@parameters[0]]
  17.         # 角色有效的情况下
  18.         if actor != nil
  19.             # 操作分支
  20.             if @parameters[1] == 0
  21.                 if @parameters[2] == 1
  22.                     $game_actors[@parameters[0]].setup(@parameters[0])
  23.                 end
  24.                 if $game_party.actors.size == 3
  25.                     $game_party.add_actor(@parameters[0],2)
  26.                 else
  27.                     $game_party.add_actor(@parameters[0])
  28.                 end
  29.             else
  30.                 $game_party.remove_actor(@parameters[0],3)
  31.             end
  32.         end
  33.         # 继续
  34.         return true
  35.     end
  36. end
  37. #==============================================================================
  38. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  39. #==============================================================================
  40. [/code][/code]
复制代码
  1. #==============================================================================
  2. # ■ chaochao的人物仓库ver1.02正式版
  3. # 修改了Game_Party
  4. # 功能:
  5. # 用来存放角色的仓库……
  6. # 召唤画面用$scene = Chaochao_Scene_Party.new
  7. # 其它使用说明在代码里已经备注。
  8. #------------------------------------------------------------------------------
  9. # 作者:chaochao
  10. # [url]http://zhuchao.go1.icpcn.com[/url]
  11. #==============================================================================
  12. class Chaochao_Window_PartyLeft < Window_Selectable
  13.   def initialize
  14.     super(0, 0, 320, 224)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.index = 0
  17.     self.opacity = 160   
  18.     refresh
  19.   end
  20.   def actor
  21.     return @actors[self.index]
  22.   end
  23.   def refresh
  24.     if self.contents != nil
  25.       self.contents.dispose
  26.       self.contents = nil
  27.     end
  28.     @actors = []
  29.     for i in 0...$game_party.actors.size
  30.       @actors.push($game_party.actors[i])
  31.     end
  32.    
  33.     @item_max = 3
  34.     if @item_max > 0
  35.       self.contents = Bitmap.new(width - 32, (row_max+1) * 32)
  36.       for i in 0...@item_max
  37.         draw_item(i)
  38.       end
  39.     end
  40.   end
  41.   def draw_item(index)
  42.     if @actors[index] != nil
  43.       actor = @actors[index]
  44.       text = @actors[index].name
  45.       lv = @actors[index].level.to_s + " "
  46.       if $game_party.chaochao.include?(actor.id) or $game_party.actors.size <= 1
  47.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  48.       else
  49.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  50.       end
  51.       self.contents.draw_text(3, index * 32 + 32, 288, 32, text)
  52.       self.contents.font.color = normal_color
  53.       self.contents.font.size = 16
  54.       self.contents.draw_text(3, index * 32 + 36, 264, 32,  "Lv:   ", 2)
  55.       colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  56.       colory = [255.0000 / 60 * @actors[index].level,255].min
  57.       self.contents.font.color = Color.new(colorx, colory, 0)
  58.       self.contents.draw_text(3, index * 32 + 36, 288, 32,  lv, 2)
  59.       self.contents.font.color = normal_color
  60.       self.contents.font.size = 22
  61.     else
  62.       self.contents.draw_text(3, index * 32 + 32, 288, 32,  "空缺")
  63.     end
  64.   end
  65.   def update_cursor_rect
  66.     if @index < 0
  67.       self.cursor_rect.empty
  68.       return
  69.     end
  70.     row = @index / @column_max
  71.     if row < self.top_row
  72.       self.top_row = row
  73.     end
  74.     if row > self.top_row + (self.page_row_max - 1)
  75.       self.top_row = row - (self.page_row_max - 1)
  76.     end
  77.     cursor_width = self.width / @column_max - 32
  78.     x = @index % @column_max * (cursor_width + 32)
  79.     y = @index / @column_max * 32 - self.oy + 32
  80.     self.cursor_rect.set(x, y, cursor_width, 32)
  81.   end
  82.   def item_max
  83.     return @item_max
  84.   end
  85.   def actor?(index)
  86.     return @actors[index] == nil ? false : true
  87.   end
  88.   def set_index(x)
  89.     @index = x
  90.   end
  91. end

  92. #------------------------------------------------------------------------------

  93. class Chaochao_Window_PartyRight < Window_Selectable
  94.   def initialize
  95.     super(320, 0, 320, 224)
  96.     self.contents = Bitmap.new(width - 32, height - 32)
  97.     self.opacity = 160
  98.     self.index = -1
  99.     refresh
  100.   end
  101.   def actor
  102.     return @actors[self.index]
  103.   end
  104.   def refresh
  105.     if self.contents != nil
  106.       self.contents.dispose
  107.       self.contents = nil
  108.     end
  109.     @actors = []
  110.     for i in 0...$game_party.actors2.size
  111.       @actors.push($game_party.actors2[i])
  112.     end
  113.    
  114.     @item_max = $game_party.actors2.size
  115.     if @item_max > 0
  116.       self.contents = Bitmap.new(width - 32, row_max * 32)
  117.       for i in 0...@item_max
  118.         draw_item(i)
  119.       end
  120.     elsif @item_max == 0
  121.       
  122.     end
  123.   end
  124.   def draw_item(index)
  125.     actor = @actors[index]
  126.     text = @actors[index].name
  127.     lv = @actors[index].level.to_s + " "
  128.     if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
  129.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  130.       else
  131.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  132.       end
  133.     self.contents.draw_text(3, index * 32, 288, 32, text)
  134.     self.contents.font.color = normal_color
  135.     self.contents.font.size = 16
  136.     self.contents.draw_text(3, index * 32 + 4, 264, 32,  "Lv:   ", 2)
  137.     colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  138.     colory = [255.0000 / 60 * @actors[index].level,255].min
  139.     self.contents.font.color = Color.new(colorx, colory, 0)
  140.     self.contents.draw_text(3, index * 32 + 4, 288, 32,  lv, 2)
  141.     self.contents.font.color = normal_color
  142.     self.contents.font.size = 22
  143.   end
  144.   def update_cursor_rect
  145.     if @index < 0
  146.       self.cursor_rect.empty
  147.       return
  148.     end
  149.     row = @index / @column_max
  150.     if row < self.top_row
  151.       self.top_row = row
  152.     end
  153.     if row > self.top_row + (self.page_row_max - 1)
  154.       self.top_row = row - (self.page_row_max - 1)
  155.     end
  156.     cursor_width = self.width / @column_max - 32
  157.     x = @index % @column_max * (cursor_width + 32)
  158.     y = @index / @column_max * 32 - self.oy
  159.     self.cursor_rect.set(x, y, cursor_width, 32)
  160.   end
  161.   def item_max
  162.     return @item_max
  163.   end
  164.   def actor?(index)
  165.     return @actors[index] == nil ? false : true
  166.   end
  167.   def set_index(x)
  168.     @index = x
  169.   end
  170. end

  171. #------------------------------------------------------------------------------

  172. class Chaochao_Window_PartyData < Window_Base
  173.   
  174.   def initialize
  175.     super(0, 224, 640, 256)
  176.     self.contents = Bitmap.new(width - 32, height - 32)
  177.     self.opacity = 160
  178.     @actor = nil
  179.   end
  180.   
  181.   def set_actor(actor)
  182.     self.contents.clear
  183.     draw_actor_name(actor, 4, 0)
  184.     draw_actor_state(actor, 140, 0)
  185.     draw_actor_hp(actor, 284, 0)
  186.     draw_actor_sp(actor, 460, 0)
  187.     @actor = actor
  188.     self.visible = true
  189.   end
  190.   def clear
  191.     self.contents.clear
  192.   end
  193. end

  194. #------------------------------------------------------------------------------

  195. class Game_Party
  196.   attr_reader   :actors2
  197.   attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  198.   attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  199.   def initialize
  200.     @actors = []
  201.     @gold = 0
  202.     @steps = 0
  203.     @items = {}
  204.     @weapons = {}
  205.     @armors = {}
  206.     @actors2 = []
  207.     [url=home.php?mod=space&uid=9543]@chaochao[/url] = [37]
  208.     @chaochao2 = []
  209.   end
  210.   def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
  211.     case type
  212.     when 1
  213.       if $game_actors[actor_id] != nil
  214.         actor = $game_actors[actor_id]
  215.         #如果队伍没有满和队伍中没有此角色
  216.         if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
  217.           @actors.push(actor)
  218.           $game_player.refresh
  219.         end
  220.       end
  221.     when 2
  222.       if $game_actors[actor_id] != nil
  223.         actor = $game_actors[actor_id]
  224.         #如果角色不在队伍中和不在备用角色队伍中的情况下
  225.         #向备用角色中添加角色
  226.         if not @actors.include?(actor) and not @actors2.include?(actor)
  227.           @actors2.push(actor)
  228.           $game_player.refresh
  229.         end
  230.       end
  231.     end
  232.   end
  233.   
  234.   def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
  235.     actor = $game_actors[index]
  236.     case type
  237.     when 1
  238.       if @actors.size < 3 and @actors2.include?(actor) and not @chaochao2.include?(index) and not @actors.include?(actor)
  239.         @actors.push(actor)
  240.         @actors2.delete(actor)
  241.         $game_system.se_play($data_system.decision_se)
  242.         $game_player.refresh
  243.       end
  244.     when 2
  245.       if @actors.include?(actor) and not @chaochao.include?(index) and not @actors2.include?(actor)
  246.         @actors2.push(actor)
  247.         @actors.delete(actor)
  248.         $game_system.se_play($data_system.decision_se)
  249.         $game_player.refresh
  250.       end
  251.     end
  252.   end
  253.   
  254.   #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
  255.   #type2,1是添加不能移动的,2是删除不能移动的。
  256.   def yidong(actor_id,type1,type2=1)
  257.     case type2
  258.     when 1
  259.       case type1
  260.       when 1
  261.         @chaochao.push(actor_id)
  262.       when 2
  263.         @chaochao2.push(actor_id)
  264.       end
  265.     when 2
  266.       case type1
  267.       when 1
  268.         @chaochao.delete(actor_id)
  269.       when 2
  270.         @chaochao2.delete(actor_id)
  271.       end
  272.     end
  273.   end
  274.   
  275.   #type,1从队伍中离开,2从备用角色中离开,3从队伍和备用角色中离开。
  276.   def remove_actor(actor_id,type=1)
  277.     actor = $game_actors[actor_id]
  278.     case type
  279.     when 1
  280.       @actors.delete(actor)
  281.       $game_player.refresh
  282.     when 2
  283.       @actors2.delete(actor)
  284.       $game_player.refresh
  285.     when 3
  286.       @actors.delete(actor)
  287.       @actors2.delete(actor)
  288.       $game_player.refresh
  289.     end
  290.   end
  291.   
  292.   def refresh
  293.     new_actors = []
  294.     new_actors2 = []
  295.     for i in [email]0...@actors.size[/email]
  296.       if $data_actors[@actors[i].id] != nil
  297.         new_actors.push($game_actors[@actors[i].id])
  298.       end
  299.     end
  300.     @actors = new_actors
  301.     for i in [email]0...@actors2.size[/email]
  302.       if $data_actors[@actors2[i].id] != nil
  303.         new_actors2.push($game_actors[@actors2[i].id])
  304.       end
  305.     end
  306.     @actors2 = new_actors2
  307.   end
  308. end

  309. #------------------------------------------------------------------------------

  310. class Chaochao_Scene_Party
  311.   def main
  312.     @left_temp_command = 0
  313.     @right_temp_command = 0
  314.     [url=home.php?mod=space&uid=263426]@temp[/url] = 0
  315.     @left_window = Chaochao_Window_PartyLeft.new
  316.     @left_window.active = true
  317.     @right_window = Chaochao_Window_PartyRight.new
  318.     @right_window.active = false
  319.     @data_window = Chaochao_Window_PartyData.new
  320.     update_data
  321.     Graphics.transition
  322.     loop do
  323.       Graphics.update
  324.       Input.update
  325.       update
  326.       if $scene != self
  327.         break
  328.       end
  329.     end
  330.     Graphics.freeze
  331.     @left_window.dispose
  332.     @right_window.dispose
  333.     @data_window.dispose
  334.   end
  335.   
  336.   def update
  337.     @left_window.update
  338.     @right_window.update
  339.     @data_window.update
  340.     update_command
  341.     update_data
  342.   end
  343.   
  344.   def update_command
  345.     if Input.trigger?(Input::B)
  346.       $game_system.se_play($data_system.cancel_se)
  347.       #画面切换
  348.       $scene = Scene_Map.new
  349.       return
  350.     end
  351.     if @left_window.active
  352.       update_left
  353.       return
  354.     end
  355.     if @right_window.active
  356.       update_right
  357.       return
  358.     end
  359.   end
  360.   
  361.   def update_left
  362.     if Input.trigger?(Input::RIGHT)
  363.       if @right_window.item_max > 0
  364.         @left_temp_command = @left_window.index
  365.         @left_window.set_index(-1)
  366.         $game_system.se_play($data_system.cursor_se)
  367.         @left_window.active = false
  368.         @right_window.active = true
  369.         @left_window.refresh
  370.         @right_window.refresh
  371.         @right_window.set_index(@right_temp_command)
  372.         return
  373.       else
  374.         $game_system.se_play($data_system.buzzer_se)
  375.         return
  376.       end
  377.     end
  378.     if Input.trigger?(Input::C)
  379.       if @left_window.active and @left_window.actor?(@left_window.index) and $game_party.actors.size > 1 and not $game_party.chaochao.include?($game_party.actors[@left_window.index].id)
  380.         $game_party.huanren($game_party.actors[@left_window.index].id,2)#type为1是从备用角色向队伍中移动,为2则相反。
  381.         @left_window.refresh
  382.         @right_window.refresh
  383.       else
  384.         $game_system.se_play($data_system.buzzer_se)
  385.       end
  386.     end
  387.     return
  388.   end
  389.   
  390.   def update_right
  391.     if Input.trigger?(Input::LEFT)
  392.       if @left_window.item_max > 0
  393.         @right_temp_command = @right_window.index
  394.         @right_window.set_index(-1)
  395.         $game_system.se_play($data_system.cursor_se)
  396.         @left_window.active = true
  397.         @right_window.active = false
  398.         @left_window.refresh
  399.         @right_window.refresh
  400.         @left_window.set_index(@left_temp_command)
  401.         return
  402.       else
  403.         $game_system.se_play($data_system.buzzer_se)
  404.         return
  405.       end
  406.     end
  407.     if Input.trigger?(Input::C)
  408.       if $game_party.actors.size >= 3
  409.         $game_system.se_play($data_system.buzzer_se)
  410.         return
  411.       end
  412.       if @right_window.active and @right_window.actor?(@right_window.index) and not $game_party.chaochao2.include?($game_party.actors2[@right_window.index].id)
  413.         $game_party.huanren($game_party.actors2[@right_window.index].id,1)#type为1是从备用角色向队伍中移动,为2则相反。
  414.         if $game_party.actors2.size == 0
  415.           @right_temp_command = @right_window.index
  416.           @right_window.set_index(-1)
  417.           $game_system.se_play($data_system.cursor_se)
  418.           @left_window.active = true
  419.           @right_window.active = false
  420.           @left_window.refresh
  421.           @right_window.refresh
  422.           @left_window.set_index(@left_temp_command)
  423.         end
  424.         if @right_window.index > 0
  425.           @right_window.set_index(@right_window.index-1)
  426.         end
  427.         @left_window.refresh
  428.         @right_window.refresh
  429.       else
  430.         $game_system.se_play($data_system.buzzer_se)
  431.       end
  432.     end
  433.     return
  434.   end
  435.   
  436.   def update_data
  437.     if @left_window.active
  438.       if $game_party.actors[@left_window.index] != nil
  439.         @data_window.set_actor($game_party.actors[@left_window.index])
  440.       else
  441.         @data_window.clear
  442.       end
  443.       return
  444.     end
  445.     if @right_window.active
  446.       if $game_party.actors2[@right_window.index] != nil
  447.         @data_window.set_actor($game_party.actors2[@right_window.index])
  448.       else
  449.         @data_window.clear
  450.       end
  451.       return
  452.     end
  453.   end
  454. end
  455. class Chaochao_Window_PartyData < Window_Base
  456. #--------------------------------------------------------------------------
  457. # ● 初始化对像
  458. #--------------------------------------------------------------------------
  459. def initialize
  460. super(0, 224, 640, 256)
  461. self.contents = Bitmap.new(width - 32, height - 32)
  462. self.opacity = 160
  463. @actor = nil
  464. end
  465. #--------------------------------------------------------------------------
  466. # ● 设置角色
  467. #--------------------------------------------------------------------------
  468. def set_actor(actor)
  469. clear
  470. @actor = actor

  471. x = 4 + 32
  472. y = 0
  473. draw_actor_graphic(@actor, 32, 64)
  474. self.contents.font.color = normal_color
  475. self.contents.draw_text(x - 120 + 128, y, 120, 32, @actor.name, 2)
  476. draw_actor_state(@actor, x + 64, y + 32)

  477. x = 4
  478. y = 72
  479. draw_actor_level(@actor, x, y)
  480. self.contents.draw_text(x - 236 + 160, y, 236, 32, @actor.class_name, 2)
  481. draw_actor_hp(@actor, x, y + 32, 172)
  482. draw_actor_sp(@actor, x, y + 64, 172)
  483. self.contents.font.color = system_color
  484. self.contents.draw_text(x, y + 96 , 80, 32, "EXP")
  485. self.contents.draw_text(x, y + 128, 80, 32, "NEXP EXP")
  486. self.contents.font.color = normal_color
  487. self.contents.draw_text(x + 72, y + 96 , 84, 32, @actor.exp_s, 2)
  488. self.contents.draw_text(x + 72, y + 128, 84, 32, @actor.next_rest_exp_s, 2)

  489. x = 224 - 16
  490. for i in 0..6 do draw_actor_parameter(@actor, x, 32*i, i) end

  491. x = 420 - 16
  492. width = 96
  493. self.contents.font.color = system_color
  494. self.contents.draw_text(x-16, 32*0, width, 32, "裝備")
  495. self.contents.draw_text(x-16, 32*1, width, 32, $data_system.words.weapon)
  496. self.contents.draw_text(x-16, 32*2, width, 32, $data_system.words.armor1)
  497. self.contents.draw_text(x-16, 32*3, width, 32, $data_system.words.armor2)
  498. self.contents.draw_text(x-16, 32*4, width, 32, $data_system.words.armor3)
  499. self.contents.draw_text(x-16, 32*5, width, 32, $data_system.words.armor4)
  500. draw_item_name($data_weapons[@actor.weapon_id], x + 36, 32*1)
  501. draw_item_name($data_armors[@actor.armor1_id] , x + 36, 32*2)
  502. draw_item_name($data_armors[@actor.armor2_id] , x + 36, 32*3)
  503. draw_item_name($data_armors[@actor.armor3_id] , x + 36, 32*4)
  504. draw_item_name($data_armors[@actor.armor4_id] , x + 36, 32*5)
  505. end
  506. #--------------------------------------------------------------------------
  507. # ● 清除
  508. #--------------------------------------------------------------------------
  509. def clear
  510. self.contents.clear
  511. end
  512. end
复制代码
梦石
0
星屑
125
在线时间
171 小时
注册时间
2014-4-14
回帖
135
发表于 2016-10-4 07:25:40 | 显示全部楼层
参考这个对你有帮助吗?战斗换人脚本 加 角色不参战也能获得经验。
  1. module LimBattlePlug

  2. # 队伍最大人数
  3. MaxPartySize = 8

  4. # 出战人数
  5. MaxBattlerSize = 1

  6. # 换人语句
  7. WordChangeBattler = "换人"

  8. # 换人时播放的动画
  9. AnimationChangeBattler = 0

  10. end

  11. class Game_BattleAction
  12.   attr_accessor :change_to_battler
  13.   # 初始化
  14.   alias lbp_initialize initialize
  15.   def initialize
  16.     lbp_initialize
  17.     @change_to_battler = 0
  18.   end
  19.   # 欲更换角色编号
  20.   def set_change_battler
  21.     @kind = 3
  22.   end
  23.   # 判断行动是否为更换角色
  24.   def is_change_battler?
  25.     return (@kind == 3)
  26.   end
  27. end

  28. class Game_Party
  29.   include LimBattlePlug
  30.   attr_reader :actors2
  31.   alias lpb_initialize initialize
  32.   def initialize
  33.     lpb_initialize
  34.     @actors2 = []
  35.   end
  36.   # 角色加入
  37.   def add_actor(actor_id)
  38.     actor = $game_actors[actor_id]
  39.     if @actors.size < MaxPartySize and not @actors.include?(actor)
  40.       @actors.push(actor)
  41.       $game_player.refresh
  42.     end
  43.   end
  44.   # 设置战斗的角色
  45.   def set_actor_to_battle
  46.     @actors2 = []
  47.     @actors.each do |actor|
  48.       @actors2.push(actor)
  49.     end
  50.     @actors = []
  51.     @actors2.each do |actor|
  52.       @actors.push(actor)
  53.       break if @actors.size == MaxBattlerSize
  54.     end
  55.   end
  56.   # 还原战斗的角色
  57.   def set_actor_to_normal
  58.     @actors = []
  59.     @actors2.each do |actor|
  60.       @actors.push(actor)
  61.     end
  62.   end
  63.   # 获取角色id数组
  64.   def get_actors_id
  65.     id = []
  66.     @actors.each{|actor|id.push(actor.id)}
  67.     return id
  68.   end
  69.   # 获取角色id数组
  70.   def get_actors2_id
  71.     id = []
  72.     @actors2.each{|actor|id.push(actor.id)}
  73.     return id
  74.   end
  75.   # 兑换角色
  76.   def change_actor(index,id)
  77.     @actors[index] = $game_actors[id]
  78.   end
  79.   # 全灭判定
  80.   def all_dead?
  81.     # 同伴人数为 0 的情况下
  82.     if $game_party.actors.size == 0
  83.       return false
  84.     end
  85.     # 同伴中无人 HP 在 0 以上
  86.     for actor in @actors2
  87.       if actor.hp > 0
  88.         return false
  89.       end
  90.     end
  91.     for actor in @actors
  92.       if actor.hp > 0
  93.         return false
  94.       end
  95.     end
  96.     # 全灭
  97.     return true
  98.   end
  99.   # 其他角色
  100.   def other_actors
  101.     actors = []
  102.     @actors2.each{|actor|actors.push(actor) if !@actors.include?(actor)}
  103.     return actors
  104.   end
  105.   # 角色位置互换
  106.   def change_actor_pos(id1,id2)
  107.     actor_id = []
  108.     @actors.each do |actor|
  109.       actor_id.push(actor.id)
  110.     end
  111.     return if !actor_id.include?(id1) and !actor_id.include?(id2)
  112.     id1_index = id2_index = -1
  113.     (0...actor_id.size).each do |i|
  114.       if actor_id[i] == id1
  115.         id1_index = i
  116.       elsif actor_id[i] == id2
  117.         id2_index = i
  118.       end
  119.     end
  120.     temp_actor = @actors[id1_index]
  121.     @actors[id1_index] = @actors[id2_index]
  122.     @actors[id2_index] = temp_actor
  123.   end
  124. end

  125. class Window_Actor < Window_Selectable
  126.   # 初始化
  127.   def initialize
  128.     super(0,64,640,256)
  129.     self.back_opacity = 160
  130.     refresh
  131.     self.index = -1
  132.     self.active = false
  133.   end
  134.   # 刷新
  135.   def refresh
  136.     @item_max = $game_party.actors2.size
  137.     [url=home.php?mod=space&uid=2653549]@data[/url] = []
  138.     $game_party.actors.each do |actor|
  139.       @data.push(actor)
  140.     end
  141.     $game_party.actors2.each do |actor|
  142.       @data.push(actor) if !@data.include?(actor)
  143.     end
  144.     if self.contents != nil
  145.       self.contents.clear
  146.       self.contents = nil
  147.     end
  148.     self.contents = Bitmap.new(608,@data.size*32)
  149.     x = 4
  150.     y = 0
  151.   @data.each do |actor|
  152.       bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)
  153.       rect = Rect.new(0,0,bitmap.width/4,31)
  154.       self.contents.blt(x+16-bitmap.width/8,y,bitmap,rect)
  155.       draw_actor_name(actor,x+36,y)
  156.       draw_actor_state(actor,156,y)
  157.       draw_actor_hp(actor,x+256,y,96)
  158.       draw_actor_sp(actor,x+376,y,96)
  159.       if $game_party.actors.include?(actor)
  160.         self.contents.font.color = text_color(6)
  161.         cword = "出战"
  162.       else
  163.         self.contents.font.color = text_color(0)
  164.         cword = "待战"
  165.       end
  166.       self.contents.draw_text(x+496,y,60,32,cword)
  167.       y += 32
  168.     end
  169.   end
  170.   # 获取当前角色编号
  171.   def actor_id
  172.     return @data[self.index].id
  173.   end
  174.   # 刷新帮助
  175.   def update_help
  176.     @help_window.set_text(@data[self.index] == nil ?\
  177.                           "" : @data[self.index].name)
  178.   end
  179. end

  180. class Scene_Battle
  181.   include LimBattlePlug
  182.   # 初始化
  183.   def initialize
  184.     $game_party.set_actor_to_battle
  185.   end
  186.   # 主处理
  187.   def main
  188.     # 初始化战斗用的各种暂时数据
  189.     $game_temp.in_battle = true
  190.     $game_temp.battle_turn = 0
  191.     $game_temp.battle_event_flags.clear
  192.     $game_temp.battle_abort = false
  193.     $game_temp.battle_main_phase = false
  194.     $game_temp.battleback_name = $game_map.battleback_name
  195.     $game_temp.forcing_battler = nil
  196.     # 初始化战斗用事件解释器
  197.     $game_system.battle_interpreter.setup(nil, 0)
  198.     # 准备队伍
  199.     @troop_id = $game_temp.battle_troop_id
  200.     $game_troop.setup(@troop_id)
  201.     # 生成角色命令窗口
  202.     s1 = $data_system.words.attack
  203.     s2 = $data_system.words.skill
  204.     s3 = $data_system.words.guard
  205.     s4 = $data_system.words.item
  206.     s5 = WordChangeBattler
  207.     @actor_command_window = Window_Command.new(85, [s1, s2, s3, s4,s5])
  208.     @actor_command_window.y = 128
  209.     @actor_command_window.back_opacity = 160
  210.     @actor_command_window.active = false
  211.     @actor_command_window.visible = false
  212.     # 生成其它窗口
  213.     @party_command_window = Window_PartyCommand.new
  214.     @help_window = Window_Help.new
  215.     @help_window.back_opacity = 160
  216.     @help_window.visible = false
  217.     @status_window = Window_BattleStatus.new
  218.     @message_window = Window_Message.new
  219.     # 生成活动块
  220.     @spriteset = Spriteset_Battle.new
  221.     # 初始化等待计数
  222.     @wait_count = 0
  223.     # 执行过渡
  224.     if $data_system.battle_transition == ""
  225.       Graphics.transition(20)
  226.     else
  227.       Graphics.transition(40, "Graphics/Transitions/" +
  228.         $data_system.battle_transition)
  229.     end
  230.     # 开始自由战斗回合
  231.     start_phase1
  232.     # 主循环
  233.     loop do
  234.       # 刷新游戏画面
  235.       Graphics.update
  236.       # 刷新输入信息
  237.       Input.update
  238.       # 刷新画面
  239.       update
  240.       # 如果画面切换的话就中断循环
  241.       if $scene != self
  242.         break
  243.       end
  244.     end
  245.     # 刷新地图
  246.     $game_map.refresh
  247.     # 准备过渡
  248.     Graphics.freeze
  249.     # 释放窗口
  250.     @actor_command_window.dispose
  251.     @party_command_window.dispose
  252.     @help_window.dispose
  253.     @status_window.dispose
  254.     @message_window.dispose
  255.     if @skill_window != nil
  256.       @skill_window.dispose
  257.     end
  258.     if @item_window != nil
  259.       @item_window.dispose
  260.     end
  261.     if @actor_window != nil
  262.       @actor_window.dispose
  263.     end
  264.     if @result_window != nil
  265.       @result_window.dispose
  266.     end
  267.     # 释放活动块
  268.     @spriteset.dispose
  269.     # 标题画面切换中的情况
  270.     if $scene.is_a?(Scene_Title)
  271.       # 淡入淡出画面
  272.       Graphics.transition
  273.       Graphics.freeze
  274.     end
  275.     # 战斗测试或者游戏结束以外的画面切换中的情况
  276.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  277.       $scene = nil
  278.     end
  279.   end
  280.   # 战斗结束
  281.   alias lpb_battle_end battle_end
  282.   def battle_end(n)
  283.     lpb_battle_end(n)
  284.     $game_party.set_actor_to_normal
  285.   end
  286.   # 开始回合3
  287.   alias lbp_start_phase3 start_phase3
  288.   def start_phase3
  289.     @changed_battler_id = []
  290.     lbp_start_phase3
  291.   end
  292.   # 刷新角色命令回合画面
  293.   def update_phase3
  294.     # 敌人光标有效的情况下
  295.     if @enemy_arrow != nil
  296.       update_phase3_enemy_select
  297.     # 角色光标有效的情况下
  298.     elsif @actor_arrow != nil
  299.       update_phase3_actor_select
  300.     # 特技窗口有效的情况下
  301.     elsif @skill_window != nil
  302.       update_phase3_skill_select
  303.     # 物品窗口有效的情况下
  304.     elsif @item_window != nil
  305.       update_phase3_item_select
  306.     elsif @actor_window != nil
  307.       update_phase3_battler_select
  308.     # 角色指令窗口有效的情况下
  309.     elsif @actor_command_window.active
  310.       update_phase3_basic_command
  311.     end
  312.   end
  313.   # 角色基本命令
  314.   def update_phase3_basic_command
  315.     # 按下 B 键的情况下
  316.     if Input.trigger?(Input::B)
  317.       # 演奏取消 SE
  318.       $game_system.se_play($data_system.cancel_se)
  319.       # 转向前一个角色的指令输入
  320.       phase3_prior_actor
  321.       return
  322.     end
  323.     # 按下 C 键的情况下
  324.     if Input.trigger?(Input::C)
  325.       # 角色指令窗口光标位置分之
  326.       case @actor_command_window.index
  327.       when 0  # 攻击
  328.         # 演奏确定 SE
  329.         $game_system.se_play($data_system.decision_se)
  330.         # 设置行动
  331.         @active_battler.current_action.kind = 0
  332.         @active_battler.current_action.basic = 0
  333.         # 开始选择敌人
  334.         start_enemy_select
  335.       when 1  # 特技
  336.         # 演奏确定 SE
  337.         $game_system.se_play($data_system.decision_se)
  338.         # 设置行动
  339.         @active_battler.current_action.kind = 1
  340.         # 开始选择特技
  341.         start_skill_select
  342.       when 2  # 防御
  343.         # 演奏确定 SE
  344.         $game_system.se_play($data_system.decision_se)
  345.         # 设置行动
  346.         @active_battler.current_action.kind = 0
  347.         @active_battler.current_action.basic = 1
  348.         # 转向下一位角色的指令输入
  349.         phase3_next_actor
  350.       when 3  # 物品
  351.         # 演奏确定 SE
  352.         $game_system.se_play($data_system.decision_se)
  353.         # 设置行动
  354.         @active_battler.current_action.kind = 2
  355.         # 开始选择物品
  356.         start_item_select
  357.       when 4 # 换人
  358.         $game_system.se_play($data_system.decision_se)
  359.         @active_battler.current_action.set_change_battler
  360.         start_battler_select
  361.       end
  362.       return
  363.     end
  364.   end
  365.   # 开始角色选择
  366.   def start_battler_select
  367.     @actor_window = Window_Actor.new
  368.     @actor_window.active = true
  369.     @actor_window.index = 0
  370.     @actor_window.help_window = @help_window
  371.     @actor_command_window.active = false
  372.     @actor_command_window.visible = false
  373.   end
  374.   # 结束角色选择
  375.   def end_battler_select
  376.     @actor_window.dispose
  377.     @actor_window = nil
  378.     @help_window.visible = false
  379.     @actor_command_window.active = true
  380.     @actor_command_window.visible = true
  381.   end
  382.   # 刷新角色选择
  383.   def update_phase3_battler_select
  384.     @actor_window.visible = true
  385.     @actor_window.update
  386.     if Input.trigger?(Input::B)
  387.       $game_system.se_play($data_system.cancel_se)
  388.       end_battler_select
  389.       return
  390.     end
  391.     if Input.trigger?(Input::C)
  392.       actor_id = @actor_window.actor_id
  393.       if $game_party.get_actors_id.include?(actor_id) or
  394.          $game_actors[actor_id].dead? or
  395.          @changed_battler_id.include?(actor_id)
  396.         $game_system.se_play($data_system.buzzer_se)
  397.         return
  398.       end
  399.       $game_system.se_play($data_system.decision_se)
  400.       @active_battler.current_action.change_to_battler = actor_id
  401.       @changed_battler_id.push(actor_id)
  402.       end_battler_select
  403.       phase3_next_actor
  404.       return
  405.     end
  406.   end
  407.   # 行动方动画
  408.   def update_phase4_step3
  409.     if @active_battler.current_action.is_change_battler?
  410.       @animation1_id = AnimationChangeBattler
  411.       @target_battlers = []
  412.     end
  413.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  414.     if @animation1_id == 0
  415.       @active_battler.white_flash = true
  416.     else
  417.       @active_battler.animation_id = @animation1_id
  418.       @active_battler.animation_hit = true
  419.     end
  420.     # 移至步骤 4
  421.     @phase4_step = 4
  422.   end
  423.   # 对象方动画
  424.   def update_phase4_step4
  425.     if @active_battler.current_action.is_change_battler?
  426.       actor1_id = @active_battler.current_action.change_to_battler
  427.       actor2_id = @active_battler.id
  428.       (0...$game_party.actors.size).each do |i|
  429.         if $game_party.actors[i].id == actor2_id
  430.           $game_party.change_actor(i,actor1_id)
  431.           @active_battler = $game_actors[actor1_id]
  432.           @status_window.refresh
  433.         end
  434.       end
  435.     end
  436.     # 对像方动画
  437.     for target in @target_battlers
  438.       target.animation_id = @animation2_id
  439.       target.animation_hit = (target.damage != "Miss")
  440.     end
  441.     # 限制动画长度、最低 8 帧
  442.     @wait_count = 8
  443.     # 移至步骤 5
  444.     @phase4_step = 5
  445.   end
  446.   # 公共事件
  447.   def update_phase4_step6
  448.     @target_battlers.each do |target|
  449.       if target.is_a?(Game_Actor) and target.dead? and
  450.          !$game_party.other_actors.all?{|actor|actor.dead?}
  451.         @actor_window = Window_Actor.new
  452.         @actor_window.index = 0
  453.         @actor_window.active = true
  454.         @actor_window.help_window = @help_window
  455.         actor_id = -1
  456.         loop do
  457.           Graphics.update
  458.           Input.update
  459.           @actor_window.update
  460.           if Input.trigger?(Input::C)
  461.             actor = $game_actors[@actor_window.actor_id]
  462.             if actor.dead? or
  463.                (@changed_battler_id.include?(actor.id) and
  464.                 target.current_action.change_to_battler != actor.id) or
  465.                $game_party.actors.include?(actor)
  466.               $game_system.se_play($data_system.buzzer_se)
  467.             else
  468.               actor_id = actor.id
  469.             end
  470.           end
  471.           break if actor_id >= 0
  472.         end
  473.         @actor_window.visible = false
  474.         @actor_window.dispose
  475.         @actor_window = nil
  476.         @help_window.visible = false
  477.         (0...$game_party.actors.size).each do |i|
  478.           if $game_party.actors[i].id == target.id
  479.             $game_party.change_actor(i,actor_id)
  480.             @status_window.refresh
  481.           end
  482.         end
  483.       end
  484.     end
  485.     # 清除强制行动对像的战斗者
  486.     $game_temp.forcing_battler = nil
  487.     # 公共事件 ID 有效的情况下
  488.     if @common_event_id > 0
  489.       # 设置事件
  490.       common_event = $data_common_events[@common_event_id]
  491.       $game_system.battle_interpreter.setup(common_event.list, 0)
  492.     end
  493.     # 移至步骤 1
  494.     @phase4_step = 1
  495.   end
  496.   end
复制代码

点评

fjm
145行出问题了,注释掉以后感觉没有换人的功能了  发表于 2016-10-4 09:15
Vanyogin
回复

使用道具 举报

梦石
0
星屑
1788
在线时间
1313 小时
注册时间
2012-8-4
回帖
724
发表于 2016-10-4 10:29:44 | 显示全部楼层
加到仓库脚本后
  1. class Scene_Battle
  2.   alias start_phase56104 start_phase5
  3.   def start_phase5
  4.      start_phase56104
  5.      # 敌人不是隐藏状态的情况下获得 EXP
  6.      @exp104=0
  7.      $game_troop.enemies.each{|enemy|@exp104 += enemy.exp if !enemy.hidden}
  8.      $game_party.actors2.each{|actor|actor.exp += @exp104 if !actor.cant_get_exp?}
  9.   end
  10. end
复制代码

点评

fjm
你QQ多少,加个好友,我可以把你需要的图发给你  发表于 2016-10-4 13:44
OK  发表于 2016-10-4 12:23
fjm
剧情啥的我也做的很差,我只会画点图,要是有需要的话,我画的图你拿去用吧  发表于 2016-10-4 11:49
fjm
非常感谢,可以了  发表于 2016-10-4 11:42
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部