设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2363|回复: 7
打印 上一主题 下一主题

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

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2150
在线时间
1010 小时
注册时间
2015-10-17
帖子
1283
跳转到指定楼层
1
发表于 2016-10-3 20:33:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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


RUBY 代码复制
  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. #==============================================================================



RUBY 代码复制
  1. [        DISCUZ_CODE_0        ][/code]

RUBY 代码复制
  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. #------------------------------------------------------------------------------
  94.  
  95. class Chaochao_Window_PartyRight < Window_Selectable
  96.   def initialize
  97.     super(320, 0, 320, 224)
  98.     self.contents = Bitmap.new(width - 32, height - 32)
  99.     self.opacity = 160
  100.     self.index = -1
  101.     refresh
  102.   end
  103.   def actor
  104.     return @actors[self.index]
  105.   end
  106.   def refresh
  107.     if self.contents != nil
  108.       self.contents.dispose
  109.       self.contents = nil
  110.     end
  111.     @actors = []
  112.     for i in 0...$game_party.actors2.size
  113.       @actors.push($game_party.actors2[i])
  114.     end
  115.  
  116.     @item_max = $game_party.actors2.size
  117.     if @item_max > 0
  118.       self.contents = Bitmap.new(width - 32, row_max * 32)
  119.       for i in 0...@item_max
  120.         draw_item(i)
  121.       end
  122.     elsif @item_max == 0
  123.  
  124.     end
  125.   end
  126.   def draw_item(index)
  127.     actor = @actors[index]
  128.     text = @actors[index].name
  129.     lv = @actors[index].level.to_s + " "
  130.     if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
  131.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  132.       else
  133.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  134.       end
  135.     self.contents.draw_text(3, index * 32, 288, 32, text)
  136.     self.contents.font.color = normal_color
  137.     self.contents.font.size = 16
  138.     self.contents.draw_text(3, index * 32 + 4, 264, 32,  "Lv:   ", 2)
  139.     colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  140.     colory = [255.0000 / 60 * @actors[index].level,255].min
  141.     self.contents.font.color = Color.new(colorx, colory, 0)
  142.     self.contents.draw_text(3, index * 32 + 4, 288, 32,  lv, 2)
  143.     self.contents.font.color = normal_color
  144.     self.contents.font.size = 22
  145.   end
  146.   def update_cursor_rect
  147.     if @index < 0
  148.       self.cursor_rect.empty
  149.       return
  150.     end
  151.     row = @index / @column_max
  152.     if row < self.top_row
  153.       self.top_row = row
  154.     end
  155.     if row > self.top_row + (self.page_row_max - 1)
  156.       self.top_row = row - (self.page_row_max - 1)
  157.     end
  158.     cursor_width = self.width / @column_max - 32
  159.     x = @index % @column_max * (cursor_width + 32)
  160.     y = @index / @column_max * 32 - self.oy
  161.     self.cursor_rect.set(x, y, cursor_width, 32)
  162.   end
  163.   def item_max
  164.     return @item_max
  165.   end
  166.   def actor?(index)
  167.     return @actors[index] == nil ? false : true
  168.   end
  169.   def set_index(x)
  170.     @index = x
  171.   end
  172. end
  173.  
  174. #------------------------------------------------------------------------------
  175.  
  176. class Chaochao_Window_PartyData < Window_Base
  177.  
  178.   def initialize
  179.     super(0, 224, 640, 256)
  180.     self.contents = Bitmap.new(width - 32, height - 32)
  181.     self.opacity = 160
  182.     @actor = nil
  183.   end
  184.  
  185.   def set_actor(actor)
  186.     self.contents.clear
  187.     draw_actor_name(actor, 4, 0)
  188.     draw_actor_state(actor, 140, 0)
  189.     draw_actor_hp(actor, 284, 0)
  190.     draw_actor_sp(actor, 460, 0)
  191.     @actor = actor
  192.     self.visible = true
  193.   end
  194.   def clear
  195.     self.contents.clear
  196.   end
  197. end
  198.  
  199. #------------------------------------------------------------------------------
  200.  
  201. class Game_Party
  202.   attr_reader   :actors2
  203.   attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  204.   attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  205.   def initialize
  206.     @actors = []
  207.     @gold = 0
  208.     @steps = 0
  209.     @items = {}
  210.     @weapons = {}
  211.     @armors = {}
  212.     @actors2 = []
  213.     [url=home.php?mod=space&uid=9543]@chaochao[/url] = [37]
  214.     @chaochao2 = []
  215.   end
  216.   def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
  217.     case type
  218.     when 1
  219.       if $game_actors[actor_id] != nil
  220.         actor = $game_actors[actor_id]
  221.         #如果队伍没有满和队伍中没有此角色
  222.         if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
  223.           @actors.push(actor)
  224.           $game_player.refresh
  225.         end
  226.       end
  227.     when 2
  228.       if $game_actors[actor_id] != nil
  229.         actor = $game_actors[actor_id]
  230.         #如果角色不在队伍中和不在备用角色队伍中的情况下
  231.         #向备用角色中添加角色
  232.         if not @actors.include?(actor) and not @actors2.include?(actor)
  233.           @actors2.push(actor)
  234.           $game_player.refresh
  235.         end
  236.       end
  237.     end
  238.   end
  239.  
  240.   def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
  241.     actor = $game_actors[index]
  242.     case type
  243.     when 1
  244.       if @actors.size < 3 and @actors2.include?(actor) and not @chaochao2.include?(index) and not @actors.include?(actor)
  245.         @actors.push(actor)
  246.         @actors2.delete(actor)
  247.         $game_system.se_play($data_system.decision_se)
  248.         $game_player.refresh
  249.       end
  250.     when 2
  251.       if @actors.include?(actor) and not @chaochao.include?(index) and not @actors2.include?(actor)
  252.         @actors2.push(actor)
  253.         @actors.delete(actor)
  254.         $game_system.se_play($data_system.decision_se)
  255.         $game_player.refresh
  256.       end
  257.     end
  258.   end
  259.  
  260.   #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
  261.   #type2,1是添加不能移动的,2是删除不能移动的。
  262.   def yidong(actor_id,type1,type2=1)
  263.     case type2
  264.     when 1
  265.       case type1
  266.       when 1
  267.         @chaochao.push(actor_id)
  268.       when 2
  269.         @chaochao2.push(actor_id)
  270.       end
  271.     when 2
  272.       case type1
  273.       when 1
  274.         @chaochao.delete(actor_id)
  275.       when 2
  276.         @chaochao2.delete(actor_id)
  277.       end
  278.     end
  279.   end
  280.  
  281.   #type,1从队伍中离开,2从备用角色中离开,3从队伍和备用角色中离开。
  282.   def remove_actor(actor_id,type=1)
  283.     actor = $game_actors[actor_id]
  284.     case type
  285.     when 1
  286.       @actors.delete(actor)
  287.       $game_player.refresh
  288.     when 2
  289.       @actors2.delete(actor)
  290.       $game_player.refresh
  291.     when 3
  292.       @actors.delete(actor)
  293.       @actors2.delete(actor)
  294.       $game_player.refresh
  295.     end
  296.   end
  297.  
  298.   def refresh
  299.     new_actors = []
  300.     new_actors2 = []
  301.     for i in [email]0...@actors.size[/email]
  302.       if $data_actors[@actors[i].id] != nil
  303.         new_actors.push($game_actors[@actors[i].id])
  304.       end
  305.     end
  306.     @actors = new_actors
  307.     for i in [email]0...@actors2.size[/email]
  308.       if $data_actors[@actors2[i].id] != nil
  309.         new_actors2.push($game_actors[@actors2[i].id])
  310.       end
  311.     end
  312.     @actors2 = new_actors2
  313.   end
  314. end
  315.  
  316. #------------------------------------------------------------------------------
  317.  
  318. class Chaochao_Scene_Party
  319.   def main
  320.     @left_temp_command = 0
  321.     @right_temp_command = 0
  322.     [url=home.php?mod=space&uid=263426]@temp[/url] = 0
  323.     @left_window = Chaochao_Window_PartyLeft.new
  324.     @left_window.active = true
  325.     @right_window = Chaochao_Window_PartyRight.new
  326.     @right_window.active = false
  327.     @data_window = Chaochao_Window_PartyData.new
  328.     update_data
  329.     Graphics.transition
  330.     loop do
  331.       Graphics.update
  332.       Input.update
  333.       update
  334.       if $scene != self
  335.         break
  336.       end
  337.     end
  338.     Graphics.freeze
  339.     @left_window.dispose
  340.     @right_window.dispose
  341.     @data_window.dispose
  342.   end
  343.  
  344.   def update
  345.     @left_window.update
  346.     @right_window.update
  347.     @data_window.update
  348.     update_command
  349.     update_data
  350.   end
  351.  
  352.   def update_command
  353.     if Input.trigger?(Input::B)
  354.       $game_system.se_play($data_system.cancel_se)
  355.       #画面切换
  356.       $scene = Scene_Map.new
  357.       return
  358.     end
  359.     if @left_window.active
  360.       update_left
  361.       return
  362.     end
  363.     if @right_window.active
  364.       update_right
  365.       return
  366.     end
  367.   end
  368.  
  369.   def update_left
  370.     if Input.trigger?(Input::RIGHT)
  371.       if @right_window.item_max > 0
  372.         @left_temp_command = @left_window.index
  373.         @left_window.set_index(-1)
  374.         $game_system.se_play($data_system.cursor_se)
  375.         @left_window.active = false
  376.         @right_window.active = true
  377.         @left_window.refresh
  378.         @right_window.refresh
  379.         @right_window.set_index(@right_temp_command)
  380.         return
  381.       else
  382.         $game_system.se_play($data_system.buzzer_se)
  383.         return
  384.       end
  385.     end
  386.     if Input.trigger?(Input::C)
  387.       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)
  388.         $game_party.huanren($game_party.actors[@left_window.index].id,2)#type为1是从备用角色向队伍中移动,为2则相反。
  389.         @left_window.refresh
  390.         @right_window.refresh
  391.       else
  392.         $game_system.se_play($data_system.buzzer_se)
  393.       end
  394.     end
  395.     return
  396.   end
  397.  
  398.   def update_right
  399.     if Input.trigger?(Input::LEFT)
  400.       if @left_window.item_max > 0
  401.         @right_temp_command = @right_window.index
  402.         @right_window.set_index(-1)
  403.         $game_system.se_play($data_system.cursor_se)
  404.         @left_window.active = true
  405.         @right_window.active = false
  406.         @left_window.refresh
  407.         @right_window.refresh
  408.         @left_window.set_index(@left_temp_command)
  409.         return
  410.       else
  411.         $game_system.se_play($data_system.buzzer_se)
  412.         return
  413.       end
  414.     end
  415.     if Input.trigger?(Input::C)
  416.       if $game_party.actors.size >= 3
  417.         $game_system.se_play($data_system.buzzer_se)
  418.         return
  419.       end
  420.       if @right_window.active and @right_window.actor?(@right_window.index) and not $game_party.chaochao2.include?($game_party.actors2[@right_window.index].id)
  421.         $game_party.huanren($game_party.actors2[@right_window.index].id,1)#type为1是从备用角色向队伍中移动,为2则相反。
  422.         if $game_party.actors2.size == 0
  423.           @right_temp_command = @right_window.index
  424.           @right_window.set_index(-1)
  425.           $game_system.se_play($data_system.cursor_se)
  426.           @left_window.active = true
  427.           @right_window.active = false
  428.           @left_window.refresh
  429.           @right_window.refresh
  430.           @left_window.set_index(@left_temp_command)
  431.         end
  432.         if @right_window.index > 0
  433.           @right_window.set_index(@right_window.index-1)
  434.         end
  435.         @left_window.refresh
  436.         @right_window.refresh
  437.       else
  438.         $game_system.se_play($data_system.buzzer_se)
  439.       end
  440.     end
  441.     return
  442.   end
  443.  
  444.   def update_data
  445.     if @left_window.active
  446.       if $game_party.actors[@left_window.index] != nil
  447.         @data_window.set_actor($game_party.actors[@left_window.index])
  448.       else
  449.         @data_window.clear
  450.       end
  451.       return
  452.     end
  453.     if @right_window.active
  454.       if $game_party.actors2[@right_window.index] != nil
  455.         @data_window.set_actor($game_party.actors2[@right_window.index])
  456.       else
  457.         @data_window.clear
  458.       end
  459.       return
  460.     end
  461.   end
  462. end
  463. class Chaochao_Window_PartyData < Window_Base
  464. #--------------------------------------------------------------------------
  465. # ● 初始化对像
  466. #--------------------------------------------------------------------------
  467. def initialize
  468. super(0, 224, 640, 256)
  469. self.contents = Bitmap.new(width - 32, height - 32)
  470. self.opacity = 160
  471. @actor = nil
  472. end
  473. #--------------------------------------------------------------------------
  474. # ● 设置角色
  475. #--------------------------------------------------------------------------
  476. def set_actor(actor)
  477. clear
  478. @actor = actor
  479.  
  480. x = 4 + 32
  481. y = 0
  482. draw_actor_graphic(@actor, 32, 64)
  483. self.contents.font.color = normal_color
  484. self.contents.draw_text(x - 120 + 128, y, 120, 32, @actor.name, 2)
  485. draw_actor_state(@actor, x + 64, y + 32)
  486.  
  487. x = 4
  488. y = 72
  489. draw_actor_level(@actor, x, y)
  490. self.contents.draw_text(x - 236 + 160, y, 236, 32, @actor.class_name, 2)
  491. draw_actor_hp(@actor, x, y + 32, 172)
  492. draw_actor_sp(@actor, x, y + 64, 172)
  493. self.contents.font.color = system_color
  494. self.contents.draw_text(x, y + 96 , 80, 32, "EXP")
  495. self.contents.draw_text(x, y + 128, 80, 32, "NEXP EXP")
  496. self.contents.font.color = normal_color
  497. self.contents.draw_text(x + 72, y + 96 , 84, 32, @actor.exp_s, 2)
  498. self.contents.draw_text(x + 72, y + 128, 84, 32, @actor.next_rest_exp_s, 2)
  499.  
  500. x = 224 - 16
  501. for i in 0..6 do draw_actor_parameter(@actor, x, 32*i, i) end
  502.  
  503. x = 420 - 16
  504. width = 96
  505. self.contents.font.color = system_color
  506. self.contents.draw_text(x-16, 32*0, width, 32, "裝備")
  507. self.contents.draw_text(x-16, 32*1, width, 32, $data_system.words.weapon)
  508. self.contents.draw_text(x-16, 32*2, width, 32, $data_system.words.armor1)
  509. self.contents.draw_text(x-16, 32*3, width, 32, $data_system.words.armor2)
  510. self.contents.draw_text(x-16, 32*4, width, 32, $data_system.words.armor3)
  511. self.contents.draw_text(x-16, 32*5, width, 32, $data_system.words.armor4)
  512. draw_item_name($data_weapons[@actor.weapon_id], x + 36, 32*1)
  513. draw_item_name($data_armors[@actor.armor1_id] , x + 36, 32*2)
  514. draw_item_name($data_armors[@actor.armor2_id] , x + 36, 32*3)
  515. draw_item_name($data_armors[@actor.armor3_id] , x + 36, 32*4)
  516. draw_item_name($data_armors[@actor.armor4_id] , x + 36, 32*5)
  517. end
  518. #--------------------------------------------------------------------------
  519. # ● 清除
  520. #--------------------------------------------------------------------------
  521. def clear
  522. self.contents.clear
  523. end
  524. end

Lv1.梦旅人

梦石
0
星屑
125
在线时间
171 小时
注册时间
2014-4-14
帖子
151
2
发表于 2016-10-4 07:25:40 | 只看该作者
参考这个对你有帮助吗?战斗换人脚本 加 角色不参战也能获得经验。
RUBY 代码复制
  1. module LimBattlePlug
  2.  
  3. # 队伍最大人数
  4. MaxPartySize = 8
  5.  
  6. # 出战人数
  7. MaxBattlerSize = 1
  8.  
  9. # 换人语句
  10. WordChangeBattler = "换人"
  11.  
  12. # 换人时播放的动画
  13. AnimationChangeBattler = 0
  14.  
  15. end
  16.  
  17. class Game_BattleAction
  18.   attr_accessor :change_to_battler
  19.   # 初始化
  20.   alias lbp_initialize initialize
  21.   def initialize
  22.     lbp_initialize
  23.     @change_to_battler = 0
  24.   end
  25.   # 欲更换角色编号
  26.   def set_change_battler
  27.     @kind = 3
  28.   end
  29.   # 判断行动是否为更换角色
  30.   def is_change_battler?
  31.     return (@kind == 3)
  32.   end
  33. end
  34.  
  35. class Game_Party
  36.   include LimBattlePlug
  37.   attr_reader :actors2
  38.   alias lpb_initialize initialize
  39.   def initialize
  40.     lpb_initialize
  41.     @actors2 = []
  42.   end
  43.   # 角色加入
  44.   def add_actor(actor_id)
  45.     actor = $game_actors[actor_id]
  46.     if @actors.size < MaxPartySize and not @actors.include?(actor)
  47.       @actors.push(actor)
  48.       $game_player.refresh
  49.     end
  50.   end
  51.   # 设置战斗的角色
  52.   def set_actor_to_battle
  53.     @actors2 = []
  54.     @actors.each do |actor|
  55.       @actors2.push(actor)
  56.     end
  57.     @actors = []
  58.     @actors2.each do |actor|
  59.       @actors.push(actor)
  60.       break if @actors.size == MaxBattlerSize
  61.     end
  62.   end
  63.   # 还原战斗的角色
  64.   def set_actor_to_normal
  65.     @actors = []
  66.     @actors2.each do |actor|
  67.       @actors.push(actor)
  68.     end
  69.   end
  70.   # 获取角色id数组
  71.   def get_actors_id
  72.     id = []
  73.     @actors.each{|actor|id.push(actor.id)}
  74.     return id
  75.   end
  76.   # 获取角色id数组
  77.   def get_actors2_id
  78.     id = []
  79.     @actors2.each{|actor|id.push(actor.id)}
  80.     return id
  81.   end
  82.   # 兑换角色
  83.   def change_actor(index,id)
  84.     @actors[index] = $game_actors[id]
  85.   end
  86.   # 全灭判定
  87.   def all_dead?
  88.     # 同伴人数为 0 的情况下
  89.     if $game_party.actors.size == 0
  90.       return false
  91.     end
  92.     # 同伴中无人 HP 在 0 以上
  93.     for actor in @actors2
  94.       if actor.hp > 0
  95.         return false
  96.       end
  97.     end
  98.     for actor in @actors
  99.       if actor.hp > 0
  100.         return false
  101.       end
  102.     end
  103.     # 全灭
  104.     return true
  105.   end
  106.   # 其他角色
  107.   def other_actors
  108.     actors = []
  109.     @actors2.each{|actor|actors.push(actor) if !@actors.include?(actor)}
  110.     return actors
  111.   end
  112.   # 角色位置互换
  113.   def change_actor_pos(id1,id2)
  114.     actor_id = []
  115.     @actors.each do |actor|
  116.       actor_id.push(actor.id)
  117.     end
  118.     return if !actor_id.include?(id1) and !actor_id.include?(id2)
  119.     id1_index = id2_index = -1
  120.     (0...actor_id.size).each do |i|
  121.       if actor_id[i] == id1
  122.         id1_index = i
  123.       elsif actor_id[i] == id2
  124.         id2_index = i
  125.       end
  126.     end
  127.     temp_actor = @actors[id1_index]
  128.     @actors[id1_index] = @actors[id2_index]
  129.     @actors[id2_index] = temp_actor
  130.   end
  131. end
  132.  
  133. class Window_Actor < Window_Selectable
  134.   # 初始化
  135.   def initialize
  136.     super(0,64,640,256)
  137.     self.back_opacity = 160
  138.     refresh
  139.     self.index = -1
  140.     self.active = false
  141.   end
  142.   # 刷新
  143.   def refresh
  144.     @item_max = $game_party.actors2.size
  145.     [url=home.php?mod=space&uid=2653549]@data[/url] = []
  146.     $game_party.actors.each do |actor|
  147.       @data.push(actor)
  148.     end
  149.     $game_party.actors2.each do |actor|
  150.       @data.push(actor) if !@data.include?(actor)
  151.     end
  152.     if self.contents != nil
  153.       self.contents.clear
  154.       self.contents = nil
  155.     end
  156.     self.contents = Bitmap.new(608,@data.size*32)
  157.     x = 4
  158.     y = 0
  159.   @data.each do |actor|
  160.       bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)
  161.       rect = Rect.new(0,0,bitmap.width/4,31)
  162.       self.contents.blt(x+16-bitmap.width/8,y,bitmap,rect)
  163.       draw_actor_name(actor,x+36,y)
  164.       draw_actor_state(actor,156,y)
  165.       draw_actor_hp(actor,x+256,y,96)
  166.       draw_actor_sp(actor,x+376,y,96)
  167.       if $game_party.actors.include?(actor)
  168.         self.contents.font.color = text_color(6)
  169.         cword = "出战"
  170.       else
  171.         self.contents.font.color = text_color(0)
  172.         cword = "待战"
  173.       end
  174.       self.contents.draw_text(x+496,y,60,32,cword)
  175.       y += 32
  176.     end
  177.   end
  178.   # 获取当前角色编号
  179.   def actor_id
  180.     return @data[self.index].id
  181.   end
  182.   # 刷新帮助
  183.   def update_help
  184.     @help_window.set_text(@data[self.index] == nil ?\
  185.                           "" : @data[self.index].name)
  186.   end
  187. end
  188.  
  189. class Scene_Battle
  190.   include LimBattlePlug
  191.   # 初始化
  192.   def initialize
  193.     $game_party.set_actor_to_battle
  194.   end
  195.   # 主处理
  196.   def main
  197.     # 初始化战斗用的各种暂时数据
  198.     $game_temp.in_battle = true
  199.     $game_temp.battle_turn = 0
  200.     $game_temp.battle_event_flags.clear
  201.     $game_temp.battle_abort = false
  202.     $game_temp.battle_main_phase = false
  203.     $game_temp.battleback_name = $game_map.battleback_name
  204.     $game_temp.forcing_battler = nil
  205.     # 初始化战斗用事件解释器
  206.     $game_system.battle_interpreter.setup(nil, 0)
  207.     # 准备队伍
  208.     @troop_id = $game_temp.battle_troop_id
  209.     $game_troop.setup(@troop_id)
  210.     # 生成角色命令窗口
  211.     s1 = $data_system.words.attack
  212.     s2 = $data_system.words.skill
  213.     s3 = $data_system.words.guard
  214.     s4 = $data_system.words.item
  215.     s5 = WordChangeBattler
  216.     @actor_command_window = Window_Command.new(85, [s1, s2, s3, s4,s5])
  217.     @actor_command_window.y = 128
  218.     @actor_command_window.back_opacity = 160
  219.     @actor_command_window.active = false
  220.     @actor_command_window.visible = false
  221.     # 生成其它窗口
  222.     @party_command_window = Window_PartyCommand.new
  223.     @help_window = Window_Help.new
  224.     @help_window.back_opacity = 160
  225.     @help_window.visible = false
  226.     @status_window = Window_BattleStatus.new
  227.     @message_window = Window_Message.new
  228.     # 生成活动块
  229.     @spriteset = Spriteset_Battle.new
  230.     # 初始化等待计数
  231.     @wait_count = 0
  232.     # 执行过渡
  233.     if $data_system.battle_transition == ""
  234.       Graphics.transition(20)
  235.     else
  236.       Graphics.transition(40, "Graphics/Transitions/" +
  237.         $data_system.battle_transition)
  238.     end
  239.     # 开始自由战斗回合
  240.     start_phase1
  241.     # 主循环
  242.     loop do
  243.       # 刷新游戏画面
  244.       Graphics.update
  245.       # 刷新输入信息
  246.       Input.update
  247.       # 刷新画面
  248.       update
  249.       # 如果画面切换的话就中断循环
  250.       if $scene != self
  251.         break
  252.       end
  253.     end
  254.     # 刷新地图
  255.     $game_map.refresh
  256.     # 准备过渡
  257.     Graphics.freeze
  258.     # 释放窗口
  259.     @actor_command_window.dispose
  260.     @party_command_window.dispose
  261.     @help_window.dispose
  262.     @status_window.dispose
  263.     @message_window.dispose
  264.     if @skill_window != nil
  265.       @skill_window.dispose
  266.     end
  267.     if @item_window != nil
  268.       @item_window.dispose
  269.     end
  270.     if @actor_window != nil
  271.       @actor_window.dispose
  272.     end
  273.     if @result_window != nil
  274.       @result_window.dispose
  275.     end
  276.     # 释放活动块
  277.     @spriteset.dispose
  278.     # 标题画面切换中的情况
  279.     if $scene.is_a?(Scene_Title)
  280.       # 淡入淡出画面
  281.       Graphics.transition
  282.       Graphics.freeze
  283.     end
  284.     # 战斗测试或者游戏结束以外的画面切换中的情况
  285.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  286.       $scene = nil
  287.     end
  288.   end
  289.   # 战斗结束
  290.   alias lpb_battle_end battle_end
  291.   def battle_end(n)
  292.     lpb_battle_end(n)
  293.     $game_party.set_actor_to_normal
  294.   end
  295.   # 开始回合3
  296.   alias lbp_start_phase3 start_phase3
  297.   def start_phase3
  298.     @changed_battler_id = []
  299.     lbp_start_phase3
  300.   end
  301.   # 刷新角色命令回合画面
  302.   def update_phase3
  303.     # 敌人光标有效的情况下
  304.     if @enemy_arrow != nil
  305.       update_phase3_enemy_select
  306.     # 角色光标有效的情况下
  307.     elsif @actor_arrow != nil
  308.       update_phase3_actor_select
  309.     # 特技窗口有效的情况下
  310.     elsif @skill_window != nil
  311.       update_phase3_skill_select
  312.     # 物品窗口有效的情况下
  313.     elsif @item_window != nil
  314.       update_phase3_item_select
  315.     elsif @actor_window != nil
  316.       update_phase3_battler_select
  317.     # 角色指令窗口有效的情况下
  318.     elsif @actor_command_window.active
  319.       update_phase3_basic_command
  320.     end
  321.   end
  322.   # 角色基本命令
  323.   def update_phase3_basic_command
  324.     # 按下 B 键的情况下
  325.     if Input.trigger?(Input::B)
  326.       # 演奏取消 SE
  327.       $game_system.se_play($data_system.cancel_se)
  328.       # 转向前一个角色的指令输入
  329.       phase3_prior_actor
  330.       return
  331.     end
  332.     # 按下 C 键的情况下
  333.     if Input.trigger?(Input::C)
  334.       # 角色指令窗口光标位置分之
  335.       case @actor_command_window.index
  336.       when 0  # 攻击
  337.         # 演奏确定 SE
  338.         $game_system.se_play($data_system.decision_se)
  339.         # 设置行动
  340.         @active_battler.current_action.kind = 0
  341.         @active_battler.current_action.basic = 0
  342.         # 开始选择敌人
  343.         start_enemy_select
  344.       when 1  # 特技
  345.         # 演奏确定 SE
  346.         $game_system.se_play($data_system.decision_se)
  347.         # 设置行动
  348.         @active_battler.current_action.kind = 1
  349.         # 开始选择特技
  350.         start_skill_select
  351.       when 2  # 防御
  352.         # 演奏确定 SE
  353.         $game_system.se_play($data_system.decision_se)
  354.         # 设置行动
  355.         @active_battler.current_action.kind = 0
  356.         @active_battler.current_action.basic = 1
  357.         # 转向下一位角色的指令输入
  358.         phase3_next_actor
  359.       when 3  # 物品
  360.         # 演奏确定 SE
  361.         $game_system.se_play($data_system.decision_se)
  362.         # 设置行动
  363.         @active_battler.current_action.kind = 2
  364.         # 开始选择物品
  365.         start_item_select
  366.       when 4 # 换人
  367.         $game_system.se_play($data_system.decision_se)
  368.         @active_battler.current_action.set_change_battler
  369.         start_battler_select
  370.       end
  371.       return
  372.     end
  373.   end
  374.   # 开始角色选择
  375.   def start_battler_select
  376.     @actor_window = Window_Actor.new
  377.     @actor_window.active = true
  378.     @actor_window.index = 0
  379.     @actor_window.help_window = @help_window
  380.     @actor_command_window.active = false
  381.     @actor_command_window.visible = false
  382.   end
  383.   # 结束角色选择
  384.   def end_battler_select
  385.     @actor_window.dispose
  386.     @actor_window = nil
  387.     @help_window.visible = false
  388.     @actor_command_window.active = true
  389.     @actor_command_window.visible = true
  390.   end
  391.   # 刷新角色选择
  392.   def update_phase3_battler_select
  393.     @actor_window.visible = true
  394.     @actor_window.update
  395.     if Input.trigger?(Input::B)
  396.       $game_system.se_play($data_system.cancel_se)
  397.       end_battler_select
  398.       return
  399.     end
  400.     if Input.trigger?(Input::C)
  401.       actor_id = @actor_window.actor_id
  402.       if $game_party.get_actors_id.include?(actor_id) or
  403.          $game_actors[actor_id].dead? or
  404.          @changed_battler_id.include?(actor_id)
  405.         $game_system.se_play($data_system.buzzer_se)
  406.         return
  407.       end
  408.       $game_system.se_play($data_system.decision_se)
  409.       @active_battler.current_action.change_to_battler = actor_id
  410.       @changed_battler_id.push(actor_id)
  411.       end_battler_select
  412.       phase3_next_actor
  413.       return
  414.     end
  415.   end
  416.   # 行动方动画
  417.   def update_phase4_step3
  418.     if @active_battler.current_action.is_change_battler?
  419.       @animation1_id = AnimationChangeBattler
  420.       @target_battlers = []
  421.     end
  422.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  423.     if @animation1_id == 0
  424.       @active_battler.white_flash = true
  425.     else
  426.       @active_battler.animation_id = @animation1_id
  427.       @active_battler.animation_hit = true
  428.     end
  429.     # 移至步骤 4
  430.     @phase4_step = 4
  431.   end
  432.   # 对象方动画
  433.   def update_phase4_step4
  434.     if @active_battler.current_action.is_change_battler?
  435.       actor1_id = @active_battler.current_action.change_to_battler
  436.       actor2_id = @active_battler.id
  437.       (0...$game_party.actors.size).each do |i|
  438.         if $game_party.actors[i].id == actor2_id
  439.           $game_party.change_actor(i,actor1_id)
  440.           @active_battler = $game_actors[actor1_id]
  441.           @status_window.refresh
  442.         end
  443.       end
  444.     end
  445.     # 对像方动画
  446.     for target in @target_battlers
  447.       target.animation_id = @animation2_id
  448.       target.animation_hit = (target.damage != "Miss")
  449.     end
  450.     # 限制动画长度、最低 8 帧
  451.     @wait_count = 8
  452.     # 移至步骤 5
  453.     @phase4_step = 5
  454.   end
  455.   # 公共事件
  456.   def update_phase4_step6
  457.     @target_battlers.each do |target|
  458.       if target.is_a?(Game_Actor) and target.dead? and
  459.          !$game_party.other_actors.all?{|actor|actor.dead?}
  460.         @actor_window = Window_Actor.new
  461.         @actor_window.index = 0
  462.         @actor_window.active = true
  463.         @actor_window.help_window = @help_window
  464.         actor_id = -1
  465.         loop do
  466.           Graphics.update
  467.           Input.update
  468.           @actor_window.update
  469.           if Input.trigger?(Input::C)
  470.             actor = $game_actors[@actor_window.actor_id]
  471.             if actor.dead? or
  472.                (@changed_battler_id.include?(actor.id) and
  473.                 target.current_action.change_to_battler != actor.id) or
  474.                $game_party.actors.include?(actor)
  475.               $game_system.se_play($data_system.buzzer_se)
  476.             else
  477.               actor_id = actor.id
  478.             end
  479.           end
  480.           break if actor_id >= 0
  481.         end
  482.         @actor_window.visible = false
  483.         @actor_window.dispose
  484.         @actor_window = nil
  485.         @help_window.visible = false
  486.         (0...$game_party.actors.size).each do |i|
  487.           if $game_party.actors[i].id == target.id
  488.             $game_party.change_actor(i,actor_id)
  489.             @status_window.refresh
  490.           end
  491.         end
  492.       end
  493.     end
  494.     # 清除强制行动对像的战斗者
  495.     $game_temp.forcing_battler = nil
  496.     # 公共事件 ID 有效的情况下
  497.     if @common_event_id > 0
  498.       # 设置事件
  499.       common_event = $data_common_events[@common_event_id]
  500.       $game_system.battle_interpreter.setup(common_event.list, 0)
  501.     end
  502.     # 移至步骤 1
  503.     @phase4_step = 1
  504.   end
  505.   end

点评

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

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1358
在线时间
1295 小时
注册时间
2012-8-4
帖子
749
3
发表于 2016-10-4 10:29:44 | 只看该作者
加到仓库脚本后

点评

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
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-22 04:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表