Project1

标题: 戰鬥數值美化 [打印本页]

作者: PCNinja    时间: 2011-7-14 23:33
标题: 戰鬥數值美化

不知道為甚麼腳本報錯,請大大們為們看看。

  1. # 傷害表示改造(RTAB) ver 1.05
  2. # 配布元.支持URL
  3. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]

  4. class Scene_Battle
  5. alias :atb_setup_original :atb_setup
  6. def atb_setup
  7. for path in ["num", "critical", "miss", "levelup", "newskill", "learning"]
  8. RPG::Cache.numeric(path)
  9. end
  10. atb_setup_original
  11. end
  12. end

  13. module RPG
  14. class Sprite < ::Sprite
  15. WIDTH = 18
  16. HEIGHT = 12
  17. def damage(value, critical, type = 0)
  18. if value.is_a?(Numeric)
  19. damage_string = value.abs.to_s
  20. else
  21. damage_string = value.to_s
  22. end
  23. if value.is_a?(Numeric) and value >= 0
  24. if type == 0
  25. if critical
  26. d_bitmap = draw_damage(value, 1)
  27. else
  28. d_bitmap = draw_damage(value, 0)
  29. end
  30. else
  31. d_bitmap = draw_damage(value, 2)
  32. end
  33. else
  34. if type == 0
  35. d_bitmap = draw_damage(value, 3)
  36. else
  37. d_bitmap = draw_damage(value, 4)
  38. end
  39. end
  40. if type == 2
  41. d_bitmap = draw_damage(value, 5)
  42. end
  43. num = @_damage.size
  44. if type != 2
  45. @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  46. else
  47. @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  48. end
  49. @_damage[num][0].bitmap = d_bitmap
  50. @_damage[num][0].ox = d_bitmap.width / 2
  51. @_damage[num][0].oy = d_bitmap.height / 2
  52. if self.battler.is_a?(Game_Actor)
  53. @_damage[num][0].x = self.x + self.viewport.ox
  54. @_damage[num][0].y = self.y - self.oy / 2
  55. else
  56. @_damage[num][0].x = self.x + self.viewport.rect.x -
  57. self.ox + self.src_rect.width / 2
  58. @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  59. self.viewport.rect.y
  60. @_damage[num][0].zoom_x = self.zoom_x
  61. @_damage[num][0].zoom_y = self.zoom_y
  62. @_damage[num][0].z = 3000
  63. end
  64. end
  65. def draw_damage(value, element)
  66. width = 0
  67. if value.is_a?(Numeric)
  68. value = value.abs
  69. fig = value.to_s.size - 1
  70. file = RPG::Cache.numeric("num")
  71. d_width = WIDTH * fig + file.rect.width / 10
  72. if element == 1
  73. critical = RPG::Cache.numeric("critical")
  74. d_width = [d_width, critical.rect.width].max
  75. d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 5)
  76. d_x = (d_width - critical.rect.width) / 2
  77. d_bitmap.blt(d_x, 0, critical, critical.rect)
  78. else
  79. d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 5)
  80. end
  81. d_x = ((d_width) - (WIDTH * fig + file.rect.width / 10)) / 2
  82. while fig >= 0
  83. d_bitmap.blt(d_x, HEIGHT, file, Rect.new((value / (10 ** fig)) *
  84. file.rect.width / 10, element * file.rect.height / 5,
  85. file.rect.width / 10, file.rect.height / 5))
  86. d_x += WIDTH
  87. value %= 10 ** fig
  88. fig -= 1
  89. end
  90. else
  91. case value
  92. when ""
  93. return Bitmap.new(1, 1)
  94. when "Miss"
  95. file = RPG::Cache.numeric("miss").dup
  96. when "Level up!"
  97. file = RPG::Cache.numeric("levelup").dup
  98. when "New Skill!"
  99. file = RPG::Cache.numeric("newskill").dup
  100. when "Learning!"
  101. file = RPG::Cache.numeric("learning").dup
  102. else
  103. file = RPG::Cache.numeric(value).dup
  104. end
  105. d_bitmap = file

  106. end
  107. return d_bitmap
  108. end
  109. end
  110. module Cache
  111. def self.numeric(filename)
  112. self.load_bitmap("Graphics/String/", filename)
  113. end
  114. end
  115. end
复制代码
拜托了。 dsu_plus_rewardpost_czw
作者: 反斗奇彬    时间: 2011-7-14 23:44
因为脚本冲突了,所以就不行了,建议楼主把使用的脚本都贴上来




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