Project1

标题: 求显示敌人状态的脚本 [打印本页]

作者: 黑舞嗜    时间: 2011-11-23 23:01
标题: 求显示敌人状态的脚本
本帖最后由 黑舞嗜 于 2011-11-24 00:03 编辑

我用的是横战SideView2.7战斗系统dsu_plus_rewardpost_czw
作者: 月夜神音    时间: 2011-11-23 23:41
本帖最后由 月夜神音 于 2011-11-24 00:09 编辑

修改了一下,弄好了
  1. #==============================================================================
  2. # ■ module n01
  3. #------------------------------------------------------------------------------
  4. # HP Gauge and State Indicator Add-on  Ver1.1
  5. #
  6. # Do not use this add-on with the ATB. It is already built into the ATB.
  7. #==============================================================================
  8. module N01
  9.   
  10. # Display the state of the selected battler.
  11.   WORD_STATE_DISPLAY = true
  12.   
  13. # Name to display when there is no abnormal state.
  14.   WORD_NORMAL_STATE = "正常"
  15.   
  16. # Displays the HP gauge of the selected battler.
  17.   HP_DISPLAY = true
  18.   
  19. # Displays the HP gauge of selected actors.
  20.   ACTOR_DISPLAY = true
  21.   
  22. # Do not display the HP gauge and states for the following enemies:
  23.   ENEMY_NON_DISPLAY = []  # ex.[1,2,3]
  24.   
  25. # Do not display the following states ID as abnormal:
  26.   STATE_NON_DISPLAY = []  # ex.[1,2,3]
  27.   
  28.   
  29. end
  30. #-------------------------------設定ここまで-----------------------------------

  31. #==============================================================================
  32. # ■ Window_Help
  33. #------------------------------------------------------------------------------
  34. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  35. #==============================================================================

  36. class Window_Help < Window_Base
  37.   #--------------------------------------------------------------------------
  38.   # ● テキスト設定
  39.   #--------------------------------------------------------------------------
  40.   def set_text_n01add(member)
  41.     self.contents.clear
  42.     self.contents.font.color = normal_color
  43.     if !member.actor? && N01::ENEMY_NON_DISPLAY.include?(member.enemy_id)
  44.       return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
  45.     elsif member.actor? && !N01::ACTOR_DISPLAY
  46.       return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
  47.     end
  48.     if N01::WORD_STATE_DISPLAY && N01::HP_DISPLAY
  49.       self.contents.draw_text(0, 0, 180, WLH, member.name, 1)
  50.       i = 0
  51.       for state in member.states
  52.         i += 1
  53.         draw_icon(state.icon_index,i * 24 + 160,0)
  54.       end
  55.     elsif N01::WORD_STATE_DISPLAY
  56.       text = member.name + "  ["
  57.       for state in member.states
  58.         next if N01::STATE_NON_DISPLAY.include?(state.id)
  59.         text += " " if text != member.name + "  ["
  60.         text += state.name
  61.       end
  62.       text += N01::WORD_NORMAL_STATE if text == member.name + "  ["
  63.       text += "]"
  64.       text = "" if text == "[]"
  65.       self.contents.draw_text(4, 0, self.width - 40, WLH, text, 1)
  66.     elsif N01::HP_DISPLAY
  67.       self.contents.draw_text(4, 0, 240, WLH, member.name, 1)
  68.       draw_actor_hp(member, 262, 0, 120)
  69.       draw_actor_mp(member, 478, 0, 100)
  70.     end
  71.   end
  72. end

  73. #==============================================================================
  74. # ■ Scene_Battle
  75. #------------------------------------------------------------------------------
  76. #  バトル画面の処理を行うクラスです。
  77. #==============================================================================
  78. class Scene_Battle < Scene_Base
  79.   #--------------------------------------------------------------------------
  80.   # ● ターゲット選択の開始
  81.   #--------------------------------------------------------------------------
  82.   def start_target_selection(actor = false)
  83.     members = $game_party.members if actor
  84.     members = $game_troop.members unless actor
  85.     # カーソルスプライトの作成
  86.     @cursor = Sprite.new
  87.     @cursor.bitmap = Cache.character("cursor")
  88.     @cursor.src_rect.set(0, 0, 32, 32)
  89.     @cursor_flame = 0
  90.     @cursor.x = -200
  91.     @cursor.y = -200
  92.     @cursor.ox = @cursor.width
  93.     @cursor.oy = @cursor.height
  94.     # ターゲット名を表示するヘルプウインドウを作成
  95.     @help_window.visible = false if @help_window != nil
  96.     @help_window2 = Window_Help.new if @help_window2 == nil
  97.     # 不要なウインドウを消す
  98.     @actor_command_window.active = false
  99.     @skill_window.visible = false if @skill_window != nil
  100.     @item_window.visible = false if @item_window != nil
  101.     # 存在しているターゲットで最も番号の低い対象を最初に指すように
  102.     @index = 0
  103.     @max_index = members.size - 1
  104.     # アクターは戦闘不能者でもターゲットできるようにエネミーと区別
  105.     unless actor
  106.       members.size.times do
  107.         break if members[@index].exist?
  108.         @index += 1
  109.       end
  110.     end  
  111.     @help_window2.set_text_n01add(members[@index])
  112.     select_member(actor)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● カーソルを前に移動
  116.   #--------------------------------------------------------------------------
  117.   def cursor_up(members, actor)
  118.     Sound.play_cursor
  119.     members.size.times do
  120.       @index += members.size - 1
  121.       @index %= members.size
  122.       break if actor
  123.       break if members[@index].exist?
  124.     end
  125.     @help_window2.set_text_n01add(members[@index])
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● カーソルを次に移動
  129.   #--------------------------------------------------------------------------
  130.   def cursor_down(members, actor)
  131.     Sound.play_cursor
  132.     members.size.times do
  133.       @index += 1
  134.       @index %= members.size
  135.       break if actor
  136.       break if members[@index].exist? && !actor
  137.     end
  138.     @help_window2.set_text_n01add(members[@index])
  139.   end
  140. end  
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1