查看: 2082|回复: 4

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

[复制链接]
梦石
0
星屑
94
在线时间
157 小时
注册时间
2006-7-2
回帖
250
发表于 2015-9-12 09:16:52 | 显示全部楼层 |阅读模式

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

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

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

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

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

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

1.JPG

2.JPG

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


3.JPG


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


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


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


角色仓库脚本

  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. module RB
  32. end

  33. module RB::Party
  34.   # “换人”命令的术语
  35.   Words_Swap = "换人"
  36.   
  37.   # 替补队员是否能在战斗胜利后获得 EXP 奖励,设置为 true 时可以获得奖励,设置
  38.   # 为 false 时则不能。
  39.   Get_Exp_Reserve = true
  40. end

  41. class Game_Temp
  42.   attr_accessor :gain_exp_flag
  43. end

  44. class Game_Party
  45.   attr_reader :leader
  46.   attr_reader :battle_actors
  47.   alias old_ini initialize
  48.   def initialize
  49.     @leader = nil
  50.     @battle_actors = []
  51.     old_ini
  52.   end
  53.   def leader=(leader)
  54.     @leader = leader
  55.     $game_player.refresh
  56.     $game_map.need_refresh = true
  57.   end
  58.   def set_leader(actor_id)
  59.     self.leader = $game_actors[actor_id]
  60.   end
  61.   def actors
  62.     all_flag = !$game_temp.in_battle || (RB::Party::Get_Exp_Reserve && $game_temp.gain_exp_flag)
  63.     return all_flag ? @actors : @battle_actors
  64.   end
  65.   def all_actors
  66.     return @actors
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 加入同伴
  70.   #     actor_id : 角色 ID
  71.   #--------------------------------------------------------------------------
  72.   def add_actor(actor_id)
  73.     # 获取角色
  74.     actor = $game_actors[actor_id]
  75.     # 同伴人数未满 4 人、本角色不在队伍中的情况下
  76.     unless @actors.include?(actor)
  77.       # 添加角色
  78.       @actors.push(actor)
  79.       @battle_actors.push(actor) if @battle_actors.size < 4
  80.       self.leader = actor if self.leader.nil?
  81.       # 还原主角
  82.       $game_player.refresh
  83.     end
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 角色离开
  87.   #     actor_id : 角色 ID
  88.   #--------------------------------------------------------------------------
  89.   def remove_actor(actor_id)
  90.     actor = $game_actors[actor_id]
  91.     # 删除角色
  92.     @actors.delete(actor)
  93.     @battle_actors.delete(actor)
  94.     self.leader = self.actors[0] if self.leader == actor
  95.     # 还原主角
  96.     $game_player.refresh
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 设置初期同伴
  100.   #--------------------------------------------------------------------------
  101.   def setup_starting_members
  102.     @actors = []
  103.     @battle_actors = []
  104.     for i in $data_system.party_members
  105.       @actors.push($game_actors[i])
  106.       @battle_actors.push($game_actors[i]) if @battle_actors.size < 4
  107.     end
  108.     self.leader = @actors[0]
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 设置战斗测试用同伴
  112.   #--------------------------------------------------------------------------
  113.   def setup_battle_test_members
  114.     @actors = []
  115.     @battle_actors = []
  116.     for battler in $data_system.test_battlers
  117.       actor = $game_actors[battler.actor_id]
  118.       actor.level = battler.level
  119.       gain_weapon(battler.weapon_id, 1)
  120.       gain_armor(battler.armor1_id, 1)
  121.       gain_armor(battler.armor2_id, 1)
  122.       gain_armor(battler.armor3_id, 1)
  123.       gain_armor(battler.armor4_id, 1)
  124.       actor.equip(0, battler.weapon_id)
  125.       actor.equip(1, battler.armor1_id)
  126.       actor.equip(2, battler.armor2_id)
  127.       actor.equip(3, battler.armor3_id)
  128.       actor.equip(4, battler.armor4_id)
  129.       actor.recover_all
  130.       @actors.push(actor)
  131.       @battle_actors.push(actor)
  132.     end
  133.     @items = {}
  134.     for i in 1...$data_items.size
  135.       if $data_items[i].name != ""
  136.         occasion = $data_items[i].occasion
  137.         if occasion == 0 or occasion == 1
  138.           @items[i] = 99
  139.         end
  140.       end
  141.     end
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 同伴成员的还原
  145.   #--------------------------------------------------------------------------
  146.   def refresh
  147.     # 游戏数据载入后角色对像直接从 $game_actors
  148.     # 分离。
  149.     # 回避由于载入造成的角色再设置的问题。
  150.     new_actors = []
  151.     new_battle_actors = []
  152.     @actors.each do |actor|
  153.       if $data_actors[actor.id] != nil
  154.         new_actors.push($game_actors[actor.id])
  155.       end
  156.     end
  157.     @battle_actors.each do |actor|
  158.       if $data_actors[actor.id] != nil
  159.         new_battle_actors.push($game_actors[actor.id])
  160.       end
  161.     end
  162.     @actors = new_actors
  163.     @battle_actors = new_battle_actors
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 全灭判定
  167.   #--------------------------------------------------------------------------
  168.   def all_dead?
  169.     # 同伴人数为 0 的情况下
  170.     if self.actors.size == 0
  171.       return false
  172.     end
  173.     # 同伴中无人 HP 在 0 以上
  174.     for actor in self.actors
  175.       if actor.hp > 0
  176.         return false
  177.       end
  178.     end
  179.     # 全灭
  180.     return true
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ● 对像角色的随机确定
  184.   #     hp0 : 限制为 HP 0 的角色
  185.   #--------------------------------------------------------------------------
  186.   def random_target_actor(hp0 = false)
  187.     # 初始化轮流
  188.     roulette = []
  189.     # 循环
  190.     for actor in @battle_actors
  191.       # 符合条件的场合
  192.       if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
  193.         # 获取角色职业的位置 [位置]
  194.         position = $data_classes[actor.class_id].position
  195.         # 前卫的话 n = 4、中卫的话 n = 3、后卫的话 n = 2
  196.         n = 4 - position
  197.         # 添加角色的轮流 n 回
  198.         n.times do
  199.           roulette.push(actor)
  200.         end
  201.       end
  202.     end
  203.     # 轮流大小为 0 的情况
  204.     if roulette.size == 0
  205.       return nil
  206.     end
  207.     # 转轮盘赌,决定角色
  208.     return roulette[rand(roulette.size)]
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ● 对像角色的顺序确定
  212.   #     actor_index : 角色索引
  213.   #--------------------------------------------------------------------------
  214.   def smooth_target_actor(actor_index)
  215.     # 取得对像
  216.     actor = @battle_actors[actor_index]
  217.     # 对像存在的情况下
  218.     if actor != nil and actor.exist?
  219.       return actor
  220.     end
  221.     # 循环
  222.     for actor in @actors
  223.       # 对像存在的情况下
  224.       if actor.exist?
  225.         return actor
  226.       end
  227.     end
  228.   end

  229. end

  230. class Game_Actor
  231.   attr_reader :battle_disabled
  232.   def leader?
  233.     return self == $game_party.leader
  234.   end
  235.   def active
  236.     return $game_party.battle_actors.include?(self)
  237.   end
  238.   def battle_disabled=(bool)
  239.     @battle_disabled = bool
  240.     $game_party.battle_actors.delete(self) if bool
  241.   end
  242. end

  243. class Game_Player
  244.   #--------------------------------------------------------------------------
  245.   # ● 刷新
  246.   #--------------------------------------------------------------------------
  247.   def refresh
  248.     # 同伴人数为 0 的情况下
  249.     if $game_party.actors.size == 0 or $game_party.leader == nil
  250.       # 清除角色的文件名及对像
  251.       @character_name = ""
  252.       @character_hue = 0
  253.       # 分支结束
  254.       return
  255.     end
  256.     # 获取带头的角色
  257.     if $game_party.leader != nil
  258.       actor = $game_party.leader
  259.       # 设置角色的文件名及对像
  260.       @character_name = actor.character_name
  261.       @character_hue = actor.character_hue
  262.       # 初始化不透明度和合成方式子
  263.       @opacity = 255
  264.       @blend_type = 0
  265.     end
  266.   end
  267. end

  268. class Game_BattleAction
  269.   attr_accessor :reserved_actor_id
  270.   unless method_defined? :rb_clear_20150422
  271.     alias rb_clear_20150422 clear
  272.     def clear
  273.       rb_clear_20150422
  274.       @reserved_actor_id = 0
  275.     end
  276.   end
  277. end

  278. class Window_Base < Window
  279.   def draw_actor_battle_position(actor, x, y)
  280.     if actor.leader?
  281.       if actor.active
  282.         text = "领队|出战"
  283.       else
  284.         text = "领队"
  285.       end
  286.       color = knockout_color
  287.     else
  288.       color = disabled_color
  289.       if actor.battle_disabled
  290.         text = "无法出战"
  291.       elsif actor.active
  292.         text = "出战"
  293.         color = normal_color
  294.       else
  295.         text = "待机"
  296.       end
  297.     end
  298.     self.contents.font.color = color
  299.     self.contents.draw_text(x, y, 120, 32, text)
  300.   end
  301. end

  302. #==============================================================================
  303. # ■ Window_Selectable
  304. #------------------------------------------------------------------------------
  305. #  拥有光标的移动以及滚动功能的窗口类。
  306. #==============================================================================

  307. class Window_Selectable < Window_Base
  308.   #--------------------------------------------------------------------------
  309.   # ● 定义实例变量
  310.   #--------------------------------------------------------------------------
  311.   attr_accessor :row_height               # 行高
  312.   #--------------------------------------------------------------------------
  313.   # ● 初始画对像
  314.   #     x      : 窗口的 X 坐标
  315.   #     y      : 窗口的 Y 坐标
  316.   #     width  : 窗口的宽
  317.   #     height : 窗口的高
  318.   #     row_height : 行高 默认是32
  319.   #--------------------------------------------------------------------------
  320.   alias rb_initialize_20150421 initialize
  321.   def initialize(x, y, width, height, row_height = 32)
  322.     @row_height = row_height
  323.     rb_initialize_20150421(x, y, width, height)
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● 获取开头行
  327.   #--------------------------------------------------------------------------
  328.   def top_row
  329.     # 将窗口内容的传送源 Y 坐标、1 行的高 @row_height 等分
  330.     return self.oy / @row_height
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● 设置开头行
  334.   #     row : 显示开头的行
  335.   #--------------------------------------------------------------------------
  336.   def top_row=(row)
  337.     # row 未满 0 的场合更正为 0
  338.     if row < 0
  339.       row = 0
  340.     end
  341.     # row 超过 row_max - 1 的情况下更正为 row_max - 1
  342.     if row > row_max - 1
  343.       row = row_max - 1
  344.     end
  345.     # row 1 行高的 @row_height 倍、窗口内容的传送源 Y 坐标
  346.     self.oy = row * @row_height
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● 获取 1 页可以显示的行数
  350.   #--------------------------------------------------------------------------
  351.   def page_row_max
  352.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 @row_height
  353.     return (self.height - 32) / @row_height
  354.   end
  355.   #--------------------------------------------------------------------------
  356.   # ● 更新光标举行
  357.   #--------------------------------------------------------------------------
  358.   def update_cursor_rect
  359.     # 光标位置不满 0 的情况下
  360.     if @index < 0
  361.       self.cursor_rect.empty
  362.       return
  363.     end
  364.     # 获取当前的行
  365.     row = @index / @column_max
  366.     # 当前行被显示开头行前面的情况下
  367.     if row < self.top_row
  368.       # 从当前行向开头行滚动
  369.       self.top_row = row
  370.     end
  371.     # 当前行被显示末尾行之后的情况下
  372.     if row > self.top_row + (self.page_row_max - 1)
  373.       # 从当前行向末尾滚动
  374.       self.top_row = row - (self.page_row_max - 1)
  375.     end
  376.     # 计算光标的宽
  377.     cursor_width = self.width / @column_max - 32
  378.     # 计算光标坐标
  379.     x = @index % @column_max * (cursor_width + 32)
  380.     y = @index / @column_max * @row_height - self.oy
  381.     # 更新国标矩形
  382.     self.cursor_rect.set(x, y, cursor_width, @row_height)
  383.   end
  384. end

  385. class Window_MenuStatus
  386.   def initialize
  387.     super(0, 0, 480, 480, 112)
  388.     refresh
  389.     self.active = false
  390.     self.index = -1
  391.   end
  392.   def refresh
  393.     if self.contents != nil
  394.       self.contents.dispose
  395.       self.contents = nil
  396.     end
  397.     @item_max = $game_party.actors.size
  398.     self.contents = Bitmap.new(width - 32, @item_max == 0 ? 32 : @item_max * 112)
  399.     for i in 0...$game_party.actors.size
  400.       x = 64
  401.       y = i * 112
  402.       actor = $game_party.actors[i]
  403.       draw_actor_graphic(actor, x - 40, y + 80)
  404.       draw_actor_name(actor, x, y)
  405.       draw_actor_class(actor, x + 144, y)
  406.       draw_actor_level(actor, x, y + 32)
  407.       draw_actor_state(actor, x + 90, y + 32)
  408.       draw_actor_exp(actor, x, y + 64)
  409.       draw_actor_hp(actor, x + 236, y + 32)
  410.       draw_actor_sp(actor, x + 236, y + 64)
  411.       draw_actor_battle_position(actor, x + 236, y)
  412.     end
  413.   end
  414.   def update_cursor_rect
  415.     super
  416.   end
  417. end

  418. class Window_Target
  419.   def initialize
  420.     super(0, 0, 336, 480, 112)
  421.     self.z += 10
  422.     @item_max = $game_party.actors.size
  423.     self.contents = Bitmap.new(width - 32, @item_max == 0 ? 32 : @item_max * 112)
  424.     refresh
  425.   end
  426.   def update_cursor_rect
  427.     super
  428.   end
  429. end

  430. class Window_ReservedActors < Window_Selectable
  431.   def initialize
  432.     super(0, 64, 640, 256, 112)
  433.     self.opacity = 160
  434.     self.index = 0
  435.     self.active = true
  436.     @column_max = 2
  437.     refresh
  438.   end
  439.   def actor
  440.     return @data[self.index]
  441.   end
  442.   def refresh
  443.     if self.contents != nil
  444.       self.contents.dispose
  445.       self.contents = nil
  446.     end
  447.     @data = []
  448.     $game_party.all_actors.each do |actor|
  449.       @data << actor unless actor.active || actor.battle_disabled
  450.     end
  451.     @item_max = @data.size
  452.     if @item_max > 0
  453.       self.contents = Bitmap.new (width - 32, (@item_max + 1) / 2 * 128)
  454.       @data.each_with_index do |actor, index|
  455.         x = 4 + index % 2 * (288 + 32)
  456.         y = index / 2 * 112
  457.         draw_actor_graphic(actor, x + 16, y + 80)
  458.         draw_actor_hp(actor, x + 48, y + 20)
  459.         draw_actor_sp(actor, x + 48, y + 52)
  460.       end
  461.     end
  462.   end
  463.   def update_help
  464.     # 帮助窗口显示角色的状态
  465.     self.actor == nil ? @help_window.set_text("") : @help_window.set_actor(self.actor)
  466.   end
  467. end

  468. class Scene_Menu
  469.   unless method_defined? :rb_update_command_20150421
  470.     alias rb_update_command_20150421 update_command
  471.     def update_command
  472.       if Input.trigger?(Input::X)
  473.         $game_system.se_play($data_system.decision_se)
  474.         @command_window.active = false
  475.         @status_window.active = true
  476.         @status_window.index = 0
  477.         @leader_adjust = true
  478.         return
  479.       end
  480.       if Input.trigger?(Input::Y)
  481.         $game_system.se_play($data_system.decision_se)
  482.         @command_window.active = false
  483.         @status_window.active = true
  484.         @status_window.index = 0
  485.         @battler_adjust = true
  486.         return
  487.       end
  488.       rb_update_command_20150421
  489.     end
  490.   end
  491.   unless method_defined? :rb_update_status_20150421
  492.     alias rb_update_status_20150421 update_status
  493.     def update_status
  494.       if @leader_adjust
  495.         update_leader
  496.         return
  497.       end
  498.       if @battler_adjust
  499.         update_battler
  500.         return
  501.       end
  502.       rb_update_status_20150421
  503.     end
  504.   end
  505.   def update_leader
  506.     if Input.trigger?(Input::B)
  507.       $game_system.se_play($data_system.cancel_se)
  508.       @leader_adjust = false
  509.       @status_window.active = false
  510.       @status_window.index = -1
  511.       @command_window.active = true
  512.       return
  513.     end
  514.     if Input.trigger?(Input::C)
  515.       if $game_party.actors.size == 0
  516.         $game_system.se_play($data_system.buzzer_se)
  517.       else
  518.         $game_system.se_play($data_system.decision_se)
  519.         $game_party.leader = $game_party.actors[@status_window.index]
  520.         @status_window.refresh
  521.       end
  522.     end
  523.   end
  524.   def update_battler
  525.     if Input.trigger?(Input::B)
  526.       $game_system.se_play($data_system.cancel_se)
  527.       @battler_adjust = false
  528.       @status_window.active = false
  529.       @status_window.index = -1
  530.       @command_window.active = true
  531.       return
  532.     end
  533.     if Input.trigger?(Input::C)
  534.       actor = $game_party.actors[@status_window.index]
  535.       if actor == nil || actor.battle_disabled ||
  536.         (actor.active && $game_party.battle_actors.size == 1) ||
  537.         (!actor.active && $game_party.battle_actors.size == 4)
  538.         $game_system.se_play($data_system.buzzer_se)
  539.       else
  540.         $game_system.se_play($data_system.decision_se)
  541.         actor.active ? $game_party.battle_actors.delete(actor) : $game_party.battle_actors.push(actor)
  542.         @status_window.refresh
  543.       end
  544.     end
  545.   end
  546. end

  547. class Scene_Battle
  548.   def generate_modified_command_window
  549.     if @actor_command_window != nil
  550.       @actor_command_window.dispose
  551.       @actor_command_window = nil
  552.     end
  553.     s1 = $data_system.words.attack
  554.     s2 = $data_system.words.skill
  555.     s3 = $data_system.words.guard
  556.     s4 = $data_system.words.item
  557.     s5 = RB::Party::Words_Swap
  558.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
  559.     @actor_command_window.y = 128
  560.     @actor_command_window.back_opacity = 160
  561.     @actor_command_window.active = false
  562.     @actor_command_window.visible = false
  563.     @modified_generated = true
  564.   end
  565.   unless method_defined? :rb_phase3_setup_command_window_20150422
  566.     alias rb_phase3_setup_command_window_20150422 phase3_setup_command_window
  567.     def phase3_setup_command_window
  568.       generate_modified_command_window unless @modified_generated
  569.       rb_phase3_setup_command_window_20150422
  570.     end
  571.   end
  572.   def update_phase3_basic_command
  573.     # 按下 B 键的情况下
  574.     if Input.trigger?(Input::B)
  575.       # 演奏取消 SE
  576.       $game_system.se_play($data_system.cancel_se)
  577.       # 转向前一个角色的指令输入
  578.       phase3_prior_actor
  579.       return
  580.     end
  581.     # 按下 C 键的情况下
  582.     if Input.trigger?(Input::C)
  583.       # 角色指令窗口光标位置分之
  584.       case @actor_command_window.index
  585.       when 0  # 攻击
  586.         # 演奏确定 SE
  587.         $game_system.se_play($data_system.decision_se)
  588.         # 设置行动
  589.         @active_battler.current_action.kind = 0
  590.         @active_battler.current_action.basic = 0
  591.         # 开始选择敌人
  592.         start_enemy_select
  593.       when 1  # 特技
  594.         # 演奏确定 SE
  595.         $game_system.se_play($data_system.decision_se)
  596.         # 设置行动
  597.         @active_battler.current_action.kind = 1
  598.         # 开始选择特技
  599.         start_skill_select
  600.       when 2  # 防御
  601.         # 演奏确定 SE
  602.         $game_system.se_play($data_system.decision_se)
  603.         # 设置行动
  604.         @active_battler.current_action.kind = 0
  605.         @active_battler.current_action.basic = 1
  606.         # 转向下一位角色的指令输入
  607.         phase3_next_actor
  608.       when 3  # 物品
  609.         # 演奏确定 SE
  610.         $game_system.se_play($data_system.decision_se)
  611.         # 设置行动
  612.         @active_battler.current_action.kind = 2
  613.         # 开始选择物品
  614.         start_item_select
  615.       when 4  # 换人
  616.         $game_system.se_play($data_system.decision_se)
  617.         @active_battler.current_action.kind = 3
  618.         start_reserved_actor_select
  619.       end
  620.       return
  621.     end
  622.   end
  623.   unless method_defined? :rb_update_phase3_20150422
  624.     alias rb_update_phase3_20150422 update_phase3
  625.     def update_phase3
  626.       if @actor_window != nil
  627.         update_phase3_reserved_actor_select
  628.         return
  629.       end
  630.       rb_update_phase3_20150422
  631.     end
  632.   end
  633.   def start_reserved_actor_select
  634.     # 生成特技窗口
  635.     @actor_window = Window_ReservedActors.new
  636.     # 关联帮助窗口
  637.     @actor_window.help_window = @help_window
  638.     @help_window.visible = true
  639.     # 无效化角色指令窗口
  640.     @actor_command_window.active = false
  641.     @actor_command_window.visible = false
  642.   end
  643.   def end_reserved_actor_select
  644.     # 释放特技窗口
  645.     @actor_window.dispose
  646.     @actor_window = nil
  647.     # 隐藏帮助窗口
  648.     @help_window.visible = false
  649.     # 有效化角色指令窗口
  650.     @actor_command_window.active = true
  651.     @actor_command_window.visible = true
  652.   end
  653.   def update_phase3_reserved_actor_select
  654.     @actor_window.visible = true
  655.     # 刷新特技窗口
  656.     @actor_window.update
  657.     # 按下 B 键的情况下
  658.     if Input.trigger?(Input::B)
  659.       # 演奏取消 SE
  660.       $game_system.se_play($data_system.cancel_se)
  661.       # 结束特技选择
  662.       end_reserved_actor_select
  663.       return
  664.     end
  665.     # 按下 C 键的情况下
  666.     if Input.trigger?(Input::C)
  667.       # 获取特技选择窗口现在选择的特技的数据
  668.       @reserved_actor = @actor_window.actor
  669.       # 无法使用的情况下
  670.       if @reserved_actor == nil
  671.         # 演奏冻结 SE
  672.         $game_system.se_play($data_system.buzzer_se)
  673.         return
  674.       end
  675.       # 演奏确定 SE
  676.       $game_system.se_play($data_system.decision_se)
  677.       # 设置行动
  678.       @active_battler.current_action.reserved_actor_id = @reserved_actor.id
  679.       # 设置特技窗口为不可见状态
  680.       @actor_window.visible = false
  681.       end_reserved_actor_select
  682.       phase3_next_actor
  683.       return
  684.     end
  685.   end
  686.   def update_phase4_step2
  687.     # 如果不是强制行动
  688.     unless @active_battler.current_action.forcing
  689.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  690.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  691.         # 设置行动为攻击
  692.         @active_battler.current_action.kind = 0
  693.         @active_battler.current_action.basic = 0
  694.       end
  695.       # 限制为 [不能行动] 的情况下
  696.       if @active_battler.restriction == 4
  697.         # 清除行动强制对像的战斗者
  698.         $game_temp.forcing_battler = nil
  699.         # 移至步骤 1
  700.         @phase4_step = 1
  701.         return
  702.       end
  703.     end
  704.     # 清除对像战斗者
  705.     @target_battlers = []
  706.     # 行动种类分支
  707.     case @active_battler.current_action.kind
  708.     when 0  # 基本
  709.       make_basic_action_result
  710.     when 1  # 特技
  711.       make_skill_action_result
  712.     when 2  # 物品
  713.       make_item_action_result
  714.     when 3  # 换人
  715.       make_swap_action_result
  716.     end
  717.     # 移至步骤 3
  718.     if @phase4_step == 2
  719.       @phase4_step = 3
  720.     end
  721.   end
  722.   def make_swap_action_result
  723.     # 获取角色
  724.     @reserved_actor = $game_actors[@active_battler.current_action.reserved_actor_id]
  725.     # 无法替换的情况下
  726.     if @reserved_actor == nil || @reserved_actor.active
  727.       # 移至步骤 1
  728.       @phase4_step = 1
  729.       return
  730.     end
  731.     # 在帮助窗口显示文字
  732.     text = "与#{@reserved_actor.name}交换"
  733.     @help_window.set_text(text, 1)
  734.     # 设置动画 ID
  735.     @animation1_id = 0
  736.     index = $game_party.actors.index(@active_battler)
  737.     $game_party.actors[index] = @reserved_actor
  738.   end
  739.   unless method_defined? :rb_start_phase5_20150422
  740.     alias rb_start_phase5_20150422 start_phase5
  741.     def start_phase5
  742.       $game_temp.gain_exp_flag = true
  743.       rb_start_phase5_20150422
  744.       $game_temp.gain_exp_flag = false
  745.     end
  746.   end
  747. end

  748.    
复制代码




战斗头像脚本


  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================

  4. # ————————————————————————————————————
  5. # ▼▲▼ XRXS_BP 7. バトルステータス?クリアデザイン ver.1.03 ▼▲▼
  6. # by 桜雅 在土
  7. #==============================================================================
  8. # ■ Window_BattleStatus
  9. #==============================================================================
  10. class Window_BattleStatus < Window_Base
  11. #--------------------------------------------------------------------------
  12. # ● 公開インスタンス変数
  13. #--------------------------------------------------------------------------
  14. attr_accessor :update_cp_only # CPメーターのみの更新
  15. #--------------------------------------------------------------------------
  16. # ● オブジェクト初期化
  17. #--------------------------------------------------------------------------
  18. alias xrxs_bp7_initialize initialize
  19. def initialize
  20. # 初期化
  21. @previous_hp = []
  22. @previous_sp = []
  23. # 呼び戻す
  24. xrxs_bp7_initialize
  25. ##############################修改############################################
  26. @sta_back = []
  27. for actor_index in 1..$game_party.actors.size
  28.   actor = $game_party.actors[actor_index - 1]
  29. @sta_back[actor_index] = Sprite.new
  30. @sta_back[actor_index].bitmap = Bitmap.new("Graphics/Characters/Heads/"+ actor.name + ".png")
  31. @sta_back[actor_index].x = (actor_index- 1)* 160 - 5 #在这里调整图片x坐标
  32. @sta_back[actor_index].y = 243#在这里调整图片y坐标
  33. @sta_back[actor_index].z = self.z+1#在这里调整图片优先级
  34. end
  35. ##############################修改############################################
  36. # ↓Full-Viewの場合は下二行の # を消してください。
  37. #self.opacity = 0
  38. #self.back_opacity = 0
  39. ##############################修改############################################
  40. refresh
  41. ##############################修改############################################
  42. end
  43. ##############################修改############################################
  44. def dispose
  45.    super  
  46.    for actor_index in 1..$game_party.actors.size
  47.      next if @sta_back[actor_index].nil?   
  48.       @sta_back[actor_index].bitmap.dispose
  49.       @sta_back[actor_index].dispose
  50.    end
  51. end
  52. ##############################修改############################################
  53. #--------------------------------------------------------------------------
  54. # ● リフレッシュ
  55. #--------------------------------------------------------------------------
  56. alias xrxs_bp7_refresh refresh
  57. def refresh
  58. # CPメーターの更新のみ の場合
  59. if @update_cp_only
  60. xrxs_bp7_refresh
  61. return
  62. end
  63. # 変更するものがない場合、飛ばす
  64. @item_max = $game_party.actors.size
  65. bool = false
  66. for i in 0...@item_max
  67. actor = $game_party.actors[i]
  68. if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
  69. bool = true
  70. end
  71. end
  72. return if bool == false
  73. # 描写を開始
  74. self.contents.clear
  75. for i in 0...@item_max
  76. actor = $game_party.actors[i]
  77. actor_x = i * 160 + 29
  78. # 歩行キャラグラフィックの描写
  79. #draw_actor_graphic(actor, actor_x - 9, 116)

  80. # HP/SPメーターの描写
  81. draw_actor_hp_meter_line(actor, actor_x, 47, 96, 12)
  82. draw_actor_sp_meter_line(actor, actor_x, 79, 96, 12)
  83. # HP数値の描写
  84. self.contents.font.size = 24 # HP/SP数値の文字の大きさ
  85. self.contents.font.color = Color.new(0,0,0,192)
  86. self.contents.draw_text(actor_x, 35, 96, 24, actor.hp.to_s, 2)
  87. self.contents.font.color = actor.hp == 0 ? knockout_color :
  88. actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  89. self.contents.draw_text(actor_x-2, 33, 96, 24, actor.hp.to_s, 2)
  90. # SP数値の描写
  91. self.contents.font.color = Color.new(0,0,0,192)
  92. self.contents.draw_text(actor_x, 72, 96, 24, actor.sp.to_s, 2)
  93. self.contents.font.color = actor.sp == 0 ? knockout_color :
  94. actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  95. self.contents.draw_text(actor_x-2, 70, 96, 24, actor.sp.to_s, 2)
  96. # 用語「HP」と用語「SP」の描写
  97. self.contents.font.size = 20 # 用語「HP/SP」の文字の大きさ
  98. draw_actor_name(actor, actor_x ,3 )

  99. self.contents.font.color = Color.new(0,0,0,192)
  100. self.contents.draw_text(actor_x+2, 27, 196, 24, $data_system.words.hp)
  101. self.contents.draw_text(actor_x+2, 59, 196, 24, $data_system.words.sp)
  102. self.contents.font.color = system_color # 用語「HP/SP」の文字の色
  103. self.contents.draw_text(actor_x, 25, 196, 24, $data_system.words.hp)
  104. self.contents.draw_text(actor_x, 57, 196, 24, $data_system.words.sp)
  105. draw_actor_state(actor, actor_x, 100)
  106. # 値を更新
  107. @previous_hp[i] = actor.hp
  108. @previous_hp[i] = actor.hp
  109. end
  110. end
  111. end
  112. #==============================================================================
  113. # ■ Window_Base
  114. #==============================================================================
  115. class Window_Base < Window
  116. #--------------------------------------------------------------------------
  117. # ● HPメーター の描画
  118. #--------------------------------------------------------------------------
  119. def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
  120. w = width * actor.hp / [actor.maxhp,1].max
  121. hp_color_1 = Color.new(255, 0, 0, 192)
  122. hp_color_2 = Color.new(255, 255, 0, 192)
  123. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  124. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  125. x -= 1
  126. y += (height/4).floor
  127. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  128. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  129. x -= 1
  130. y += (height/4).ceil
  131. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  132. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  133. x -= 1
  134. y += (height/4).ceil
  135. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  136. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  137. end
  138. #--------------------------------------------------------------------------
  139. # ● SPメーター の描画
  140. #--------------------------------------------------------------------------
  141. def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
  142. w = width * actor.sp / [actor.maxsp,1].max
  143. hp_color_1 = Color.new( 0, 0, 255, 192)
  144. hp_color_2 = Color.new( 0, 255, 255, 192)
  145. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  146. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  147. x -= 1
  148. y += (height/4).floor
  149. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  150. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  151. x -= 1
  152. y += (height/4).ceil
  153. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  154. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  155. x -= 1
  156. y += (height/4).ceil
  157. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  158. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  159. end
  160. #--------------------------------------------------------------------------
  161. # ● 名前の描画
  162. #--------------------------------------------------------------------------
  163. alias xrxs_bp7_draw_actor_name draw_actor_name
  164. def draw_actor_name(actor, x, y)
  165. xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  166. end
  167. #--------------------------------------------------------------------------
  168. # ● ステートの描画
  169. #--------------------------------------------------------------------------
  170. alias xrxs_bp7_draw_actor_state draw_actor_state
  171. def draw_actor_state(actor, x, y, width = 120)  
  172. xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  173. end
  174. #--------------------------------------------------------------------------
  175. # ● HP の描画
  176. #--------------------------------------------------------------------------
  177. alias xrxs_bp7_draw_actor_hp draw_actor_hp
  178. def draw_actor_hp(actor, x, y, width = 144)
  179. xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  180. end
  181. #--------------------------------------------------------------------------
  182. # ● SP の描画
  183. #--------------------------------------------------------------------------
  184. alias xrxs_bp7_draw_actor_sp draw_actor_sp
  185. def draw_actor_sp(actor, x, y, width = 144)
  186. xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  187. end
  188. end
  189. #==============================================================================
  190. # ■ Scene_Battle
  191. #==============================================================================
  192. class Scene_Battle
  193. #--------------------------------------------------------------------------
  194. # ● フレーム更新
  195. #--------------------------------------------------------------------------
  196. alias xrxs_bp7_update update
  197. def update
  198. xrxs_bp7_update
  199. # メッセージウィンドウ表示中の場合
  200. if $game_temp.message_window_showing
  201. @status_window.update_cp_only = true
  202. else
  203. @status_window.update_cp_only = false
  204. end
  205. end
  206. end
  207. #==============================================================================
  208. # ◇ 外部ライブラリ
  209. #==============================================================================
  210. class Window_Base
  211. #--------------------------------------------------------------------------
  212. # ● ライン描画 軽量版 by 桜雅 在土
  213. #--------------------------------------------------------------------------
  214. def draw_lineght(start_x, start_y, end_x, end_y, start_color)
  215. # 描写距離の計算。大きめに直角時の長さ。
  216. distance = (start_x - end_x).abs + (start_y - end_y).abs
  217. # 描写開始
  218. for i in 1..distance
  219. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  220. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  221. self.contents.set_pixel(x, y, start_color)
  222. end
  223. end
  224. #--------------------------------------------------------------------------
  225. # ● ライン描画 by 桜雅 在土
  226. #--------------------------------------------------------------------------
  227. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  228. # 描写距離の計算。大きめに直角時の長さ。
  229. distance = (start_x - end_x).abs + (start_y - end_y).abs
  230. # 描写開始
  231. if end_color == start_color
  232. for i in 1..distance
  233. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  234. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  235. if width == 1
  236. self.contents.set_pixel(x, y, start_color)
  237. else
  238. self.contents.fill_rect(x, y, width, width, start_color)
  239. end
  240. end
  241. else
  242. for i in 1..distance
  243. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  244. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  245. r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  246. g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  247. b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  248. a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  249. if width == 1
  250. self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  251. else
  252. self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  253. end
  254. end
  255. end
  256. end
  257. end

  258. #==============================================================================
  259. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  260. #==============================================================================
复制代码

评分

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

查看全部评分

甘泉幻想物语 试玩版4.0
https://rpg.blue/forum.php?mod=viewthread&tid=369490&page=1&extra=#pid2534710
梦石
0
星屑
9557
在线时间
5074 小时
注册时间
2013-6-21
回帖
3459

开拓者贵宾剧作品鉴家

发表于 2015-9-12 09:52:50 | 显示全部楼层
本帖最后由 RyanBern 于 2015-9-12 20:08 编辑
  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. module RB
  32. end

  33. module RB::Party
  34.   # “换人”命令的术语
  35.   Words_Swap = "换人"

  36.   # 替补队员是否能在战斗胜利后获得 EXP 奖励,设置为 true 时可以获得奖励,设置
  37.   # 为 false 时则不能。
  38.   Get_Exp_Reserve = true
  39. end

  40. class Game_Temp
  41.   attr_accessor :gain_exp_flag
  42.   attr_accessor :battle_swap
  43. end

  44. class Game_Party
  45.   attr_reader :leader
  46.   attr_reader :battle_actors
  47.   alias old_ini initialize
  48.   def initialize
  49.     @leader = nil
  50.     @battle_actors = []
  51.     old_ini
  52.   end
  53.   def leader=(leader)
  54.     @leader = leader
  55.     $game_player.refresh
  56.     $game_map.need_refresh = true
  57.   end
  58.   def set_leader(actor_id)
  59.     self.leader = $game_actors[actor_id]
  60.   end
  61.   def actors
  62.     all_flag = !$game_temp.in_battle || (RB::Party::Get_Exp_Reserve && $game_temp.gain_exp_flag)
  63.     return all_flag ? @actors : @battle_actors
  64.   end
  65.   def all_actors
  66.     return @actors
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 加入同伴
  70.   #     actor_id : 角色 ID
  71.   #--------------------------------------------------------------------------
  72.   def add_actor(actor_id)
  73.     # 获取角色
  74.     actor = $game_actors[actor_id]
  75.     # 同伴人数未满 4 人、本角色不在队伍中的情况下
  76.     unless @actors.include?(actor)
  77.       # 添加角色
  78.       @actors.push(actor)
  79.       @battle_actors.push(actor) if @battle_actors.size < 4
  80.       self.leader = actor if self.leader.nil?
  81.       # 还原主角
  82.       $game_player.refresh
  83.     end
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 角色离开
  87.   #     actor_id : 角色 ID
  88.   #--------------------------------------------------------------------------
  89.   def remove_actor(actor_id)
  90.     actor = $game_actors[actor_id]
  91.     # 删除角色
  92.     @actors.delete(actor)
  93.     @battle_actors.delete(actor)
  94.     self.leader = self.actors[0] if self.leader == actor
  95.     # 还原主角
  96.     $game_player.refresh
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 设置初期同伴
  100.   #--------------------------------------------------------------------------
  101.   def setup_starting_members
  102.     @actors = []
  103.     @battle_actors = []
  104.     for i in $data_system.party_members
  105.       @actors.push($game_actors[i])
  106.       @battle_actors.push($game_actors[i]) if @battle_actors.size < 4
  107.     end
  108.     self.leader = @actors[0]
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 设置战斗测试用同伴
  112.   #--------------------------------------------------------------------------
  113.   def setup_battle_test_members
  114.     @actors = []
  115.     @battle_actors = []
  116.     for battler in $data_system.test_battlers
  117.       actor = $game_actors[battler.actor_id]
  118.       actor.level = battler.level
  119.       gain_weapon(battler.weapon_id, 1)
  120.       gain_armor(battler.armor1_id, 1)
  121.       gain_armor(battler.armor2_id, 1)
  122.       gain_armor(battler.armor3_id, 1)
  123.       gain_armor(battler.armor4_id, 1)
  124.       actor.equip(0, battler.weapon_id)
  125.       actor.equip(1, battler.armor1_id)
  126.       actor.equip(2, battler.armor2_id)
  127.       actor.equip(3, battler.armor3_id)
  128.       actor.equip(4, battler.armor4_id)
  129.       actor.recover_all
  130.       @actors.push(actor)
  131.       @battle_actors.push(actor)
  132.     end
  133.     @items = {}
  134.     for i in 1...$data_items.size
  135.       if $data_items[i].name != ""
  136.         occasion = $data_items[i].occasion
  137.         if occasion == 0 or occasion == 1
  138.           @items[i] = 99
  139.         end
  140.       end
  141.     end
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 同伴成员的还原
  145.   #--------------------------------------------------------------------------
  146.   def refresh
  147.     # 游戏数据载入后角色对像直接从 $game_actors
  148.     # 分离。
  149.     # 回避由于载入造成的角色再设置的问题。
  150.     new_actors = []
  151.     new_battle_actors = []
  152.     @actors.each do |actor|
  153.       if $data_actors[actor.id] != nil
  154.         new_actors.push($game_actors[actor.id])
  155.       end
  156.     end
  157.     @battle_actors ||= []
  158.     @battle_actors.each do |actor|
  159.       if $data_actors[actor.id] != nil
  160.         new_battle_actors.push($game_actors[actor.id])
  161.       end
  162.     end
  163.     @actors = new_actors
  164.     @battle_actors = new_battle_actors
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 全灭判定
  168.   #--------------------------------------------------------------------------
  169.   def all_dead?
  170.     # 同伴人数为 0 的情况下
  171.     if self.actors.size == 0
  172.       return false
  173.     end
  174.     # 同伴中无人 HP 在 0 以上
  175.     for actor in self.actors
  176.       if actor.hp > 0
  177.         return false
  178.       end
  179.     end
  180.     # 全灭
  181.     return true
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 对像角色的随机确定
  185.   #     hp0 : 限制为 HP 0 的角色
  186.   #--------------------------------------------------------------------------
  187.   def random_target_actor(hp0 = false)
  188.     # 初始化轮流
  189.     roulette = []
  190.     # 循环
  191.     for actor in @battle_actors
  192.       # 符合条件的场合
  193.       if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
  194.         # 获取角色职业的位置 [位置]
  195.         position = $data_classes[actor.class_id].position
  196.         # 前卫的话 n = 4、中卫的话 n = 3、后卫的话 n = 2
  197.         n = 4 - position
  198.         # 添加角色的轮流 n 回
  199.         n.times do
  200.           roulette.push(actor)
  201.         end
  202.       end
  203.     end
  204.     # 轮流大小为 0 的情况
  205.     if roulette.size == 0
  206.       return nil
  207.     end
  208.     # 转轮盘赌,决定角色
  209.     return roulette[rand(roulette.size)]
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 对像角色的顺序确定
  213.   #     actor_index : 角色索引
  214.   #--------------------------------------------------------------------------
  215.   def smooth_target_actor(actor_index)
  216.     # 取得对像
  217.     actor = @battle_actors[actor_index]
  218.     # 对像存在的情况下
  219.     if actor != nil and actor.exist?
  220.       return actor
  221.     end
  222.     # 循环
  223.     for actor in @actors
  224.       # 对像存在的情况下
  225.       if actor.exist?
  226.         return actor
  227.       end
  228.     end
  229.   end
  230. end

  231. class Game_Actor
  232.   attr_reader :battle_disabled
  233.   def leader?
  234.     return self == $game_party.leader
  235.   end
  236.   def active
  237.     return $game_party.battle_actors.include?(self)
  238.   end
  239.   def battle_disabled=(bool)
  240.     @battle_disabled = bool
  241.     $game_party.battle_actors.delete(self) if bool
  242.   end
  243. end

  244. class Game_BattleAction
  245.   attr_accessor :reserved_actor_id
  246.   unless method_defined? :rb_clear_20150422
  247.     alias rb_clear_20150422 clear
  248.     def clear
  249.       rb_clear_20150422
  250.       @reserved_actor_id = 0
  251.     end
  252.   end
  253. end

  254. class Window_Base < Window
  255.   def draw_actor_battle_position(actor, x, y)
  256.     color = disabled_color
  257.     if actor.battle_disabled
  258.       text = "无法出战"
  259.     elsif actor.active
  260.       text = "出战"
  261.       color = normal_color
  262.     else
  263.       text = "待机"
  264.     end
  265.     self.contents.font.color = color
  266.     self.contents.draw_text(x, y, 120, 32, text)
  267.   end
  268. end

  269. #==============================================================================
  270. # ■ Window_Selectable
  271. #------------------------------------------------------------------------------
  272. #  拥有光标的移动以及滚动功能的窗口类。
  273. #==============================================================================

  274. class Window_Selectable < Window_Base
  275.   #--------------------------------------------------------------------------
  276.   # ● 定义实例变量
  277.   #--------------------------------------------------------------------------
  278.   attr_accessor :row_height               # 行高
  279.   #--------------------------------------------------------------------------
  280.   # ● 初始画对像
  281.   #     x      : 窗口的 X 坐标
  282.   #     y      : 窗口的 Y 坐标
  283.   #     width  : 窗口的宽
  284.   #     height : 窗口的高
  285.   #     row_height : 行高 默认是32
  286.   #--------------------------------------------------------------------------
  287.   alias rb_initialize_20150421 initialize
  288.   def initialize(x, y, width, height, row_height = 32)
  289.     @row_height = row_height
  290.     rb_initialize_20150421(x, y, width, height)
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ● 获取开头行
  294.   #--------------------------------------------------------------------------
  295.   def top_row
  296.     # 将窗口内容的传送源 Y 坐标、1 行的高 @row_height 等分
  297.     return self.oy / @row_height
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● 设置开头行
  301.   #     row : 显示开头的行
  302.   #--------------------------------------------------------------------------
  303.   def top_row=(row)
  304.     # row 未满 0 的场合更正为 0
  305.     if row < 0
  306.       row = 0
  307.     end
  308.     # row 超过 row_max - 1 的情况下更正为 row_max - 1
  309.     if row > row_max - 1
  310.       row = row_max - 1
  311.     end
  312.     # row 1 行高的 @row_height 倍、窗口内容的传送源 Y 坐标
  313.     self.oy = row * @row_height
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # ● 获取 1 页可以显示的行数
  317.   #--------------------------------------------------------------------------
  318.   def page_row_max
  319.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 @row_height
  320.     return (self.height - 32) / @row_height
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 更新光标举行
  324.   #--------------------------------------------------------------------------
  325.   def update_cursor_rect
  326.     # 光标位置不满 0 的情况下
  327.     if @index < 0
  328.       self.cursor_rect.empty
  329.       return
  330.     end
  331.     # 获取当前的行
  332.     row = @index / @column_max
  333.     # 当前行被显示开头行前面的情况下
  334.     if row < self.top_row
  335.       # 从当前行向开头行滚动
  336.       self.top_row = row
  337.     end
  338.     # 当前行被显示末尾行之后的情况下
  339.     if row > self.top_row + (self.page_row_max - 1)
  340.       # 从当前行向末尾滚动
  341.       self.top_row = row - (self.page_row_max - 1)
  342.     end
  343.     # 计算光标的宽
  344.     cursor_width = self.width / @column_max - 32
  345.     # 计算光标坐标
  346.     x = @index % @column_max * (cursor_width + 32)
  347.     y = @index / @column_max * @row_height - self.oy
  348.     # 更新国标矩形
  349.     self.cursor_rect.set(x, y, cursor_width, @row_height)
  350.   end
  351. end

  352. class Window_MenuStatus
  353.   def initialize
  354.     super(0, 0, 480, 480, 112)
  355.     refresh
  356.     self.active = false
  357.     self.index = -1
  358.   end
  359.   def refresh
  360.     if self.contents != nil
  361.       self.contents.dispose
  362.       self.contents = nil
  363.     end
  364.     @item_max = $game_party.actors.size
  365.     self.contents = Bitmap.new(width - 32, @item_max == 0 ? 32 : @item_max * 112)
  366.     for i in 0...$game_party.actors.size
  367.       x = 64
  368.       y = i * 112
  369.       actor = $game_party.actors[i]
  370.       draw_actor_graphic(actor, x - 40, y + 80)
  371.       draw_actor_name(actor, x, y)
  372.       draw_actor_class(actor, x + 144, y)
  373.       draw_actor_level(actor, x, y + 32)
  374.       draw_actor_state(actor, x + 90, y + 32)
  375.       draw_actor_exp(actor, x, y + 64)
  376.       draw_actor_hp(actor, x + 236, y + 32)
  377.       draw_actor_sp(actor, x + 236, y + 64)
  378.       draw_actor_battle_position(actor, x + 236, y)
  379.     end
  380.   end
  381.   def update_cursor_rect
  382.     super
  383.   end
  384. end

  385. class Window_Target
  386.   def initialize
  387.     super(0, 0, 336, 480, 112)
  388.     self.z += 10
  389.     @item_max = $game_party.actors.size
  390.     self.contents = Bitmap.new(width - 32, @item_max == 0 ? 32 : @item_max * 112)
  391.     refresh
  392.   end
  393.   def update_cursor_rect
  394.     super
  395.   end
  396. end

  397. class Window_ReservedActors < Window_Selectable
  398.   def initialize
  399.     super(0, 64, 640, 256, 112)
  400.     self.opacity = 160
  401.     self.index = 0
  402.     self.active = true
  403.     @column_max = 2
  404.     refresh
  405.   end
  406.   def actor
  407.     return @data[self.index]
  408.   end
  409.   def refresh
  410.     if self.contents != nil
  411.       self.contents.dispose
  412.       self.contents = nil
  413.     end
  414.     @data = []
  415.     $game_party.all_actors.each do |actor|
  416.       @data << actor unless actor.active || actor.battle_disabled
  417.     end
  418.     @item_max = @data.size
  419.     if @item_max > 0
  420.       self.contents = Bitmap.new (width - 32, (@item_max + 1) / 2 * 128)
  421.       @data.each_with_index do |actor, index|
  422.         x = 4 + index % 2 * (288 + 32)
  423.         y = index / 2 * 112
  424.         draw_actor_graphic(actor, x + 16, y + 80)
  425.         draw_actor_hp(actor, x + 48, y + 20)
  426.         draw_actor_sp(actor, x + 48, y + 52)
  427.       end
  428.     end
  429.   end
  430.   def update_help
  431.     # 帮助窗口显示角色的状态
  432.     self.actor == nil ? @help_window.set_text("") : @help_window.set_actor(self.actor)
  433.   end
  434. end

  435. class Scene_Menu
  436.   unless method_defined? :rb_update_command_20150421
  437.     alias rb_update_command_20150421 update_command
  438.     def update_command
  439.       if Input.trigger?(Input::Y)
  440.         $game_system.se_play($data_system.decision_se)
  441.         @command_window.active = false
  442.         @status_window.active = true
  443.         @status_window.index = 0
  444.         @battler_adjust = true
  445.         return
  446.       end
  447.       rb_update_command_20150421
  448.     end
  449.   end
  450.   unless method_defined? :rb_update_status_20150421
  451.     alias rb_update_status_20150421 update_status
  452.     def update_status
  453.       if @battler_adjust
  454.         update_battler
  455.         return
  456.       end
  457.       rb_update_status_20150421
  458.     end
  459.   end
  460.   def update_battler
  461.     if Input.trigger?(Input::B)
  462.       $game_system.se_play($data_system.cancel_se)
  463.       @battler_adjust = false
  464.       @status_window.active = false
  465.       @status_window.index = -1
  466.       @command_window.active = true
  467.       return
  468.     end
  469.     if Input.trigger?(Input::C)
  470.       actor = $game_party.actors[@status_window.index]
  471.       if actor == nil || actor.battle_disabled ||
  472.         (actor.active && $game_party.battle_actors.size == 1) ||
  473.         (!actor.active && $game_party.battle_actors.size == 4)
  474.         $game_system.se_play($data_system.buzzer_se)
  475.       else
  476.         $game_system.se_play($data_system.decision_se)
  477.         actor.active ? $game_party.battle_actors.delete(actor) : $game_party.battle_actors.push(actor)
  478.         @status_window.refresh
  479.       end
  480.     end
  481.   end
  482. end

  483. class Scene_Battle
  484.   def generate_modified_command_window
  485.     if @actor_command_window != nil
  486.       @actor_command_window.dispose
  487.       @actor_command_window = nil
  488.     end
  489.     s1 = $data_system.words.attack
  490.     s2 = $data_system.words.skill
  491.     s3 = $data_system.words.guard
  492.     s4 = $data_system.words.item
  493.     s5 = RB::Party::Words_Swap
  494.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
  495.     @actor_command_window.y = 128
  496.     @actor_command_window.back_opacity = 160
  497.     @actor_command_window.active = false
  498.     @actor_command_window.visible = false
  499.     @modified_generated = true
  500.   end
  501.   unless method_defined? :rb_phase3_setup_command_window_20150422
  502.     alias rb_phase3_setup_command_window_20150422 phase3_setup_command_window
  503.     def phase3_setup_command_window
  504.       generate_modified_command_window unless @modified_generated
  505.       rb_phase3_setup_command_window_20150422
  506.     end
  507.   end
  508.   def update_phase3_basic_command
  509.     # 按下 B 键的情况下
  510.     if Input.trigger?(Input::B)
  511.       # 演奏取消 SE
  512.       $game_system.se_play($data_system.cancel_se)
  513.       # 转向前一个角色的指令输入
  514.       phase3_prior_actor
  515.       return
  516.     end
  517.     # 按下 C 键的情况下
  518.     if Input.trigger?(Input::C)
  519.       # 角色指令窗口光标位置分之
  520.       case @actor_command_window.index
  521.       when 0  # 攻击
  522.         # 演奏确定 SE
  523.         $game_system.se_play($data_system.decision_se)
  524.         # 设置行动
  525.         @active_battler.current_action.kind = 0
  526.         @active_battler.current_action.basic = 0
  527.         # 开始选择敌人
  528.         start_enemy_select
  529.       when 1  # 特技
  530.         # 演奏确定 SE
  531.         $game_system.se_play($data_system.decision_se)
  532.         # 设置行动
  533.         @active_battler.current_action.kind = 1
  534.         # 开始选择特技
  535.         start_skill_select
  536.       when 2  # 防御
  537.         # 演奏确定 SE
  538.         $game_system.se_play($data_system.decision_se)
  539.         # 设置行动
  540.         @active_battler.current_action.kind = 0
  541.         @active_battler.current_action.basic = 1
  542.         # 转向下一位角色的指令输入
  543.         phase3_next_actor
  544.       when 3  # 物品
  545.         # 演奏确定 SE
  546.         $game_system.se_play($data_system.decision_se)
  547.         # 设置行动
  548.         @active_battler.current_action.kind = 2
  549.         # 开始选择物品
  550.         start_item_select
  551.       when 4  # 换人
  552.         $game_system.se_play($data_system.decision_se)
  553.         @active_battler.current_action.kind = 3
  554.         start_reserved_actor_select
  555.       end
  556.       return
  557.     end
  558.   end
  559.   unless method_defined? :rb_update_phase3_20150422
  560.     alias rb_update_phase3_20150422 update_phase3
  561.     def update_phase3
  562.       if @actor_window != nil
  563.         update_phase3_reserved_actor_select
  564.         return
  565.       end
  566.       rb_update_phase3_20150422
  567.     end
  568.   end
  569.   def start_reserved_actor_select
  570.     # 生成特技窗口
  571.     @actor_window = Window_ReservedActors.new
  572.     # 关联帮助窗口
  573.     @actor_window.help_window = @help_window
  574.     @help_window.visible = true
  575.     # 无效化角色指令窗口
  576.     @actor_command_window.active = false
  577.     @actor_command_window.visible = false
  578.   end
  579.   def end_reserved_actor_select
  580.     # 释放特技窗口
  581.     @actor_window.dispose
  582.     @actor_window = nil
  583.     # 隐藏帮助窗口
  584.     @help_window.visible = false
  585.     # 有效化角色指令窗口
  586.     @actor_command_window.active = true
  587.     @actor_command_window.visible = true
  588.   end
  589.   def update_phase3_reserved_actor_select
  590.     @actor_window.visible = true
  591.     # 刷新特技窗口
  592.     @actor_window.update
  593.     # 按下 B 键的情况下
  594.     if Input.trigger?(Input::B)
  595.       # 演奏取消 SE
  596.       $game_system.se_play($data_system.cancel_se)
  597.       # 结束特技选择
  598.       end_reserved_actor_select
  599.       return
  600.     end
  601.     # 按下 C 键的情况下
  602.     if Input.trigger?(Input::C)
  603.       # 获取特技选择窗口现在选择的特技的数据
  604.       @reserved_actor = @actor_window.actor
  605.       # 无法使用的情况下
  606.       if @reserved_actor == nil
  607.         # 演奏冻结 SE
  608.         $game_system.se_play($data_system.buzzer_se)
  609.         return
  610.       end
  611.       # 演奏确定 SE
  612.       $game_system.se_play($data_system.decision_se)
  613.       # 设置行动
  614.       @active_battler.current_action.reserved_actor_id = @reserved_actor.id
  615.       # 设置特技窗口为不可见状态
  616.       @actor_window.visible = false
  617.       end_reserved_actor_select
  618.       phase3_next_actor
  619.       return
  620.     end
  621.   end
  622.   def update_phase4_step2
  623.     # 如果不是强制行动
  624.     unless @active_battler.current_action.forcing
  625.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  626.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  627.         # 设置行动为攻击
  628.         @active_battler.current_action.kind = 0
  629.         @active_battler.current_action.basic = 0
  630.       end
  631.       # 限制为 [不能行动] 的情况下
  632.       if @active_battler.restriction == 4
  633.         # 清除行动强制对像的战斗者
  634.         $game_temp.forcing_battler = nil
  635.         # 移至步骤 1
  636.         @phase4_step = 1
  637.         return
  638.       end
  639.     end
  640.     # 清除对像战斗者
  641.     @target_battlers = []
  642.     # 行动种类分支
  643.     case @active_battler.current_action.kind
  644.     when 0  # 基本
  645.       make_basic_action_result
  646.     when 1  # 特技
  647.       make_skill_action_result
  648.     when 2  # 物品
  649.       make_item_action_result
  650.     when 3  # 换人
  651.       make_swap_action_result
  652.     end
  653.     # 移至步骤 3
  654.     if @phase4_step == 2
  655.       @phase4_step = 3
  656.     end
  657.   end
  658.   def make_swap_action_result
  659.     # 获取角色
  660.     @reserved_actor = $game_actors[@active_battler.current_action.reserved_actor_id]
  661.     # 无法替换的情况下
  662.     if @reserved_actor == nil || @reserved_actor.active
  663.       # 移至步骤 1
  664.       @phase4_step = 1
  665.       return
  666.     end
  667.     # 在帮助窗口显示文字
  668.     text = "与#{@reserved_actor.name}交换"
  669.     @help_window.set_text(text, 1)
  670.     # 设置动画 ID
  671.     @animation1_id = 0
  672.     index = $game_party.actors.index(@active_battler)
  673.     $game_party.actors[index] = @reserved_actor
  674.     # 设置战斗交换标志
  675.     $game_temp.battle_swap = true
  676.   end
  677.   unless method_defined? :rb_start_phase5_20150422
  678.     alias rb_start_phase5_20150422 start_phase5
  679.     def start_phase5
  680.       $game_temp.gain_exp_flag = true
  681.       rb_start_phase5_20150422
  682.       $game_temp.gain_exp_flag = false
  683.     end
  684.   end
  685. end
复制代码

  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================

  4. # ————————————————————————————————————
  5. # ▼▲▼ XRXS_BP 7. バトルステータス?クリアデザイン ver.1.03 ▼▲▼
  6. # by 桜雅 在土
  7. #==============================================================================
  8. # ■ Window_BattleStatus
  9. #==============================================================================
  10. class Window_BattleStatus < Window_Base
  11. #--------------------------------------------------------------------------
  12. # ● 公開インスタンス変数
  13. #--------------------------------------------------------------------------
  14. attr_accessor :update_cp_only # CPメーターのみの更新
  15. #--------------------------------------------------------------------------
  16. # ● オブジェクト初期化
  17. #--------------------------------------------------------------------------
  18. alias xrxs_bp7_initialize initialize
  19. def initialize
  20. # 初期化
  21. @previous_hp = []
  22. @previous_sp = []
  23. # 呼び戻す
  24. xrxs_bp7_initialize
  25. ##############################修改############################################
  26. @sta_back = []
  27. create_heads
  28. ##############################修改############################################
  29. # ↓Full-Viewの場合は下二行の # を消してください。
  30. #self.opacity = 0
  31. #self.back_opacity = 0
  32. ##############################修改############################################
  33. refresh
  34. ##############################修改############################################
  35. end
  36. ##############################修改############################################
  37. def dispose
  38.    super  
  39.    @sta_back.each do |sprite|
  40.      next if sprite.nil?
  41.      sprite.bitmap.dispose
  42.      sprite.dispose
  43.    end
  44. end
  45. ##############################修改############################################
  46.   def create_heads
  47.     (0...$game_party.actors.size).each do |i|
  48.       if @sta_back[i] != nil
  49.         @sta_back[i].bitmap.dispose
  50.         @sta_back[i].dispose
  51.       end
  52.       actor = $game_party.actors[i]
  53.       @sta_back[i] = Sprite.new
  54.       @sta_back[i].bitmap = Bitmap.new("Graphics/Characters/Heads/"+ actor.name + ".png")
  55.       @sta_back[i].x = i * 160 - 5 #在这里调整图片x坐标
  56.       @sta_back[i].y = 243#在这里调整图片y坐标
  57.       @sta_back[i].z = self.z + 1#在这里调整图片优先级
  58.     end
  59.   end
  60.   def update
  61.     super
  62.     if $game_temp.battle_swap
  63.       create_heads
  64.       $game_temp.battle_swap = false
  65.     end
  66.   end
  67. #--------------------------------------------------------------------------
  68. # ● リフレッシュ
  69. #--------------------------------------------------------------------------
  70. alias xrxs_bp7_refresh refresh
  71. def refresh
  72. # CPメーターの更新のみ の場合
  73. if @update_cp_only
  74. xrxs_bp7_refresh
  75. return
  76. end
  77. # 変更するものがない場合、飛ばす
  78. @item_max = $game_party.actors.size
  79. bool = false
  80. for i in 0...@item_max
  81. actor = $game_party.actors[i]
  82. if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
  83. bool = true
  84. end
  85. end
  86. return if bool == false
  87. # 描写を開始
  88. self.contents.clear
  89. for i in 0...@item_max
  90. actor = $game_party.actors[i]
  91. actor_x = i * 160 + 29
  92. # 歩行キャラグラフィックの描写
  93. #draw_actor_graphic(actor, actor_x - 9, 116)

  94. # HP/SPメーターの描写
  95. draw_actor_hp_meter_line(actor, actor_x, 47, 96, 12)
  96. draw_actor_sp_meter_line(actor, actor_x, 79, 96, 12)
  97. # HP数値の描写
  98. self.contents.font.size = 24 # HP/SP数値の文字の大きさ
  99. self.contents.font.color = Color.new(0,0,0,192)
  100. self.contents.draw_text(actor_x, 35, 96, 24, actor.hp.to_s, 2)
  101. self.contents.font.color = actor.hp == 0 ? knockout_color :
  102. actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  103. self.contents.draw_text(actor_x-2, 33, 96, 24, actor.hp.to_s, 2)
  104. # SP数値の描写
  105. self.contents.font.color = Color.new(0,0,0,192)
  106. self.contents.draw_text(actor_x, 72, 96, 24, actor.sp.to_s, 2)
  107. self.contents.font.color = actor.sp == 0 ? knockout_color :
  108. actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  109. self.contents.draw_text(actor_x-2, 70, 96, 24, actor.sp.to_s, 2)
  110. # 用語「HP」と用語「SP」の描写
  111. self.contents.font.size = 20 # 用語「HP/SP」の文字の大きさ
  112. draw_actor_name(actor, actor_x ,3 )

  113. self.contents.font.color = Color.new(0,0,0,192)
  114. self.contents.draw_text(actor_x+2, 27, 196, 24, $data_system.words.hp)
  115. self.contents.draw_text(actor_x+2, 59, 196, 24, $data_system.words.sp)
  116. self.contents.font.color = system_color # 用語「HP/SP」の文字の色
  117. self.contents.draw_text(actor_x, 25, 196, 24, $data_system.words.hp)
  118. self.contents.draw_text(actor_x, 57, 196, 24, $data_system.words.sp)
  119. draw_actor_state(actor, actor_x, 100)
  120. # 値を更新
  121. @previous_hp[i] = actor.hp
  122. @previous_hp[i] = actor.hp
  123. end
  124. end
  125. end
  126. #==============================================================================
  127. # ■ Window_Base
  128. #==============================================================================
  129. class Window_Base < Window
  130. #--------------------------------------------------------------------------
  131. # ● HPメーター の描画
  132. #--------------------------------------------------------------------------
  133. def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
  134. w = width * actor.hp / [actor.maxhp,1].max
  135. hp_color_1 = Color.new(255, 0, 0, 192)
  136. hp_color_2 = Color.new(255, 255, 0, 192)
  137. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  138. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  139. x -= 1
  140. y += (height/4).floor
  141. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  142. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  143. x -= 1
  144. y += (height/4).ceil
  145. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  146. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  147. x -= 1
  148. y += (height/4).ceil
  149. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  150. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  151. end
  152. #--------------------------------------------------------------------------
  153. # ● SPメーター の描画
  154. #--------------------------------------------------------------------------
  155. def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
  156. w = width * actor.sp / [actor.maxsp,1].max
  157. hp_color_1 = Color.new( 0, 0, 255, 192)
  158. hp_color_2 = Color.new( 0, 255, 255, 192)
  159. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  160. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  161. x -= 1
  162. y += (height/4).floor
  163. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  164. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  165. x -= 1
  166. y += (height/4).ceil
  167. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  168. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  169. x -= 1
  170. y += (height/4).ceil
  171. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  172. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  173. end
  174. #--------------------------------------------------------------------------
  175. # ● 名前の描画
  176. #--------------------------------------------------------------------------
  177. alias xrxs_bp7_draw_actor_name draw_actor_name
  178. def draw_actor_name(actor, x, y)
  179. xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  180. end
  181. #--------------------------------------------------------------------------
  182. # ● ステートの描画
  183. #--------------------------------------------------------------------------
  184. alias xrxs_bp7_draw_actor_state draw_actor_state
  185. def draw_actor_state(actor, x, y, width = 120)  
  186. xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  187. end
  188. #--------------------------------------------------------------------------
  189. # ● HP の描画
  190. #--------------------------------------------------------------------------
  191. alias xrxs_bp7_draw_actor_hp draw_actor_hp
  192. def draw_actor_hp(actor, x, y, width = 144)
  193. xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  194. end
  195. #--------------------------------------------------------------------------
  196. # ● SP の描画
  197. #--------------------------------------------------------------------------
  198. alias xrxs_bp7_draw_actor_sp draw_actor_sp
  199. def draw_actor_sp(actor, x, y, width = 144)
  200. xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  201. end
  202. end
  203. #==============================================================================
  204. # ■ Scene_Battle
  205. #==============================================================================
  206. class Scene_Battle
  207. #--------------------------------------------------------------------------
  208. # ● フレーム更新
  209. #--------------------------------------------------------------------------
  210. alias xrxs_bp7_update update
  211. def update
  212. xrxs_bp7_update

  213. # メッセージウィンドウ表示中の場合
  214. if $game_temp.message_window_showing
  215. @status_window.update_cp_only = true
  216. else
  217. @status_window.update_cp_only = false
  218. end
  219. end
  220. end
  221. #==============================================================================
  222. # ◇ 外部ライブラリ
  223. #==============================================================================
  224. class Window_Base
  225. #--------------------------------------------------------------------------
  226. # ● ライン描画 軽量版 by 桜雅 在土
  227. #--------------------------------------------------------------------------
  228. def draw_lineght(start_x, start_y, end_x, end_y, start_color)
  229. # 描写距離の計算。大きめに直角時の長さ。
  230. distance = (start_x - end_x).abs + (start_y - end_y).abs
  231. # 描写開始
  232. for i in 1..distance
  233. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  234. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  235. self.contents.set_pixel(x, y, start_color)
  236. end
  237. end
  238. #--------------------------------------------------------------------------
  239. # ● ライン描画 by 桜雅 在土
  240. #--------------------------------------------------------------------------
  241. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  242. # 描写距離の計算。大きめに直角時の長さ。
  243. distance = (start_x - end_x).abs + (start_y - end_y).abs
  244. # 描写開始
  245. if end_color == start_color
  246. for i in 1..distance
  247. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  248. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  249. if width == 1
  250. self.contents.set_pixel(x, y, start_color)
  251. else
  252. self.contents.fill_rect(x, y, width, width, start_color)
  253. end
  254. end
  255. else
  256. for i in 1..distance
  257. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  258. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  259. r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  260. g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  261. b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  262. a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  263. if width == 1
  264. self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  265. else
  266. self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  267. end
  268. end
  269. end
  270. end
  271. end

  272. #==============================================================================
  273. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  274. #==============================================================================
复制代码


注:以上脚本直接替换原来的脚本,未测试。
个人感觉改的应该是队伍跟随脚本,而不是队伍脚本[领队]的功能,但是我已经把领队功能去掉了。
新战斗头像脚本更改头像坐标的语句移动到了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
回复

使用道具 举报

梦石
0
星屑
94
在线时间
157 小时
注册时间
2006-7-2
回帖
250
 楼主| 发表于 2015-9-12 10:36:16 | 显示全部楼层
RyanBern 发表于 2015-9-12 09:52
#=============================================================================
# 队伍系统 Ver 2.0
#- ...

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

4.png

点评

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

使用道具 举报

梦石
0
星屑
94
在线时间
157 小时
注册时间
2006-7-2
回帖
250
 楼主| 发表于 2015-9-12 18:45:34 | 显示全部楼层
RyanBern 发表于 2015-9-12 09:52
#=============================================================================
# 队伍系统 Ver 2.0
#- ...

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

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

使用道具 举报

梦石
0
星屑
9557
在线时间
5074 小时
注册时间
2013-6-21
回帖
3459

开拓者贵宾剧作品鉴家

发表于 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
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部