Project1

标题: 删一段脚本 [打印本页]

作者: 小和尚    时间: 2013-7-25 20:04
标题: 删一段脚本
  1. module RPG
  2. class Sprite < ::Sprite
  3. def damage2(value)
  4. dispose_damage

  5. damage_string = value.to_s

  6. if value.to_i > 0
  7. damage_string = "+"+damage_string
  8. end

  9. bitmap = Bitmap.new(160, 48)
  10. bitmap.font.name = "Arial Black"

  11. #——字体修改
  12. bitmap.font.size = 32
  13. #——字体修改

  14. #——边框颜色
  15. bitmap.font.color.set(255, 255, 255)
  16. #——边框颜色

  17. bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  18. bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  19. bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  20. bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)

  21. #——颜色修改
  22. bitmap.font.color.set(0, 185, 185)
  23. #——颜色修改

  24. bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  25. @_damage_sprite2 = ::Sprite.new(self.viewport)
  26. @_damage_sprite2.bitmap = bitmap

  27. #——位置修改
  28. @_damage_sprite2.ox = 80
  29. @_damage_sprite2.oy = 80
  30. @_damage_sprite2.x = self.x
  31. @_damage_sprite2.y = self.y - self.oy / 2 + 15
  32. #——位置修改

  33. @_damage_sprite2.z = 3000
  34. @_damage_duration2 = 40
  35. end
  36. def dispose_damage2
  37. if @_damage_sprite2 != nil
  38. @_damage_sprite2.bitmap.dispose
  39. @_damage_sprite2.dispose
  40. @_damage_sprite2 = nil
  41. @_damage_duration2 = 0
  42. end
  43. end
  44. alias lv24_update update
  45. def update
  46. lv24_update
  47. if @_damage_duration2 > 0
  48. @_damage_duration2 -= 1
  49. case @_damage_duration2
  50. when 38..39
  51. @_damage_sprite2.y -= 4
  52. when 36..37
  53. @_damage_sprite2.y -= 2
  54. when 34..35
  55. @_damage_sprite2.y += 2
  56. when 28..33
  57. @_damage_sprite2.y += 4
  58. end
  59. @_damage_sprite2.opacity = 256 - (12 - @_damage_duration2) * 32
  60. if @_damage_duration2 == 0
  61. dispose_damage
  62. end
  63. end
  64. end
  65. alias lv23_initialize initialize
  66. def initialize(viewport = nil)
  67. lv23_initialize(viewport)
  68. @_damage_duration2 = 0
  69. end
  70. alias lv23_dispose dispose
  71. def dispose
  72. lv23_dispose
  73. dispose_damage2
  74. end
  75. end
  76. end
  77. class Scene_Battle
  78. alias lv23_make_skill_action_result make_skill_action_result
  79. def make_skill_action_result
  80. lv23_make_skill_action_result
  81. @active_battler.damage2 = [email protected]_cost
  82. end
  83. alias lv23_make_item_action_result make_item_action_result
  84. def make_item_action_result
  85. a = []
  86. for i in $game_party.actors
  87. a.push(i.sp)
  88. end
  89. for i in $game_troop.enemies
  90. a.push(i.sp)
  91. end
  92. lv23_make_item_action_result
  93. s = 0
  94. for i in $game_party.actors
  95. i.damage2 = i.sp - a[s]
  96. s += 1
  97. end
  98. for i in $game_troop.enemies
  99. i.damage2 = a[s] - i.sp
  100. s += 1
  101. end
  102. end
  103. end
  104. class Game_Actor
  105. attr_accessor :damage2
  106. alias lv23_initialize initialize
  107. def initialize(i)
  108. lv23_initialize(i)
  109. @damage2 = 0
  110. end
  111. end
  112. class Game_Enemy
  113. attr_accessor :damage2
  114. alias lv23_initialize initialize
  115. def initialize(i,i2)
  116. lv23_initialize(i,i2)
  117. @damage2 = 0
  118. end
  119. end
  120. class Sprite_Battler
  121. alias lv23_update update
  122. def update
  123. lv23_update
  124. return if [url=home.php?mod=space&uid=133701]@battler[/url] == nil
  125. if @battler.damage2 != 0
  126. damage2(@battler.damage2)
  127. @battler.damage2 = 0
  128. end
  129. end
  130. end
复制代码
这是一个得失SP显示的脚本 我想删掉失去SP显示的部分 保留恢复SP时显示  帮个忙 谢谢
作者: wwwcctvty    时间: 2013-7-25 20:24
试下在9行下添加:
else
return
作者: 小和尚    时间: 2013-7-25 20:31
wwwcctvty 发表于 2013-7-25 20:24
试下在9行下添加:
else
return

对哦 我怎么没想到= =~ 这个办法好~
对了 还有个小问题 就是这个脚本在恢复SP时是在动画之前恢复 怎么才能在动画之后恢复呢..




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