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

Project1

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

[已经解决] 对于“角色仓库脚本”和“战斗头像”脚本的整合

[复制链接]

Lv1.梦旅人

梦石
0
星屑
94
在线时间
157 小时
注册时间
2006-7-2
帖子
299
跳转到指定楼层
1
发表于 2015-9-12 09:16:52 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

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

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

x
本帖最后由 RyanBern 于 2015-9-12 09:22 编辑

不好意思连着两天请教各位,谢谢“英顺的马甲 ”帮忙解决了 角色仓库  和自动战斗脚本的冲突!
但是使用下来发现,“角色仓库脚本”和“战斗头像”脚本还有另一个冲突

“角色仓库脚本”中好像有显示战斗角色的功能,但是用的是系统原有的图片。
“战斗头像”是新建一个文件夹把需要的图片放进去。(更想用这一种)

因此两个脚本同时使用的时候,就发生了  战斗中虽然人物换了,但是头像没换的尴尬场面。





此外,由于还用了“角色跟随”的脚本,“角色仓库”脚本中更换领队后就出现了同时有两个人存在的情况





现在有两个美好的愿望。。。


1. 实现战斗中的角色更换和头像更换同步。。。。。
2.删除“角色仓库”脚本中 领队 的功能。。。


厚颜无耻地等待大神们解救。。。


角色仓库脚本

RUBY 代码复制
  1. #=============================================================================
  2. # 队伍系统 Ver 2.0
  3. #-----------------------------------------------------------------------------
  4. # 类似于 Aveyond 的队伍系统(根据阿月系列的游戏产生的灵感)
  5. # By :RyanBern
  6. #-----------------------------------------------------------------------------
  7. # 功能特色:
  8. #-----------------------------------------------------------------------------
  9. # 1.更改队伍中成员的最大数量,有四名出战队员,但是替补队员可以有很多个。
  10. # 2.对 Game_Party 的队员设置和 Scene_Battle 的部分方法有较大改动,可能造成脚本
  11. #   冲突。
  12. # 3.为队伍增加“领队”角色,作为“领队”的成员在地图上显示他的图形。
  13. # 4.在战斗命令中增添“换人”命令,可以将替补队员换上场。
  14. # 5.如果队伍的出战队员全部阵亡,则直接判定玩家全灭,不管有无替补队员。但是如果
  15. #   在地图上,则是所有队员阵亡才会被判定全灭。
  16. # 6.事件编译器中,对全体同伴的处理均包括对替补队员的处理。
  17. #-----------------------------------------------------------------------------
  18. # 使用方法:
  19. #-----------------------------------------------------------------------------
  20. # 1.粘贴到默认脚本后面,Main组前面即可。
  21. # 2.在菜单中,左侧窗口被激活时,按 A 键可以改变领队(leader)的设置,按 S 键
  22. #   可以改变出战的队员。 (要按空格来切换)
  23. # 3.为队员设置“无法出战”的状态,即该队员不能被设置为出战队员。具体方法是
  24. #   使用事件脚本,例如,让 1 号角色无法出战:
  25. #   $game_actors[1].battle_disabled = true
  26. #   让 1 号角色恢复可以出战的状态:
  27. #   $game_actors[1].battle_disabled = false
  28. #   ###
  29. # 4.可在下方设置替补队员在战斗胜利之后是否获得 EXP 奖励。
  30. #=============================================================================
  31.  
  32.  
  33. module RB
  34. end
  35.  
  36. module RB::Party
  37.   # “换人”命令的术语
  38.   Words_Swap = "换人"
  39.  
  40.   # 替补队员是否能在战斗胜利后获得 EXP 奖励,设置为 true 时可以获得奖励,设置
  41.   # 为 false 时则不能。
  42.   Get_Exp_Reserve = true
  43. end
  44.  
  45. class Game_Temp
  46.   attr_accessor :gain_exp_flag
  47. end
  48.  
  49. class Game_Party
  50.   attr_reader :leader
  51.   attr_reader :battle_actors
  52.   alias old_ini initialize
  53.   def initialize
  54.     @leader = nil
  55.     @battle_actors = []
  56.     old_ini
  57.   end
  58.   def leader=(leader)
  59.     @leader = leader
  60.     $game_player.refresh
  61.     $game_map.need_refresh = true
  62.   end
  63.   def set_leader(actor_id)
  64.     self.leader = $game_actors[actor_id]
  65.   end
  66.   def actors
  67.     all_flag = !$game_temp.in_battle || (RB::Party::Get_Exp_Reserve && $game_temp.gain_exp_flag)
  68.     return all_flag ? @actors : @battle_actors
  69.   end
  70.   def all_actors
  71.     return @actors
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 加入同伴
  75.   #     actor_id : 角色 ID
  76.   #--------------------------------------------------------------------------
  77.   def add_actor(actor_id)
  78.     # 获取角色
  79.     actor = $game_actors[actor_id]
  80.     # 同伴人数未满 4 人、本角色不在队伍中的情况下
  81.     unless @actors.include?(actor)
  82.       # 添加角色
  83.       @actors.push(actor)
  84.       @battle_actors.push(actor) if @battle_actors.size < 4
  85.       self.leader = actor if self.leader.nil?
  86.       # 还原主角
  87.       $game_player.refresh
  88.     end
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ● 角色离开
  92.   #     actor_id : 角色 ID
  93.   #--------------------------------------------------------------------------
  94.   def remove_actor(actor_id)
  95.     actor = $game_actors[actor_id]
  96.     # 删除角色
  97.     @actors.delete(actor)
  98.     @battle_actors.delete(actor)
  99.     self.leader = self.actors[0] if self.leader == actor
  100.     # 还原主角
  101.     $game_player.refresh
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● 设置初期同伴
  105.   #--------------------------------------------------------------------------
  106.   def setup_starting_members
  107.     @actors = []
  108.     @battle_actors = []
  109.     for i in $data_system.party_members
  110.       @actors.push($game_actors[i])
  111.       @battle_actors.push($game_actors[i]) if @battle_actors.size < 4
  112.     end
  113.     self.leader = @actors[0]
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 设置战斗测试用同伴
  117.   #--------------------------------------------------------------------------
  118.   def setup_battle_test_members
  119.     @actors = []
  120.     @battle_actors = []
  121.     for battler in $data_system.test_battlers
  122.       actor = $game_actors[battler.actor_id]
  123.       actor.level = battler.level
  124.       gain_weapon(battler.weapon_id, 1)
  125.       gain_armor(battler.armor1_id, 1)
  126.       gain_armor(battler.armor2_id, 1)
  127.       gain_armor(battler.armor3_id, 1)
  128.       gain_armor(battler.armor4_id, 1)
  129.       actor.equip(0, battler.weapon_id)
  130.       actor.equip(1, battler.armor1_id)
  131.       actor.equip(2, battler.armor2_id)
  132.       actor.equip(3, battler.armor3_id)
  133.       actor.equip(4, battler.armor4_id)
  134.       actor.recover_all
  135.       @actors.push(actor)
  136.       @battle_actors.push(actor)
  137.     end
  138.     @items = {}
  139.     for i in 1...$data_items.size
  140.       if $data_items[i].name != ""
  141.         occasion = $data_items[i].occasion
  142.         if occasion == 0 or occasion == 1
  143.           @items[i] = 99
  144.         end
  145.       end
  146.     end
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 同伴成员的还原
  150.   #--------------------------------------------------------------------------
  151.   def refresh
  152.     # 游戏数据载入后角色对像直接从 $game_actors
  153.     # 分离。
  154.     # 回避由于载入造成的角色再设置的问题。
  155.     new_actors = []
  156.     new_battle_actors = []
  157.     @actors.each do |actor|
  158.       if $data_actors[actor.id] != nil
  159.         new_actors.push($game_actors[actor.id])
  160.       end
  161.     end
  162.     @battle_actors.each do |actor|
  163.       if $data_actors[actor.id] != nil
  164.         new_battle_actors.push($game_actors[actor.id])
  165.       end
  166.     end
  167.     @actors = new_actors
  168.     @battle_actors = new_battle_actors
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● 全灭判定
  172.   #--------------------------------------------------------------------------
  173.   def all_dead?
  174.     # 同伴人数为 0 的情况下
  175.     if self.actors.size == 0
  176.       return false
  177.     end
  178.     # 同伴中无人 HP 在 0 以上
  179.     for actor in self.actors
  180.       if actor.hp > 0
  181.         return false
  182.       end
  183.     end
  184.     # 全灭
  185.     return true
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ● 对像角色的随机确定
  189.   #     hp0 : 限制为 HP 0 的角色
  190.   #--------------------------------------------------------------------------
  191.   def random_target_actor(hp0 = false)
  192.     # 初始化轮流
  193.     roulette = []
  194.     # 循环
  195.     for actor in @battle_actors
  196.       # 符合条件的场合
  197.       if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
  198.         # 获取角色职业的位置 [位置]
  199.         position = $data_classes[actor.class_id].position
  200.         # 前卫的话 n = 4、中卫的话 n = 3、后卫的话 n = 2
  201.         n = 4 - position
  202.         # 添加角色的轮流 n 回
  203.         n.times do
  204.           roulette.push(actor)
  205.         end
  206.       end
  207.     end
  208.     # 轮流大小为 0 的情况
  209.     if roulette.size == 0
  210.       return nil
  211.     end
  212.     # 转轮盘赌,决定角色
  213.     return roulette[rand(roulette.size)]
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● 对像角色的顺序确定
  217.   #     actor_index : 角色索引
  218.   #--------------------------------------------------------------------------
  219.   def smooth_target_actor(actor_index)
  220.     # 取得对像
  221.     actor = @battle_actors[actor_index]
  222.     # 对像存在的情况下
  223.     if actor != nil and actor.exist?
  224.       return actor
  225.     end
  226.     # 循环
  227.     for actor in @actors
  228.       # 对像存在的情况下
  229.       if actor.exist?
  230.         return actor
  231.       end
  232.     end
  233.   end
  234.  
  235. end
  236.  
  237. class Game_Actor
  238.   attr_reader :battle_disabled
  239.   def leader?
  240.     return self == $game_party.leader
  241.   end
  242.   def active
  243.     return $game_party.battle_actors.include?(self)
  244.   end
  245.   def battle_disabled=(bool)
  246.     @battle_disabled = bool
  247.     $game_party.battle_actors.delete(self) if bool
  248.   end
  249. end
  250.  
  251. class Game_Player
  252.   #--------------------------------------------------------------------------
  253.   # ● 刷新
  254.   #--------------------------------------------------------------------------
  255.   def refresh
  256.     # 同伴人数为 0 的情况下
  257.     if $game_party.actors.size == 0 or $game_party.leader == nil
  258.       # 清除角色的文件名及对像
  259.       @character_name = ""
  260.       @character_hue = 0
  261.       # 分支结束
  262.       return
  263.     end
  264.     # 获取带头的角色
  265.     if $game_party.leader != nil
  266.       actor = $game_party.leader
  267.       # 设置角色的文件名及对像
  268.       @character_name = actor.character_name
  269.       @character_hue = actor.character_hue
  270.       # 初始化不透明度和合成方式子
  271.       @opacity = 255
  272.       @blend_type = 0
  273.     end
  274.   end
  275. end
  276.  
  277. class Game_BattleAction
  278.   attr_accessor :reserved_actor_id
  279.   unless method_defined? :rb_clear_20150422
  280.     alias rb_clear_20150422 clear
  281.     def clear
  282.       rb_clear_20150422
  283.       @reserved_actor_id = 0
  284.     end
  285.   end
  286. end
  287.  
  288. class Window_Base < Window
  289.   def draw_actor_battle_position(actor, x, y)
  290.     if actor.leader?
  291.       if actor.active
  292.         text = "领队|出战"
  293.       else
  294.         text = "领队"
  295.       end
  296.       color = knockout_color
  297.     else
  298.       color = disabled_color
  299.       if actor.battle_disabled
  300.         text = "无法出战"
  301.       elsif actor.active
  302.         text = "出战"
  303.         color = normal_color
  304.       else
  305.         text = "待机"
  306.       end
  307.     end
  308.     self.contents.font.color = color
  309.     self.contents.draw_text(x, y, 120, 32, text)
  310.   end
  311. end
  312.  
  313. #==============================================================================
  314. # ■ Window_Selectable
  315. #------------------------------------------------------------------------------
  316. #  拥有光标的移动以及滚动功能的窗口类。
  317. #==============================================================================
  318.  
  319. class Window_Selectable < Window_Base
  320.   #--------------------------------------------------------------------------
  321.   # ● 定义实例变量
  322.   #--------------------------------------------------------------------------
  323.   attr_accessor :row_height               # 行高
  324.   #--------------------------------------------------------------------------
  325.   # ● 初始画对像
  326.   #     x      : 窗口的 X 坐标
  327.   #     y      : 窗口的 Y 坐标
  328.   #     width  : 窗口的宽
  329.   #     height : 窗口的高
  330.   #     row_height : 行高 默认是32
  331.   #--------------------------------------------------------------------------
  332.   alias rb_initialize_20150421 initialize
  333.   def initialize(x, y, width, height, row_height = 32)
  334.     @row_height = row_height
  335.     rb_initialize_20150421(x, y, width, height)
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● 获取开头行
  339.   #--------------------------------------------------------------------------
  340.   def top_row
  341.     # 将窗口内容的传送源 Y 坐标、1 行的高 @row_height 等分
  342.     return self.oy / @row_height
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 设置开头行
  346.   #     row : 显示开头的行
  347.   #--------------------------------------------------------------------------
  348.   def top_row=(row)
  349.     # row 未满 0 的场合更正为 0
  350.     if row < 0
  351.       row = 0
  352.     end
  353.     # row 超过 row_max - 1 的情况下更正为 row_max - 1
  354.     if row > row_max - 1
  355.       row = row_max - 1
  356.     end
  357.     # row 1 行高的 @row_height 倍、窗口内容的传送源 Y 坐标
  358.     self.oy = row * @row_height
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● 获取 1 页可以显示的行数
  362.   #--------------------------------------------------------------------------
  363.   def page_row_max
  364.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 @row_height
  365.     return (self.height - 32) / @row_height
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ● 更新光标举行
  369.   #--------------------------------------------------------------------------
  370.   def update_cursor_rect
  371.     # 光标位置不满 0 的情况下
  372.     if @index < 0
  373.       self.cursor_rect.empty
  374.       return
  375.     end
  376.     # 获取当前的行
  377.     row = @index / @column_max
  378.     # 当前行被显示开头行前面的情况下
  379.     if row < self.top_row
  380.       # 从当前行向开头行滚动
  381.       self.top_row = row
  382.     end
  383.     # 当前行被显示末尾行之后的情况下
  384.     if row > self.top_row + (self.page_row_max - 1)
  385.       # 从当前行向末尾滚动
  386.       self.top_row = row - (self.page_row_max - 1)
  387.     end
  388.     # 计算光标的宽
  389.     cursor_width = self.width / @column_max - 32
  390.     # 计算光标坐标
  391.     x = @index % @column_max * (cursor_width + 32)
  392.     y = @index / @column_max * @row_height - self.oy
  393.     # 更新国标矩形
  394.     self.cursor_rect.set(x, y, cursor_width, @row_height)
  395.   end
  396. end
  397.  
  398. class Window_MenuStatus
  399.   def initialize
  400.     super(0, 0, 480, 480, 112)
  401.     refresh
  402.     self.active = false
  403.     self.index = -1
  404.   end
  405.   def refresh
  406.     if self.contents != nil
  407.       self.contents.dispose
  408.       self.contents = nil
  409.     end
  410.     @item_max = $game_party.actors.size
  411.     self.contents = Bitmap.new(width - 32, @item_max == 0 ? 32 : @item_max * 112)
  412.     for i in 0...$game_party.actors.size
  413.       x = 64
  414.       y = i * 112
  415.       actor = $game_party.actors[i]
  416.       draw_actor_graphic(actor, x - 40, y + 80)
  417.       draw_actor_name(actor, x, y)
  418.       draw_actor_class(actor, x + 144, y)
  419.       draw_actor_level(actor, x, y + 32)
  420.       draw_actor_state(actor, x + 90, y + 32)
  421.       draw_actor_exp(actor, x, y + 64)
  422.       draw_actor_hp(actor, x + 236, y + 32)
  423.       draw_actor_sp(actor, x + 236, y + 64)
  424.       draw_actor_battle_position(actor, x + 236, y)
  425.     end
  426.   end
  427.   def update_cursor_rect
  428.     super
  429.   end
  430. end
  431.  
  432. class Window_Target
  433.   def initialize
  434.     super(0, 0, 336, 480, 112)
  435.     self.z += 10
  436.     @item_max = $game_party.actors.size
  437.     self.contents = Bitmap.new(width - 32, @item_max == 0 ? 32 : @item_max * 112)
  438.     refresh
  439.   end
  440.   def update_cursor_rect
  441.     super
  442.   end
  443. end
  444.  
  445. class Window_ReservedActors < Window_Selectable
  446.   def initialize
  447.     super(0, 64, 640, 256, 112)
  448.     self.opacity = 160
  449.     self.index = 0
  450.     self.active = true
  451.     @column_max = 2
  452.     refresh
  453.   end
  454.   def actor
  455.     return @data[self.index]
  456.   end
  457.   def refresh
  458.     if self.contents != nil
  459.       self.contents.dispose
  460.       self.contents = nil
  461.     end
  462.     @data = []
  463.     $game_party.all_actors.each do |actor|
  464.       @data << actor unless actor.active || actor.battle_disabled
  465.     end
  466.     @item_max = @data.size
  467.     if @item_max > 0
  468.       self.contents = Bitmap.new (width - 32, (@item_max + 1) / 2 * 128)
  469.       @data.each_with_index do |actor, index|
  470.         x = 4 + index % 2 * (288 + 32)
  471.         y = index / 2 * 112
  472.         draw_actor_graphic(actor, x + 16, y + 80)
  473.         draw_actor_hp(actor, x + 48, y + 20)
  474.         draw_actor_sp(actor, x + 48, y + 52)
  475.       end
  476.     end
  477.   end
  478.   def update_help
  479.     # 帮助窗口显示角色的状态
  480.     self.actor == nil ? @help_window.set_text("") : @help_window.set_actor(self.actor)
  481.   end
  482. end
  483.  
  484. class Scene_Menu
  485.   unless method_defined? :rb_update_command_20150421
  486.     alias rb_update_command_20150421 update_command
  487.     def update_command
  488.       if Input.trigger?(Input::X)
  489.         $game_system.se_play($data_system.decision_se)
  490.         @command_window.active = false
  491.         @status_window.active = true
  492.         @status_window.index = 0
  493.         @leader_adjust = true
  494.         return
  495.       end
  496.       if Input.trigger?(Input::Y)
  497.         $game_system.se_play($data_system.decision_se)
  498.         @command_window.active = false
  499.         @status_window.active = true
  500.         @status_window.index = 0
  501.         @battler_adjust = true
  502.         return
  503.       end
  504.       rb_update_command_20150421
  505.     end
  506.   end
  507.   unless method_defined? :rb_update_status_20150421
  508.     alias rb_update_status_20150421 update_status
  509.     def update_status
  510.       if @leader_adjust
  511.         update_leader
  512.         return
  513.       end
  514.       if @battler_adjust
  515.         update_battler
  516.         return
  517.       end
  518.       rb_update_status_20150421
  519.     end
  520.   end
  521.   def update_leader
  522.     if Input.trigger?(Input::B)
  523.       $game_system.se_play($data_system.cancel_se)
  524.       @leader_adjust = false
  525.       @status_window.active = false
  526.       @status_window.index = -1
  527.       @command_window.active = true
  528.       return
  529.     end
  530.     if Input.trigger?(Input::C)
  531.       if $game_party.actors.size == 0
  532.         $game_system.se_play($data_system.buzzer_se)
  533.       else
  534.         $game_system.se_play($data_system.decision_se)
  535.         $game_party.leader = $game_party.actors[@status_window.index]
  536.         @status_window.refresh
  537.       end
  538.     end
  539.   end
  540.   def update_battler
  541.     if Input.trigger?(Input::B)
  542.       $game_system.se_play($data_system.cancel_se)
  543.       @battler_adjust = false
  544.       @status_window.active = false
  545.       @status_window.index = -1
  546.       @command_window.active = true
  547.       return
  548.     end
  549.     if Input.trigger?(Input::C)
  550.       actor = $game_party.actors[@status_window.index]
  551.       if actor == nil || actor.battle_disabled ||
  552.         (actor.active && $game_party.battle_actors.size == 1) ||
  553.         (!actor.active && $game_party.battle_actors.size == 4)
  554.         $game_system.se_play($data_system.buzzer_se)
  555.       else
  556.         $game_system.se_play($data_system.decision_se)
  557.         actor.active ? $game_party.battle_actors.delete(actor) : $game_party.battle_actors.push(actor)
  558.         @status_window.refresh
  559.       end
  560.     end
  561.   end
  562. end
  563.  
  564. class Scene_Battle
  565.   def generate_modified_command_window
  566.     if @actor_command_window != nil
  567.       @actor_command_window.dispose
  568.       @actor_command_window = nil
  569.     end
  570.     s1 = $data_system.words.attack
  571.     s2 = $data_system.words.skill
  572.     s3 = $data_system.words.guard
  573.     s4 = $data_system.words.item
  574.     s5 = RB::Party::Words_Swap
  575.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
  576.     @actor_command_window.y = 128
  577.     @actor_command_window.back_opacity = 160
  578.     @actor_command_window.active = false
  579.     @actor_command_window.visible = false
  580.     @modified_generated = true
  581.   end
  582.   unless method_defined? :rb_phase3_setup_command_window_20150422
  583.     alias rb_phase3_setup_command_window_20150422 phase3_setup_command_window
  584.     def phase3_setup_command_window
  585.       generate_modified_command_window unless @modified_generated
  586.       rb_phase3_setup_command_window_20150422
  587.     end
  588.   end
  589.   def update_phase3_basic_command
  590.     # 按下 B 键的情况下
  591.     if Input.trigger?(Input::B)
  592.       # 演奏取消 SE
  593.       $game_system.se_play($data_system.cancel_se)
  594.       # 转向前一个角色的指令输入
  595.       phase3_prior_actor
  596.       return
  597.     end
  598.     # 按下 C 键的情况下
  599.     if Input.trigger?(Input::C)
  600.       # 角色指令窗口光标位置分之
  601.       case @actor_command_window.index
  602.       when 0  # 攻击
  603.         # 演奏确定 SE
  604.         $game_system.se_play($data_system.decision_se)
  605.         # 设置行动
  606.         @active_battler.current_action.kind = 0
  607.         @active_battler.current_action.basic = 0
  608.         # 开始选择敌人
  609.         start_enemy_select
  610.       when 1  # 特技
  611.         # 演奏确定 SE
  612.         $game_system.se_play($data_system.decision_se)
  613.         # 设置行动
  614.         @active_battler.current_action.kind = 1
  615.         # 开始选择特技
  616.         start_skill_select
  617.       when 2  # 防御
  618.         # 演奏确定 SE
  619.         $game_system.se_play($data_system.decision_se)
  620.         # 设置行动
  621.         @active_battler.current_action.kind = 0
  622.         @active_battler.current_action.basic = 1
  623.         # 转向下一位角色的指令输入
  624.         phase3_next_actor
  625.       when 3  # 物品
  626.         # 演奏确定 SE
  627.         $game_system.se_play($data_system.decision_se)
  628.         # 设置行动
  629.         @active_battler.current_action.kind = 2
  630.         # 开始选择物品
  631.         start_item_select
  632.       when 4  # 换人
  633.         $game_system.se_play($data_system.decision_se)
  634.         @active_battler.current_action.kind = 3
  635.         start_reserved_actor_select
  636.       end
  637.       return
  638.     end
  639.   end
  640.   unless method_defined? :rb_update_phase3_20150422
  641.     alias rb_update_phase3_20150422 update_phase3
  642.     def update_phase3
  643.       if @actor_window != nil
  644.         update_phase3_reserved_actor_select
  645.         return
  646.       end
  647.       rb_update_phase3_20150422
  648.     end
  649.   end
  650.   def start_reserved_actor_select
  651.     # 生成特技窗口
  652.     @actor_window = Window_ReservedActors.new
  653.     # 关联帮助窗口
  654.     @actor_window.help_window = @help_window
  655.     @help_window.visible = true
  656.     # 无效化角色指令窗口
  657.     @actor_command_window.active = false
  658.     @actor_command_window.visible = false
  659.   end
  660.   def end_reserved_actor_select
  661.     # 释放特技窗口
  662.     @actor_window.dispose
  663.     @actor_window = nil
  664.     # 隐藏帮助窗口
  665.     @help_window.visible = false
  666.     # 有效化角色指令窗口
  667.     @actor_command_window.active = true
  668.     @actor_command_window.visible = true
  669.   end
  670.   def update_phase3_reserved_actor_select
  671.     @actor_window.visible = true
  672.     # 刷新特技窗口
  673.     @actor_window.update
  674.     # 按下 B 键的情况下
  675.     if Input.trigger?(Input::B)
  676.       # 演奏取消 SE
  677.       $game_system.se_play($data_system.cancel_se)
  678.       # 结束特技选择
  679.       end_reserved_actor_select
  680.       return
  681.     end
  682.     # 按下 C 键的情况下
  683.     if Input.trigger?(Input::C)
  684.       # 获取特技选择窗口现在选择的特技的数据
  685.       @reserved_actor = @actor_window.actor
  686.       # 无法使用的情况下
  687.       if @reserved_actor == nil
  688.         # 演奏冻结 SE
  689.         $game_system.se_play($data_system.buzzer_se)
  690.         return
  691.       end
  692.       # 演奏确定 SE
  693.       $game_system.se_play($data_system.decision_se)
  694.       # 设置行动
  695.       @active_battler.current_action.reserved_actor_id = @reserved_actor.id
  696.       # 设置特技窗口为不可见状态
  697.       @actor_window.visible = false
  698.       end_reserved_actor_select
  699.       phase3_next_actor
  700.       return
  701.     end
  702.   end
  703.   def update_phase4_step2
  704.     # 如果不是强制行动
  705.     unless @active_battler.current_action.forcing
  706.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  707.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  708.         # 设置行动为攻击
  709.         @active_battler.current_action.kind = 0
  710.         @active_battler.current_action.basic = 0
  711.       end
  712.       # 限制为 [不能行动] 的情况下
  713.       if @active_battler.restriction == 4
  714.         # 清除行动强制对像的战斗者
  715.         $game_temp.forcing_battler = nil
  716.         # 移至步骤 1
  717.         @phase4_step = 1
  718.         return
  719.       end
  720.     end
  721.     # 清除对像战斗者
  722.     @target_battlers = []
  723.     # 行动种类分支
  724.     case @active_battler.current_action.kind
  725.     when 0  # 基本
  726.       make_basic_action_result
  727.     when 1  # 特技
  728.       make_skill_action_result
  729.     when 2  # 物品
  730.       make_item_action_result
  731.     when 3  # 换人
  732.       make_swap_action_result
  733.     end
  734.     # 移至步骤 3
  735.     if @phase4_step == 2
  736.       @phase4_step = 3
  737.     end
  738.   end
  739.   def make_swap_action_result
  740.     # 获取角色
  741.     @reserved_actor = $game_actors[@active_battler.current_action.reserved_actor_id]
  742.     # 无法替换的情况下
  743.     if @reserved_actor == nil || @reserved_actor.active
  744.       # 移至步骤 1
  745.       @phase4_step = 1
  746.       return
  747.     end
  748.     # 在帮助窗口显示文字
  749.     text = "与#{@reserved_actor.name}交换"
  750.     @help_window.set_text(text, 1)
  751.     # 设置动画 ID
  752.     @animation1_id = 0
  753.     index = $game_party.actors.index(@active_battler)
  754.     $game_party.actors[index] = @reserved_actor
  755.   end
  756.   unless method_defined? :rb_start_phase5_20150422
  757.     alias rb_start_phase5_20150422 start_phase5
  758.     def start_phase5
  759.       $game_temp.gain_exp_flag = true
  760.       rb_start_phase5_20150422
  761.       $game_temp.gain_exp_flag = false
  762.     end
  763.   end
  764. end




战斗头像脚本


RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. # ————————————————————————————————————
  6. # ▼▲▼ XRXS_BP 7. バトルステータス?クリアデザイン ver.1.03 ▼▲▼
  7. # by 桜雅 在土
  8. #==============================================================================
  9. # ■ Window_BattleStatus
  10. #==============================================================================
  11. class Window_BattleStatus < Window_Base
  12. #--------------------------------------------------------------------------
  13. # ● 公開インスタンス変数
  14. #--------------------------------------------------------------------------
  15. attr_accessor :update_cp_only # CPメーターのみの更新
  16. #--------------------------------------------------------------------------
  17. # ● オブジェクト初期化
  18. #--------------------------------------------------------------------------
  19. alias xrxs_bp7_initialize initialize
  20. def initialize
  21. # 初期化
  22. @previous_hp = []
  23. @previous_sp = []
  24. # 呼び戻す
  25. xrxs_bp7_initialize
  26. ##############################修改############################################
  27. @sta_back = []
  28. for actor_index in 1..$game_party.actors.size
  29.   actor = $game_party.actors[actor_index - 1]
  30. @sta_back[actor_index] = Sprite.new
  31. @sta_back[actor_index].bitmap = Bitmap.new("Graphics/Characters/Heads/"+ actor.name + ".png")
  32. @sta_back[actor_index].x = (actor_index- 1)* 160 - 5 #在这里调整图片x坐标
  33. @sta_back[actor_index].y = 243#在这里调整图片y坐标
  34. @sta_back[actor_index].z = self.z+1#在这里调整图片优先级
  35. end
  36. ##############################修改############################################
  37. # ↓Full-Viewの場合は下二行の # を消してください。
  38. #self.opacity = 0
  39. #self.back_opacity = 0
  40. ##############################修改############################################
  41. refresh
  42. ##############################修改############################################
  43. end
  44. ##############################修改############################################
  45. def dispose
  46.    super  
  47.    for actor_index in 1..$game_party.actors.size
  48.      next if @sta_back[actor_index].nil?   
  49.       @sta_back[actor_index].bitmap.dispose
  50.       @sta_back[actor_index].dispose
  51.    end
  52. end
  53. ##############################修改############################################
  54. #--------------------------------------------------------------------------
  55. # ● リフレッシュ
  56. #--------------------------------------------------------------------------
  57. alias xrxs_bp7_refresh refresh
  58. def refresh
  59. # CPメーターの更新のみ の場合
  60. if @update_cp_only
  61. xrxs_bp7_refresh
  62. return
  63. end
  64. # 変更するものがない場合、飛ばす
  65. @item_max = $game_party.actors.size
  66. bool = false
  67. for i in 0...@item_max
  68. actor = $game_party.actors[i]
  69. if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
  70. bool = true
  71. end
  72. end
  73. return if bool == false
  74. # 描写を開始
  75. self.contents.clear
  76. for i in 0...@item_max
  77. actor = $game_party.actors[i]
  78. actor_x = i * 160 + 29
  79. # 歩行キャラグラフィックの描写
  80. #draw_actor_graphic(actor, actor_x - 9, 116)
  81.  
  82. # HP/SPメーターの描写
  83. draw_actor_hp_meter_line(actor, actor_x, 47, 96, 12)
  84. draw_actor_sp_meter_line(actor, actor_x, 79, 96, 12)
  85. # HP数値の描写
  86. self.contents.font.size = 24 # HP/SP数値の文字の大きさ
  87. self.contents.font.color = Color.new(0,0,0,192)
  88. self.contents.draw_text(actor_x, 35, 96, 24, actor.hp.to_s, 2)
  89. self.contents.font.color = actor.hp == 0 ? knockout_color :
  90. actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  91. self.contents.draw_text(actor_x-2, 33, 96, 24, actor.hp.to_s, 2)
  92. # SP数値の描写
  93. self.contents.font.color = Color.new(0,0,0,192)
  94. self.contents.draw_text(actor_x, 72, 96, 24, actor.sp.to_s, 2)
  95. self.contents.font.color = actor.sp == 0 ? knockout_color :
  96. actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  97. self.contents.draw_text(actor_x-2, 70, 96, 24, actor.sp.to_s, 2)
  98. # 用語「HP」と用語「SP」の描写
  99. self.contents.font.size = 20 # 用語「HP/SP」の文字の大きさ
  100. draw_actor_name(actor, actor_x ,3 )
  101.  
  102. self.contents.font.color = Color.new(0,0,0,192)
  103. self.contents.draw_text(actor_x+2, 27, 196, 24, $data_system.words.hp)
  104. self.contents.draw_text(actor_x+2, 59, 196, 24, $data_system.words.sp)
  105. self.contents.font.color = system_color # 用語「HP/SP」の文字の色
  106. self.contents.draw_text(actor_x, 25, 196, 24, $data_system.words.hp)
  107. self.contents.draw_text(actor_x, 57, 196, 24, $data_system.words.sp)
  108. draw_actor_state(actor, actor_x, 100)
  109. # 値を更新
  110. @previous_hp[i] = actor.hp
  111. @previous_hp[i] = actor.hp
  112. end
  113. end
  114. end
  115. #==============================================================================
  116. # ■ Window_Base
  117. #==============================================================================
  118. class Window_Base < Window
  119. #--------------------------------------------------------------------------
  120. # ● HPメーター の描画
  121. #--------------------------------------------------------------------------
  122. def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
  123. w = width * actor.hp / [actor.maxhp,1].max
  124. hp_color_1 = Color.new(255, 0, 0, 192)
  125. hp_color_2 = Color.new(255, 255, 0, 192)
  126. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  127. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  128. x -= 1
  129. y += (height/4).floor
  130. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  131. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  132. x -= 1
  133. y += (height/4).ceil
  134. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  135. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  136. x -= 1
  137. y += (height/4).ceil
  138. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  139. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  140. end
  141. #--------------------------------------------------------------------------
  142. # ● SPメーター の描画
  143. #--------------------------------------------------------------------------
  144. def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
  145. w = width * actor.sp / [actor.maxsp,1].max
  146. hp_color_1 = Color.new( 0, 0, 255, 192)
  147. hp_color_2 = Color.new( 0, 255, 255, 192)
  148. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  149. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  150. x -= 1
  151. y += (height/4).floor
  152. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  153. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  154. x -= 1
  155. y += (height/4).ceil
  156. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  157. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  158. x -= 1
  159. y += (height/4).ceil
  160. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  161. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  162. end
  163. #--------------------------------------------------------------------------
  164. # ● 名前の描画
  165. #--------------------------------------------------------------------------
  166. alias xrxs_bp7_draw_actor_name draw_actor_name
  167. def draw_actor_name(actor, x, y)
  168. xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  169. end
  170. #--------------------------------------------------------------------------
  171. # ● ステートの描画
  172. #--------------------------------------------------------------------------
  173. alias xrxs_bp7_draw_actor_state draw_actor_state
  174. def draw_actor_state(actor, x, y, width = 120)  
  175. xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  176. end
  177. #--------------------------------------------------------------------------
  178. # ● HP の描画
  179. #--------------------------------------------------------------------------
  180. alias xrxs_bp7_draw_actor_hp draw_actor_hp
  181. def draw_actor_hp(actor, x, y, width = 144)
  182. xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  183. end
  184. #--------------------------------------------------------------------------
  185. # ● SP の描画
  186. #--------------------------------------------------------------------------
  187. alias xrxs_bp7_draw_actor_sp draw_actor_sp
  188. def draw_actor_sp(actor, x, y, width = 144)
  189. xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  190. end
  191. end
  192. #==============================================================================
  193. # ■ Scene_Battle
  194. #==============================================================================
  195. class Scene_Battle
  196. #--------------------------------------------------------------------------
  197. # ● フレーム更新
  198. #--------------------------------------------------------------------------
  199. alias xrxs_bp7_update update
  200. def update
  201. xrxs_bp7_update
  202. # メッセージウィンドウ表示中の場合
  203. if $game_temp.message_window_showing
  204. @status_window.update_cp_only = true
  205. else
  206. @status_window.update_cp_only = false
  207. end
  208. end
  209. end
  210. #==============================================================================
  211. # ◇ 外部ライブラリ
  212. #==============================================================================
  213. class Window_Base
  214. #--------------------------------------------------------------------------
  215. # ● ライン描画 軽量版 by 桜雅 在土
  216. #--------------------------------------------------------------------------
  217. def draw_lineght(start_x, start_y, end_x, end_y, start_color)
  218. # 描写距離の計算。大きめに直角時の長さ。
  219. distance = (start_x - end_x).abs + (start_y - end_y).abs
  220. # 描写開始
  221. for i in 1..distance
  222. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  223. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  224. self.contents.set_pixel(x, y, start_color)
  225. end
  226. end
  227. #--------------------------------------------------------------------------
  228. # ● ライン描画 by 桜雅 在土
  229. #--------------------------------------------------------------------------
  230. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  231. # 描写距離の計算。大きめに直角時の長さ。
  232. distance = (start_x - end_x).abs + (start_y - end_y).abs
  233. # 描写開始
  234. if end_color == start_color
  235. for i in 1..distance
  236. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  237. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  238. if width == 1
  239. self.contents.set_pixel(x, y, start_color)
  240. else
  241. self.contents.fill_rect(x, y, width, width, start_color)
  242. end
  243. end
  244. else
  245. for i in 1..distance
  246. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  247. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  248. r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  249. g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  250. b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  251. a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  252. if width == 1
  253. self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  254. else
  255. self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  256. end
  257. end
  258. end
  259. end
  260. end
  261.  
  262. #==============================================================================
  263. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  264. #==============================================================================

评分

参与人数 1星屑 +35 收起 理由
RyanBern + 35 手动认可奖励

查看全部评分

甘泉幻想物语 试玩版4.0
https://rpg.blue/forum.php?mod=viewthread&tid=369490&page=1&extra=#pid2534710

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

5
发表于 2015-9-12 19:08:03 | 只看该作者
本帖最后由 RyanBern 于 2015-9-12 19:38 编辑
gkl0510 发表于 2015-9-12 18:45
好问小学生又来了。。。
发现人物仓库模板加上以后,之前的存档就都会报错T-T
这是不是无法解决的宿命了 ...


这个是比较普遍的现象,因为旧存档没有这个变量,而这个队伍系统需要这个变量,因此会报错。
解决办法是在报错那行的前面一行加入:
@battle_actors ||= []
然后载入游戏自行调节出战队员即可。

点评

不好意思,是我的错。我加了一个提前启动公共事件的脚本影响了换人的步骤。对不起。。。 课题结题了,衷心感谢T-T  发表于 2015-9-12 20:41
新脚本在新建工程里测试没问题啊  发表于 2015-9-12 20:36
新的脚本,换人功能失效了。。。  发表于 2015-9-12 20:27
并没有将队员的部分删掉,但是我不小心把显示战斗/待机的地方去掉了,现在已经加了回来。请重新复制2L的脚本,然后在菜单中按S调整队员。  发表于 2015-9-12 20:10
结果只要一打怪就直接gameover因为没有上场队员  发表于 2015-9-12 20:04
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
94
在线时间
157 小时
注册时间
2006-7-2
帖子
299
4
 楼主| 发表于 2015-9-12 18:45:34 | 只看该作者
RyanBern 发表于 2015-9-12 09:52
#=============================================================================
# 队伍系统 Ver 2.0
#- ...

好问小学生又来了。。。
发现人物仓库模板加上以后,之前的存档就都会报错T-T
这是不是无法解决的宿命了。


0.png (33.11 KB, 下载次数: 11)

0.png
甘泉幻想物语 试玩版4.0
https://rpg.blue/forum.php?mod=viewthread&tid=369490&page=1&extra=#pid2534710
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
94
在线时间
157 小时
注册时间
2006-7-2
帖子
299
3
 楼主| 发表于 2015-9-12 10:36:16 | 只看该作者
RyanBern 发表于 2015-9-12 09:52
#=============================================================================
# 队伍系统 Ver 2.0
#- ...

非常感谢回复。修改过的“战斗头像” 放进去以后就会出现bug 图片的位置是要改变吗?

点评

抱歉这一行应该是@sta_back[i].dispose  发表于 2015-9-12 11:25
甘泉幻想物语 试玩版4.0
https://rpg.blue/forum.php?mod=viewthread&tid=369490&page=1&extra=#pid2534710
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

2
发表于 2015-9-12 09:52:50 | 只看该作者
本帖最后由 RyanBern 于 2015-9-12 20:08 编辑

RUBY 代码复制
  1. #=============================================================================
  2. # 队伍系统 Ver 2.0
  3. #-----------------------------------------------------------------------------
  4. # 类似于 Aveyond 的队伍系统(根据阿月系列的游戏产生的灵感)
  5. # By :RyanBern
  6. #-----------------------------------------------------------------------------
  7. # 功能特色:
  8. #-----------------------------------------------------------------------------
  9. # 1.更改队伍中成员的最大数量,有四名出战队员,但是替补队员可以有很多个。
  10. # 2.对 Game_Party 的队员设置和 Scene_Battle 的部分方法有较大改动,可能造成脚本
  11. #   冲突。
  12. # 3.为队伍增加“领队”角色,作为“领队”的成员在地图上显示他的图形。
  13. # 4.在战斗命令中增添“换人”命令,可以将替补队员换上场。
  14. # 5.如果队伍的出战队员全部阵亡,则直接判定玩家全灭,不管有无替补队员。但是如果
  15. #   在地图上,则是所有队员阵亡才会被判定全灭。
  16. # 6.事件编译器中,对全体同伴的处理均包括对替补队员的处理。
  17. #-----------------------------------------------------------------------------
  18. # 使用方法:
  19. #-----------------------------------------------------------------------------
  20. # 1.粘贴到默认脚本后面,Main组前面即可。
  21. # 2.在菜单中,左侧窗口被激活时,按 A 键可以改变领队(leader)的设置,按 S 键
  22. #   可以改变出战的队员。 (要按空格来切换)
  23. # 3.为队员设置“无法出战”的状态,即该队员不能被设置为出战队员。具体方法是
  24. #   使用事件脚本,例如,让 1 号角色无法出战:
  25. #   $game_actors[1].battle_disabled = true
  26. #   让 1 号角色恢复可以出战的状态:
  27. #   $game_actors[1].battle_disabled = false
  28. #   ###
  29. # 4.可在下方设置替补队员在战斗胜利之后是否获得 EXP 奖励。
  30. #=============================================================================
  31.  
  32.  
  33. module RB
  34. end
  35.  
  36. module RB::Party
  37.   # “换人”命令的术语
  38.   Words_Swap = "换人"
  39.  
  40.   # 替补队员是否能在战斗胜利后获得 EXP 奖励,设置为 true 时可以获得奖励,设置
  41.   # 为 false 时则不能。
  42.   Get_Exp_Reserve = true
  43. end
  44.  
  45. class Game_Temp
  46.   attr_accessor :gain_exp_flag
  47.   attr_accessor :battle_swap
  48. end
  49.  
  50. class Game_Party
  51.   attr_reader :leader
  52.   attr_reader :battle_actors
  53.   alias old_ini initialize
  54.   def initialize
  55.     @leader = nil
  56.     @battle_actors = []
  57.     old_ini
  58.   end
  59.   def leader=(leader)
  60.     @leader = leader
  61.     $game_player.refresh
  62.     $game_map.need_refresh = true
  63.   end
  64.   def set_leader(actor_id)
  65.     self.leader = $game_actors[actor_id]
  66.   end
  67.   def actors
  68.     all_flag = !$game_temp.in_battle || (RB::Party::Get_Exp_Reserve && $game_temp.gain_exp_flag)
  69.     return all_flag ? @actors : @battle_actors
  70.   end
  71.   def all_actors
  72.     return @actors
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 加入同伴
  76.   #     actor_id : 角色 ID
  77.   #--------------------------------------------------------------------------
  78.   def add_actor(actor_id)
  79.     # 获取角色
  80.     actor = $game_actors[actor_id]
  81.     # 同伴人数未满 4 人、本角色不在队伍中的情况下
  82.     unless @actors.include?(actor)
  83.       # 添加角色
  84.       @actors.push(actor)
  85.       @battle_actors.push(actor) if @battle_actors.size < 4
  86.       self.leader = actor if self.leader.nil?
  87.       # 还原主角
  88.       $game_player.refresh
  89.     end
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 角色离开
  93.   #     actor_id : 角色 ID
  94.   #--------------------------------------------------------------------------
  95.   def remove_actor(actor_id)
  96.     actor = $game_actors[actor_id]
  97.     # 删除角色
  98.     @actors.delete(actor)
  99.     @battle_actors.delete(actor)
  100.     self.leader = self.actors[0] if self.leader == actor
  101.     # 还原主角
  102.     $game_player.refresh
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● 设置初期同伴
  106.   #--------------------------------------------------------------------------
  107.   def setup_starting_members
  108.     @actors = []
  109.     @battle_actors = []
  110.     for i in $data_system.party_members
  111.       @actors.push($game_actors[i])
  112.       @battle_actors.push($game_actors[i]) if @battle_actors.size < 4
  113.     end
  114.     self.leader = @actors[0]
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● 设置战斗测试用同伴
  118.   #--------------------------------------------------------------------------
  119.   def setup_battle_test_members
  120.     @actors = []
  121.     @battle_actors = []
  122.     for battler in $data_system.test_battlers
  123.       actor = $game_actors[battler.actor_id]
  124.       actor.level = battler.level
  125.       gain_weapon(battler.weapon_id, 1)
  126.       gain_armor(battler.armor1_id, 1)
  127.       gain_armor(battler.armor2_id, 1)
  128.       gain_armor(battler.armor3_id, 1)
  129.       gain_armor(battler.armor4_id, 1)
  130.       actor.equip(0, battler.weapon_id)
  131.       actor.equip(1, battler.armor1_id)
  132.       actor.equip(2, battler.armor2_id)
  133.       actor.equip(3, battler.armor3_id)
  134.       actor.equip(4, battler.armor4_id)
  135.       actor.recover_all
  136.       @actors.push(actor)
  137.       @battle_actors.push(actor)
  138.     end
  139.     @items = {}
  140.     for i in 1...$data_items.size
  141.       if $data_items[i].name != ""
  142.         occasion = $data_items[i].occasion
  143.         if occasion == 0 or occasion == 1
  144.           @items[i] = 99
  145.         end
  146.       end
  147.     end
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 同伴成员的还原
  151.   #--------------------------------------------------------------------------
  152.   def refresh
  153.     # 游戏数据载入后角色对像直接从 $game_actors
  154.     # 分离。
  155.     # 回避由于载入造成的角色再设置的问题。
  156.     new_actors = []
  157.     new_battle_actors = []
  158.     @actors.each do |actor|
  159.       if $data_actors[actor.id] != nil
  160.         new_actors.push($game_actors[actor.id])
  161.       end
  162.     end
  163.     @battle_actors ||= []
  164.     @battle_actors.each do |actor|
  165.       if $data_actors[actor.id] != nil
  166.         new_battle_actors.push($game_actors[actor.id])
  167.       end
  168.     end
  169.     @actors = new_actors
  170.     @battle_actors = new_battle_actors
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 全灭判定
  174.   #--------------------------------------------------------------------------
  175.   def all_dead?
  176.     # 同伴人数为 0 的情况下
  177.     if self.actors.size == 0
  178.       return false
  179.     end
  180.     # 同伴中无人 HP 在 0 以上
  181.     for actor in self.actors
  182.       if actor.hp > 0
  183.         return false
  184.       end
  185.     end
  186.     # 全灭
  187.     return true
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ● 对像角色的随机确定
  191.   #     hp0 : 限制为 HP 0 的角色
  192.   #--------------------------------------------------------------------------
  193.   def random_target_actor(hp0 = false)
  194.     # 初始化轮流
  195.     roulette = []
  196.     # 循环
  197.     for actor in @battle_actors
  198.       # 符合条件的场合
  199.       if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
  200.         # 获取角色职业的位置 [位置]
  201.         position = $data_classes[actor.class_id].position
  202.         # 前卫的话 n = 4、中卫的话 n = 3、后卫的话 n = 2
  203.         n = 4 - position
  204.         # 添加角色的轮流 n 回
  205.         n.times do
  206.           roulette.push(actor)
  207.         end
  208.       end
  209.     end
  210.     # 轮流大小为 0 的情况
  211.     if roulette.size == 0
  212.       return nil
  213.     end
  214.     # 转轮盘赌,决定角色
  215.     return roulette[rand(roulette.size)]
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 对像角色的顺序确定
  219.   #     actor_index : 角色索引
  220.   #--------------------------------------------------------------------------
  221.   def smooth_target_actor(actor_index)
  222.     # 取得对像
  223.     actor = @battle_actors[actor_index]
  224.     # 对像存在的情况下
  225.     if actor != nil and actor.exist?
  226.       return actor
  227.     end
  228.     # 循环
  229.     for actor in @actors
  230.       # 对像存在的情况下
  231.       if actor.exist?
  232.         return actor
  233.       end
  234.     end
  235.   end
  236. end
  237.  
  238. class Game_Actor
  239.   attr_reader :battle_disabled
  240.   def leader?
  241.     return self == $game_party.leader
  242.   end
  243.   def active
  244.     return $game_party.battle_actors.include?(self)
  245.   end
  246.   def battle_disabled=(bool)
  247.     @battle_disabled = bool
  248.     $game_party.battle_actors.delete(self) if bool
  249.   end
  250. end
  251.  
  252. class Game_BattleAction
  253.   attr_accessor :reserved_actor_id
  254.   unless method_defined? :rb_clear_20150422
  255.     alias rb_clear_20150422 clear
  256.     def clear
  257.       rb_clear_20150422
  258.       @reserved_actor_id = 0
  259.     end
  260.   end
  261. end
  262.  
  263. class Window_Base < Window
  264.   def draw_actor_battle_position(actor, x, y)
  265.     color = disabled_color
  266.     if actor.battle_disabled
  267.       text = "无法出战"
  268.     elsif actor.active
  269.       text = "出战"
  270.       color = normal_color
  271.     else
  272.       text = "待机"
  273.     end
  274.     self.contents.font.color = color
  275.     self.contents.draw_text(x, y, 120, 32, text)
  276.   end
  277. end
  278.  
  279. #==============================================================================
  280. # ■ Window_Selectable
  281. #------------------------------------------------------------------------------
  282. #  拥有光标的移动以及滚动功能的窗口类。
  283. #==============================================================================
  284.  
  285. class Window_Selectable < Window_Base
  286.   #--------------------------------------------------------------------------
  287.   # ● 定义实例变量
  288.   #--------------------------------------------------------------------------
  289.   attr_accessor :row_height               # 行高
  290.   #--------------------------------------------------------------------------
  291.   # ● 初始画对像
  292.   #     x      : 窗口的 X 坐标
  293.   #     y      : 窗口的 Y 坐标
  294.   #     width  : 窗口的宽
  295.   #     height : 窗口的高
  296.   #     row_height : 行高 默认是32
  297.   #--------------------------------------------------------------------------
  298.   alias rb_initialize_20150421 initialize
  299.   def initialize(x, y, width, height, row_height = 32)
  300.     @row_height = row_height
  301.     rb_initialize_20150421(x, y, width, height)
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 获取开头行
  305.   #--------------------------------------------------------------------------
  306.   def top_row
  307.     # 将窗口内容的传送源 Y 坐标、1 行的高 @row_height 等分
  308.     return self.oy / @row_height
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● 设置开头行
  312.   #     row : 显示开头的行
  313.   #--------------------------------------------------------------------------
  314.   def top_row=(row)
  315.     # row 未满 0 的场合更正为 0
  316.     if row < 0
  317.       row = 0
  318.     end
  319.     # row 超过 row_max - 1 的情况下更正为 row_max - 1
  320.     if row > row_max - 1
  321.       row = row_max - 1
  322.     end
  323.     # row 1 行高的 @row_height 倍、窗口内容的传送源 Y 坐标
  324.     self.oy = row * @row_height
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● 获取 1 页可以显示的行数
  328.   #--------------------------------------------------------------------------
  329.   def page_row_max
  330.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 @row_height
  331.     return (self.height - 32) / @row_height
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ● 更新光标举行
  335.   #--------------------------------------------------------------------------
  336.   def update_cursor_rect
  337.     # 光标位置不满 0 的情况下
  338.     if @index < 0
  339.       self.cursor_rect.empty
  340.       return
  341.     end
  342.     # 获取当前的行
  343.     row = @index / @column_max
  344.     # 当前行被显示开头行前面的情况下
  345.     if row < self.top_row
  346.       # 从当前行向开头行滚动
  347.       self.top_row = row
  348.     end
  349.     # 当前行被显示末尾行之后的情况下
  350.     if row > self.top_row + (self.page_row_max - 1)
  351.       # 从当前行向末尾滚动
  352.       self.top_row = row - (self.page_row_max - 1)
  353.     end
  354.     # 计算光标的宽
  355.     cursor_width = self.width / @column_max - 32
  356.     # 计算光标坐标
  357.     x = @index % @column_max * (cursor_width + 32)
  358.     y = @index / @column_max * @row_height - self.oy
  359.     # 更新国标矩形
  360.     self.cursor_rect.set(x, y, cursor_width, @row_height)
  361.   end
  362. end
  363.  
  364. class Window_MenuStatus
  365.   def initialize
  366.     super(0, 0, 480, 480, 112)
  367.     refresh
  368.     self.active = false
  369.     self.index = -1
  370.   end
  371.   def refresh
  372.     if self.contents != nil
  373.       self.contents.dispose
  374.       self.contents = nil
  375.     end
  376.     @item_max = $game_party.actors.size
  377.     self.contents = Bitmap.new(width - 32, @item_max == 0 ? 32 : @item_max * 112)
  378.     for i in 0...$game_party.actors.size
  379.       x = 64
  380.       y = i * 112
  381.       actor = $game_party.actors[i]
  382.       draw_actor_graphic(actor, x - 40, y + 80)
  383.       draw_actor_name(actor, x, y)
  384.       draw_actor_class(actor, x + 144, y)
  385.       draw_actor_level(actor, x, y + 32)
  386.       draw_actor_state(actor, x + 90, y + 32)
  387.       draw_actor_exp(actor, x, y + 64)
  388.       draw_actor_hp(actor, x + 236, y + 32)
  389.       draw_actor_sp(actor, x + 236, y + 64)
  390.       draw_actor_battle_position(actor, x + 236, y)
  391.     end
  392.   end
  393.   def update_cursor_rect
  394.     super
  395.   end
  396. end
  397.  
  398. class Window_Target
  399.   def initialize
  400.     super(0, 0, 336, 480, 112)
  401.     self.z += 10
  402.     @item_max = $game_party.actors.size
  403.     self.contents = Bitmap.new(width - 32, @item_max == 0 ? 32 : @item_max * 112)
  404.     refresh
  405.   end
  406.   def update_cursor_rect
  407.     super
  408.   end
  409. end
  410.  
  411. class Window_ReservedActors < Window_Selectable
  412.   def initialize
  413.     super(0, 64, 640, 256, 112)
  414.     self.opacity = 160
  415.     self.index = 0
  416.     self.active = true
  417.     @column_max = 2
  418.     refresh
  419.   end
  420.   def actor
  421.     return @data[self.index]
  422.   end
  423.   def refresh
  424.     if self.contents != nil
  425.       self.contents.dispose
  426.       self.contents = nil
  427.     end
  428.     @data = []
  429.     $game_party.all_actors.each do |actor|
  430.       @data << actor unless actor.active || actor.battle_disabled
  431.     end
  432.     @item_max = @data.size
  433.     if @item_max > 0
  434.       self.contents = Bitmap.new (width - 32, (@item_max + 1) / 2 * 128)
  435.       @data.each_with_index do |actor, index|
  436.         x = 4 + index % 2 * (288 + 32)
  437.         y = index / 2 * 112
  438.         draw_actor_graphic(actor, x + 16, y + 80)
  439.         draw_actor_hp(actor, x + 48, y + 20)
  440.         draw_actor_sp(actor, x + 48, y + 52)
  441.       end
  442.     end
  443.   end
  444.   def update_help
  445.     # 帮助窗口显示角色的状态
  446.     self.actor == nil ? @help_window.set_text("") : @help_window.set_actor(self.actor)
  447.   end
  448. end
  449.  
  450. class Scene_Menu
  451.   unless method_defined? :rb_update_command_20150421
  452.     alias rb_update_command_20150421 update_command
  453.     def update_command
  454.       if Input.trigger?(Input::Y)
  455.         $game_system.se_play($data_system.decision_se)
  456.         @command_window.active = false
  457.         @status_window.active = true
  458.         @status_window.index = 0
  459.         @battler_adjust = true
  460.         return
  461.       end
  462.       rb_update_command_20150421
  463.     end
  464.   end
  465.   unless method_defined? :rb_update_status_20150421
  466.     alias rb_update_status_20150421 update_status
  467.     def update_status
  468.       if @battler_adjust
  469.         update_battler
  470.         return
  471.       end
  472.       rb_update_status_20150421
  473.     end
  474.   end
  475.   def update_battler
  476.     if Input.trigger?(Input::B)
  477.       $game_system.se_play($data_system.cancel_se)
  478.       @battler_adjust = false
  479.       @status_window.active = false
  480.       @status_window.index = -1
  481.       @command_window.active = true
  482.       return
  483.     end
  484.     if Input.trigger?(Input::C)
  485.       actor = $game_party.actors[@status_window.index]
  486.       if actor == nil || actor.battle_disabled ||
  487.         (actor.active && $game_party.battle_actors.size == 1) ||
  488.         (!actor.active && $game_party.battle_actors.size == 4)
  489.         $game_system.se_play($data_system.buzzer_se)
  490.       else
  491.         $game_system.se_play($data_system.decision_se)
  492.         actor.active ? $game_party.battle_actors.delete(actor) : $game_party.battle_actors.push(actor)
  493.         @status_window.refresh
  494.       end
  495.     end
  496.   end
  497. end
  498.  
  499. class Scene_Battle
  500.   def generate_modified_command_window
  501.     if @actor_command_window != nil
  502.       @actor_command_window.dispose
  503.       @actor_command_window = nil
  504.     end
  505.     s1 = $data_system.words.attack
  506.     s2 = $data_system.words.skill
  507.     s3 = $data_system.words.guard
  508.     s4 = $data_system.words.item
  509.     s5 = RB::Party::Words_Swap
  510.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
  511.     @actor_command_window.y = 128
  512.     @actor_command_window.back_opacity = 160
  513.     @actor_command_window.active = false
  514.     @actor_command_window.visible = false
  515.     @modified_generated = true
  516.   end
  517.   unless method_defined? :rb_phase3_setup_command_window_20150422
  518.     alias rb_phase3_setup_command_window_20150422 phase3_setup_command_window
  519.     def phase3_setup_command_window
  520.       generate_modified_command_window unless @modified_generated
  521.       rb_phase3_setup_command_window_20150422
  522.     end
  523.   end
  524.   def update_phase3_basic_command
  525.     # 按下 B 键的情况下
  526.     if Input.trigger?(Input::B)
  527.       # 演奏取消 SE
  528.       $game_system.se_play($data_system.cancel_se)
  529.       # 转向前一个角色的指令输入
  530.       phase3_prior_actor
  531.       return
  532.     end
  533.     # 按下 C 键的情况下
  534.     if Input.trigger?(Input::C)
  535.       # 角色指令窗口光标位置分之
  536.       case @actor_command_window.index
  537.       when 0  # 攻击
  538.         # 演奏确定 SE
  539.         $game_system.se_play($data_system.decision_se)
  540.         # 设置行动
  541.         @active_battler.current_action.kind = 0
  542.         @active_battler.current_action.basic = 0
  543.         # 开始选择敌人
  544.         start_enemy_select
  545.       when 1  # 特技
  546.         # 演奏确定 SE
  547.         $game_system.se_play($data_system.decision_se)
  548.         # 设置行动
  549.         @active_battler.current_action.kind = 1
  550.         # 开始选择特技
  551.         start_skill_select
  552.       when 2  # 防御
  553.         # 演奏确定 SE
  554.         $game_system.se_play($data_system.decision_se)
  555.         # 设置行动
  556.         @active_battler.current_action.kind = 0
  557.         @active_battler.current_action.basic = 1
  558.         # 转向下一位角色的指令输入
  559.         phase3_next_actor
  560.       when 3  # 物品
  561.         # 演奏确定 SE
  562.         $game_system.se_play($data_system.decision_se)
  563.         # 设置行动
  564.         @active_battler.current_action.kind = 2
  565.         # 开始选择物品
  566.         start_item_select
  567.       when 4  # 换人
  568.         $game_system.se_play($data_system.decision_se)
  569.         @active_battler.current_action.kind = 3
  570.         start_reserved_actor_select
  571.       end
  572.       return
  573.     end
  574.   end
  575.   unless method_defined? :rb_update_phase3_20150422
  576.     alias rb_update_phase3_20150422 update_phase3
  577.     def update_phase3
  578.       if @actor_window != nil
  579.         update_phase3_reserved_actor_select
  580.         return
  581.       end
  582.       rb_update_phase3_20150422
  583.     end
  584.   end
  585.   def start_reserved_actor_select
  586.     # 生成特技窗口
  587.     @actor_window = Window_ReservedActors.new
  588.     # 关联帮助窗口
  589.     @actor_window.help_window = @help_window
  590.     @help_window.visible = true
  591.     # 无效化角色指令窗口
  592.     @actor_command_window.active = false
  593.     @actor_command_window.visible = false
  594.   end
  595.   def end_reserved_actor_select
  596.     # 释放特技窗口
  597.     @actor_window.dispose
  598.     @actor_window = nil
  599.     # 隐藏帮助窗口
  600.     @help_window.visible = false
  601.     # 有效化角色指令窗口
  602.     @actor_command_window.active = true
  603.     @actor_command_window.visible = true
  604.   end
  605.   def update_phase3_reserved_actor_select
  606.     @actor_window.visible = true
  607.     # 刷新特技窗口
  608.     @actor_window.update
  609.     # 按下 B 键的情况下
  610.     if Input.trigger?(Input::B)
  611.       # 演奏取消 SE
  612.       $game_system.se_play($data_system.cancel_se)
  613.       # 结束特技选择
  614.       end_reserved_actor_select
  615.       return
  616.     end
  617.     # 按下 C 键的情况下
  618.     if Input.trigger?(Input::C)
  619.       # 获取特技选择窗口现在选择的特技的数据
  620.       @reserved_actor = @actor_window.actor
  621.       # 无法使用的情况下
  622.       if @reserved_actor == nil
  623.         # 演奏冻结 SE
  624.         $game_system.se_play($data_system.buzzer_se)
  625.         return
  626.       end
  627.       # 演奏确定 SE
  628.       $game_system.se_play($data_system.decision_se)
  629.       # 设置行动
  630.       @active_battler.current_action.reserved_actor_id = @reserved_actor.id
  631.       # 设置特技窗口为不可见状态
  632.       @actor_window.visible = false
  633.       end_reserved_actor_select
  634.       phase3_next_actor
  635.       return
  636.     end
  637.   end
  638.   def update_phase4_step2
  639.     # 如果不是强制行动
  640.     unless @active_battler.current_action.forcing
  641.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  642.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  643.         # 设置行动为攻击
  644.         @active_battler.current_action.kind = 0
  645.         @active_battler.current_action.basic = 0
  646.       end
  647.       # 限制为 [不能行动] 的情况下
  648.       if @active_battler.restriction == 4
  649.         # 清除行动强制对像的战斗者
  650.         $game_temp.forcing_battler = nil
  651.         # 移至步骤 1
  652.         @phase4_step = 1
  653.         return
  654.       end
  655.     end
  656.     # 清除对像战斗者
  657.     @target_battlers = []
  658.     # 行动种类分支
  659.     case @active_battler.current_action.kind
  660.     when 0  # 基本
  661.       make_basic_action_result
  662.     when 1  # 特技
  663.       make_skill_action_result
  664.     when 2  # 物品
  665.       make_item_action_result
  666.     when 3  # 换人
  667.       make_swap_action_result
  668.     end
  669.     # 移至步骤 3
  670.     if @phase4_step == 2
  671.       @phase4_step = 3
  672.     end
  673.   end
  674.   def make_swap_action_result
  675.     # 获取角色
  676.     @reserved_actor = $game_actors[@active_battler.current_action.reserved_actor_id]
  677.     # 无法替换的情况下
  678.     if @reserved_actor == nil || @reserved_actor.active
  679.       # 移至步骤 1
  680.       @phase4_step = 1
  681.       return
  682.     end
  683.     # 在帮助窗口显示文字
  684.     text = "与#{@reserved_actor.name}交换"
  685.     @help_window.set_text(text, 1)
  686.     # 设置动画 ID
  687.     @animation1_id = 0
  688.     index = $game_party.actors.index(@active_battler)
  689.     $game_party.actors[index] = @reserved_actor
  690.     # 设置战斗交换标志
  691.     $game_temp.battle_swap = true
  692.   end
  693.   unless method_defined? :rb_start_phase5_20150422
  694.     alias rb_start_phase5_20150422 start_phase5
  695.     def start_phase5
  696.       $game_temp.gain_exp_flag = true
  697.       rb_start_phase5_20150422
  698.       $game_temp.gain_exp_flag = false
  699.     end
  700.   end
  701. end


RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. # ————————————————————————————————————
  6. # ▼▲▼ XRXS_BP 7. バトルステータス?クリアデザイン ver.1.03 ▼▲▼
  7. # by 桜雅 在土
  8. #==============================================================================
  9. # ■ Window_BattleStatus
  10. #==============================================================================
  11. class Window_BattleStatus < Window_Base
  12. #--------------------------------------------------------------------------
  13. # ● 公開インスタンス変数
  14. #--------------------------------------------------------------------------
  15. attr_accessor :update_cp_only # CPメーターのみの更新
  16. #--------------------------------------------------------------------------
  17. # ● オブジェクト初期化
  18. #--------------------------------------------------------------------------
  19. alias xrxs_bp7_initialize initialize
  20. def initialize
  21. # 初期化
  22. @previous_hp = []
  23. @previous_sp = []
  24. # 呼び戻す
  25. xrxs_bp7_initialize
  26. ##############################修改############################################
  27. @sta_back = []
  28. create_heads
  29. ##############################修改############################################
  30. # ↓Full-Viewの場合は下二行の # を消してください。
  31. #self.opacity = 0
  32. #self.back_opacity = 0
  33. ##############################修改############################################
  34. refresh
  35. ##############################修改############################################
  36. end
  37. ##############################修改############################################
  38. def dispose
  39.    super  
  40.    @sta_back.each do |sprite|
  41.      next if sprite.nil?
  42.      sprite.bitmap.dispose
  43.      sprite.dispose
  44.    end
  45. end
  46. ##############################修改############################################
  47.   def create_heads
  48.     (0...$game_party.actors.size).each do |i|
  49.       if @sta_back[i] != nil
  50.         @sta_back[i].bitmap.dispose
  51.         @sta_back[i].dispose
  52.       end
  53.       actor = $game_party.actors[i]
  54.       @sta_back[i] = Sprite.new
  55.       @sta_back[i].bitmap = Bitmap.new("Graphics/Characters/Heads/"+ actor.name + ".png")
  56.       @sta_back[i].x = i * 160 - 5 #在这里调整图片x坐标
  57.       @sta_back[i].y = 243#在这里调整图片y坐标
  58.       @sta_back[i].z = self.z + 1#在这里调整图片优先级
  59.     end
  60.   end
  61.   def update
  62.     super
  63.     if $game_temp.battle_swap
  64.       create_heads
  65.       $game_temp.battle_swap = false
  66.     end
  67.   end
  68. #--------------------------------------------------------------------------
  69. # ● リフレッシュ
  70. #--------------------------------------------------------------------------
  71. alias xrxs_bp7_refresh refresh
  72. def refresh
  73. # CPメーターの更新のみ の場合
  74. if @update_cp_only
  75. xrxs_bp7_refresh
  76. return
  77. end
  78. # 変更するものがない場合、飛ばす
  79. @item_max = $game_party.actors.size
  80. bool = false
  81. for i in 0...@item_max
  82. actor = $game_party.actors[i]
  83. if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
  84. bool = true
  85. end
  86. end
  87. return if bool == false
  88. # 描写を開始
  89. self.contents.clear
  90. for i in 0...@item_max
  91. actor = $game_party.actors[i]
  92. actor_x = i * 160 + 29
  93. # 歩行キャラグラフィックの描写
  94. #draw_actor_graphic(actor, actor_x - 9, 116)
  95.  
  96. # HP/SPメーターの描写
  97. draw_actor_hp_meter_line(actor, actor_x, 47, 96, 12)
  98. draw_actor_sp_meter_line(actor, actor_x, 79, 96, 12)
  99. # HP数値の描写
  100. self.contents.font.size = 24 # HP/SP数値の文字の大きさ
  101. self.contents.font.color = Color.new(0,0,0,192)
  102. self.contents.draw_text(actor_x, 35, 96, 24, actor.hp.to_s, 2)
  103. self.contents.font.color = actor.hp == 0 ? knockout_color :
  104. actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  105. self.contents.draw_text(actor_x-2, 33, 96, 24, actor.hp.to_s, 2)
  106. # SP数値の描写
  107. self.contents.font.color = Color.new(0,0,0,192)
  108. self.contents.draw_text(actor_x, 72, 96, 24, actor.sp.to_s, 2)
  109. self.contents.font.color = actor.sp == 0 ? knockout_color :
  110. actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  111. self.contents.draw_text(actor_x-2, 70, 96, 24, actor.sp.to_s, 2)
  112. # 用語「HP」と用語「SP」の描写
  113. self.contents.font.size = 20 # 用語「HP/SP」の文字の大きさ
  114. draw_actor_name(actor, actor_x ,3 )
  115.  
  116. self.contents.font.color = Color.new(0,0,0,192)
  117. self.contents.draw_text(actor_x+2, 27, 196, 24, $data_system.words.hp)
  118. self.contents.draw_text(actor_x+2, 59, 196, 24, $data_system.words.sp)
  119. self.contents.font.color = system_color # 用語「HP/SP」の文字の色
  120. self.contents.draw_text(actor_x, 25, 196, 24, $data_system.words.hp)
  121. self.contents.draw_text(actor_x, 57, 196, 24, $data_system.words.sp)
  122. draw_actor_state(actor, actor_x, 100)
  123. # 値を更新
  124. @previous_hp[i] = actor.hp
  125. @previous_hp[i] = actor.hp
  126. end
  127. end
  128. end
  129. #==============================================================================
  130. # ■ Window_Base
  131. #==============================================================================
  132. class Window_Base < Window
  133. #--------------------------------------------------------------------------
  134. # ● HPメーター の描画
  135. #--------------------------------------------------------------------------
  136. def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
  137. w = width * actor.hp / [actor.maxhp,1].max
  138. hp_color_1 = Color.new(255, 0, 0, 192)
  139. hp_color_2 = Color.new(255, 255, 0, 192)
  140. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  141. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  142. x -= 1
  143. y += (height/4).floor
  144. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  145. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  146. x -= 1
  147. y += (height/4).ceil
  148. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  149. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  150. x -= 1
  151. y += (height/4).ceil
  152. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  153. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  154. end
  155. #--------------------------------------------------------------------------
  156. # ● SPメーター の描画
  157. #--------------------------------------------------------------------------
  158. def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
  159. w = width * actor.sp / [actor.maxsp,1].max
  160. hp_color_1 = Color.new( 0, 0, 255, 192)
  161. hp_color_2 = Color.new( 0, 255, 255, 192)
  162. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  163. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  164. x -= 1
  165. y += (height/4).floor
  166. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  167. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  168. x -= 1
  169. y += (height/4).ceil
  170. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  171. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  172. x -= 1
  173. y += (height/4).ceil
  174. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  175. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  176. end
  177. #--------------------------------------------------------------------------
  178. # ● 名前の描画
  179. #--------------------------------------------------------------------------
  180. alias xrxs_bp7_draw_actor_name draw_actor_name
  181. def draw_actor_name(actor, x, y)
  182. xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  183. end
  184. #--------------------------------------------------------------------------
  185. # ● ステートの描画
  186. #--------------------------------------------------------------------------
  187. alias xrxs_bp7_draw_actor_state draw_actor_state
  188. def draw_actor_state(actor, x, y, width = 120)  
  189. xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  190. end
  191. #--------------------------------------------------------------------------
  192. # ● HP の描画
  193. #--------------------------------------------------------------------------
  194. alias xrxs_bp7_draw_actor_hp draw_actor_hp
  195. def draw_actor_hp(actor, x, y, width = 144)
  196. xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  197. end
  198. #--------------------------------------------------------------------------
  199. # ● SP の描画
  200. #--------------------------------------------------------------------------
  201. alias xrxs_bp7_draw_actor_sp draw_actor_sp
  202. def draw_actor_sp(actor, x, y, width = 144)
  203. xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  204. end
  205. end
  206. #==============================================================================
  207. # ■ Scene_Battle
  208. #==============================================================================
  209. class Scene_Battle
  210. #--------------------------------------------------------------------------
  211. # ● フレーム更新
  212. #--------------------------------------------------------------------------
  213. alias xrxs_bp7_update update
  214. def update
  215. xrxs_bp7_update
  216.  
  217. # メッセージウィンドウ表示中の場合
  218. if $game_temp.message_window_showing
  219. @status_window.update_cp_only = true
  220. else
  221. @status_window.update_cp_only = false
  222. end
  223. end
  224. end
  225. #==============================================================================
  226. # ◇ 外部ライブラリ
  227. #==============================================================================
  228. class Window_Base
  229. #--------------------------------------------------------------------------
  230. # ● ライン描画 軽量版 by 桜雅 在土
  231. #--------------------------------------------------------------------------
  232. def draw_lineght(start_x, start_y, end_x, end_y, start_color)
  233. # 描写距離の計算。大きめに直角時の長さ。
  234. distance = (start_x - end_x).abs + (start_y - end_y).abs
  235. # 描写開始
  236. for i in 1..distance
  237. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  238. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  239. self.contents.set_pixel(x, y, start_color)
  240. end
  241. end
  242. #--------------------------------------------------------------------------
  243. # ● ライン描画 by 桜雅 在土
  244. #--------------------------------------------------------------------------
  245. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  246. # 描写距離の計算。大きめに直角時の長さ。
  247. distance = (start_x - end_x).abs + (start_y - end_y).abs
  248. # 描写開始
  249. if end_color == start_color
  250. for i in 1..distance
  251. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  252. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  253. if width == 1
  254. self.contents.set_pixel(x, y, start_color)
  255. else
  256. self.contents.fill_rect(x, y, width, width, start_color)
  257. end
  258. end
  259. else
  260. for i in 1..distance
  261. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  262. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  263. r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  264. g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  265. b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  266. a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  267. if width == 1
  268. self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  269. else
  270. self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  271. end
  272. end
  273. end
  274. end
  275. end
  276.  
  277. #==============================================================================
  278. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  279. #==============================================================================


注:以上脚本直接替换原来的脚本,未测试。
个人感觉改的应该是队伍跟随脚本,而不是队伍脚本[领队]的功能,但是我已经把领队功能去掉了。
新战斗头像脚本更改头像坐标的语句移动到了create_heads的方法里面。

点评

经测试完全没问题了,感激涕零  发表于 2015-9-12 17:02
抱歉,我的错。请重新复制第二个的脚本  发表于 2015-9-12 16:19
不好意思,前面测试了一下还是有一个小小的bug。 就是战斗结束以后 最左侧的人物立绘还会滞留在屏幕上。不管是换人还是没换人  发表于 2015-9-12 16:15
真的成功了!!两行老泪留下来T-T 虽然完全没看出来两行代码有什么区别,但是换上去就成功了。 真的谢谢大神,让小白能够完成自己的游戏和心愿。   发表于 2015-9-12 16:08
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-10-2 12:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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