Project1

标题: 战斗状态框问题 [打印本页]

作者: guiyu07    时间: 2009-11-8 22:14
标题: 战斗状态框问题
本帖最后由 guiyu07 于 2009-11-9 22:16 编辑


这个是战斗时候的状态框用了一个描绘血槽的脚本~主角的名字却不见了...
怎么样把名字重新加回去呢?
作者: guiyu07    时间: 2009-11-9 13:34
:dizzy:苦恼的坐在沙发上~
作者: well    时间: 2009-11-9 15:18
写名字的脚本应该是
draw_actor_name(actor, actor_x, 0)
检查Window_BattleStatus,看刷新部分有没有这句。
如果有,检查横纵坐标,就是“actor_x”和“0”看是否超出窗口显示范围。这两个是默认脚本,actor_x = i * 160 + 4。
作者: guiyu07    时间: 2009-11-9 18:41
3# well
我的BattleStatus脚本是默认的没改过~
  1. # ————————————————————————————————————
  2. # ▼▲▼ XRXS_BP 7. バトルステータス?クリアデザイン ver.1.03 ▼▲▼
  3. # by 桜雅 在土
  4. #==============================================================================
  5. # ■ Window_BattleStatus
  6. #==============================================================================
  7. class Window_BattleStatus < Window_Base
  8. #--------------------------------------------------------------------------
  9. # ● 公開インスタンス変数
  10. #--------------------------------------------------------------------------
  11. attr_accessor :update_cp_only # CPメーターのみの更新
  12. #--------------------------------------------------------------------------
  13. # ● オブジェクト初期化
  14. #--------------------------------------------------------------------------
  15. alias xrxs_bp7_initialize initialize
  16. def initialize
  17. # 初期化
  18. @previous_hp = []
  19. @previous_sp = []
  20. # 呼び戻す
  21. xrxs_bp7_initialize
  22. # ↓Full-Viewの場合は下二行の # を消してください。
  23. #self.opacity = 0
  24. #self.back_opacity = 0
  25. end
  26. #--------------------------------------------------------------------------
  27. # ● リフレッシュ
  28. #--------------------------------------------------------------------------
  29. alias xrxs_bp7_refresh refresh
  30. def refresh
  31. # CPメーターの更新のみ の場合
  32. if @update_cp_only
  33. xrxs_bp7_refresh
  34. return
  35. end
  36. # 変更するものがない場合、飛ばす
  37. @item_max = $game_party.actors.size
  38. bool = false
  39. for i in 0...@item_max
  40. actor = $game_party.actors[i]
  41. if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
  42. bool = true
  43. end
  44. end
  45. return if bool == false
  46. # 描写を開始
  47. self.contents.clear
  48. for i in 0...@item_max
  49. actor = $game_party.actors[i]
  50. actor_x = i * 160 + 21
  51. # 歩行キャラグラフィックの描写
  52. draw_actor_graphic(actor, actor_x - 9, 116)
  53. # HP/SPメーターの描写
  54. draw_actor_hp_meter_line(actor, actor_x, 52, 96, 12)
  55. draw_actor_sp_meter_line(actor, actor_x, 84, 96, 12)
  56. # HP数値の描写
  57. self.contents.font.size = 24 # HP/SP数値の文字の大きさ
  58. self.contents.font.color = Color.new(0,0,0,192)
  59. self.contents.draw_text(actor_x, 40, 96, 24, actor.hp.to_s, 2)
  60. self.contents.font.color = actor.hp == 0 ? knockout_color :
  61. actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  62. self.contents.draw_text(actor_x-2, 38, 96, 24, actor.hp.to_s, 2)
  63. # SP数値の描写
  64. self.contents.font.color = Color.new(0,0,0,192)
  65. self.contents.draw_text(actor_x, 72, 96, 24, actor.sp.to_s, 2)
  66. self.contents.font.color = actor.sp == 0 ? knockout_color :
  67. actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  68. self.contents.draw_text(actor_x-2, 70, 96, 24, actor.sp.to_s, 2)
  69. # 用語「HP」と用語「SP」の描写
  70. self.contents.font.size = 18 # 用語「HP/SP」の文字の大きさ
  71. self.contents.font.color = Color.new(0,0,0,192)
  72. self.contents.draw_text(actor_x+2, 32, 196, 24, $data_system.words.hp)
  73. self.contents.draw_text(actor_x+2, 64, 196, 24, $data_system.words.sp)
  74. self.contents.font.color = system_color # 用語「HP/SP」の文字の色
  75. self.contents.draw_text(actor_x, 30, 196, 24, $data_system.words.hp)
  76. self.contents.draw_text(actor_x, 62, 196, 24, $data_system.words.sp)
  77. # ステートの描写
  78. draw_actor_state(actor, actor_x, 100)
  79. # 値を更新
  80. @previous_hp[i] = actor.hp
  81. @previous_hp[i] = actor.hp
  82. end
  83. end
  84. end
  85. #==============================================================================
  86. # ■ Window_Base
  87. #==============================================================================
  88. class Window_Base < Window
  89. #--------------------------------------------------------------------------
  90. # ● HPメーター の描画
  91. #--------------------------------------------------------------------------
  92. def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
  93. w = width * actor.hp / [actor.maxhp,1].max
  94. hp_color_1 = Color.new(255, 0, 0, 192)
  95. hp_color_2 = Color.new(255, 255, 0, 192)
  96. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  97. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  98. x -= 1
  99. y += (height/4).floor
  100. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  101. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  102. x -= 1
  103. y += (height/4).ceil
  104. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  105. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  106. x -= 1
  107. y += (height/4).ceil
  108. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  109. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  110. end
  111. #--------------------------------------------------------------------------
  112. # ● SPメーター の描画
  113. #--------------------------------------------------------------------------
  114. def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
  115. w = width * actor.sp / [actor.maxsp,1].max
  116. hp_color_1 = Color.new( 0, 0, 255, 192)
  117. hp_color_2 = Color.new( 0, 255, 255, 192)
  118. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  119. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  120. x -= 1
  121. y += (height/4).floor
  122. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  123. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  124. x -= 1
  125. y += (height/4).ceil
  126. self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  127. draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  128. x -= 1
  129. y += (height/4).ceil
  130. self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  131. draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  132. end
  133. #--------------------------------------------------------------------------
  134. # ● 名前の描画
  135. #--------------------------------------------------------------------------
  136. alias xrxs_bp7_draw_actor_name draw_actor_name
  137. def draw_actor_name(actor, x, y)
  138. xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  139. end
  140. #--------------------------------------------------------------------------
  141. # ● ステートの描画
  142. #--------------------------------------------------------------------------
  143. alias xrxs_bp7_draw_actor_state draw_actor_state
  144. def draw_actor_state(actor, x, y, width = 120)
  145. xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  146. end
  147. #--------------------------------------------------------------------------
  148. # ● HP の描画
  149. #--------------------------------------------------------------------------
  150. alias xrxs_bp7_draw_actor_hp draw_actor_hp
  151. def draw_actor_hp(actor, x, y, width = 144)
  152. xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  153. end
  154. #--------------------------------------------------------------------------
  155. # ● SP の描画
  156. #--------------------------------------------------------------------------
  157. alias xrxs_bp7_draw_actor_sp draw_actor_sp
  158. def draw_actor_sp(actor, x, y, width = 144)
  159. xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  160. end
  161. end
  162. #==============================================================================
  163. # ■ Scene_Battle
  164. #==============================================================================
  165. class Scene_Battle
  166. #--------------------------------------------------------------------------
  167. # ● フレーム更新
  168. #--------------------------------------------------------------------------
  169. alias xrxs_bp7_update update
  170. def update
  171. xrxs_bp7_update
  172. # メッセージウィンドウ表示中の場合
  173. if $game_temp.message_window_showing
  174. @status_window.update_cp_only = true
  175. else
  176. @status_window.update_cp_only = false
  177. end
  178. end
  179. end
  180. #==============================================================================
  181. # ◇ 外部ライブラリ
  182. #==============================================================================
  183. class Window_Base
  184. #--------------------------------------------------------------------------
  185. # ● ライン描画 軽量版 by 桜雅 在土
  186. #--------------------------------------------------------------------------
  187. def draw_lineght(start_x, start_y, end_x, end_y, start_color)
  188. # 描写距離の計算。大きめに直角時の長さ。
  189. distance = (start_x - end_x).abs + (start_y - end_y).abs
  190. # 描写開始
  191. for i in 1..distance
  192. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  193. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  194. self.contents.set_pixel(x, y, start_color)
  195. end
  196. end
  197. #--------------------------------------------------------------------------
  198. # ● ライン描画 by 桜雅 在土
  199. #--------------------------------------------------------------------------
  200. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  201. # 描写距離の計算。大きめに直角時の長さ。
  202. distance = (start_x - end_x).abs + (start_y - end_y).abs
  203. # 描写開始
  204. if end_color == start_color
  205. for i in 1..distance
  206. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  207. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  208. if width == 1
  209. self.contents.set_pixel(x, y, start_color)
  210. else
  211. self.contents.fill_rect(x, y, width, width, start_color)
  212. end
  213. end
  214. else
  215. for i in 1..distance
  216. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  217. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  218. r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  219. g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  220. b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  221. a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  222. if width == 1
  223. self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  224. else
  225. self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  226. end
  227. end
  228. end
  229. end
  230. end
复制代码
这个是血槽的脚本~我怀疑可能在第136行那一段修改...
但是我~具体不知道怎么修改...
作者: kakarot    时间: 2009-11-9 19:26
板凳正解,在“# 歩行キャラグラフィックの描写”之前加上

  1. draw_actor_name(actor, actor_x, 0)
复制代码
就好了~
作者: guiyu07    时间: 2009-11-9 22:16
5# kakarot
感谢!!!!!




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