设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 435|回复: 2
打印 上一主题 下一主题

[有事请教] 關於傷害數字圖片呈現一上一下的顯示方式設定

[复制链接]

Lv2.观梦者

梦石
0
星屑
409
在线时间
301 小时
注册时间
2013-6-1
帖子
129
跳转到指定楼层
1
发表于 2025-3-29 20:17:22 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 e900003 于 2025-3-29 20:25 编辑

如題,

就是像冒險島的傷害數字呈現的一上一下的顯示方式
如圖所示


但不知道要從哪裡修改

這是正在使用的腳本
RUBY 代码复制
  1. # [XP] 傷害字型自定義顯示
  2. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
  3.  
  4. class Scene_Battle
  5.   alias :main_damage :main
  6.   def main
  7.     for path in ["num", "critical", "miss"]
  8.       RPG::Cache.numeric(path)
  9.     end
  10.     main_damage
  11.   end
  12. end
  13.  
  14. module RPG
  15.   class Sprite < ::Sprite
  16.     WIDTH = 23                  # 傷害字型寬度
  17.     HEIGHT = 20                 # 傷害字型高度
  18.     def damage(value, critical)
  19.       dispose_damage
  20.       if value.is_a?(Numeric)
  21.         damage_string = value.abs.to_s
  22.       else
  23.         damage_string = value.to_s
  24.       end
  25.       if value.is_a?(Numeric)
  26.         damage_string = value.abs.to_s
  27.       else
  28.         damage_string = value.to_s
  29.       end
  30.       if value.is_a?(Numeric)
  31.         if value >= 0
  32.           if critical
  33.             d_bitmap = draw_damage(value, 1)
  34.           else
  35.             d_bitmap = draw_damage(value, 0)
  36.           end
  37.         else
  38.           d_bitmap = draw_damage(value, 2)
  39.         end
  40.       else
  41.         d_bitmap = draw_damage(value, 3)
  42.       end
  43.       @_damage_sprite = ::Sprite.new
  44.       @_damage_sprite.bitmap = d_bitmap
  45.       @_damage_sprite.ox = d_bitmap.width / 2
  46.       @_damage_sprite.oy = d_bitmap.height / 2
  47.       @_damage_sprite.x = self.x + self.viewport.rect.x
  48.       @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
  49.       @_damage_sprite.z = 3000
  50.       @_damage_duration = 40
  51.     end
  52.     def draw_damage(value, element)
  53.       width = 0
  54.       if value.is_a?(Numeric)
  55.         value = value.abs
  56.         fig = value.to_s.size - 1
  57. #==========================傷害顯示的樣式============================
  58.       if $game_switches[3628] == false
  59.          file = RPG::Cache.numeric("num") #
  60.        else
  61.          file = RPG::Cache.numeric("num_actor") #角色受傷害用的傷害字型
  62.        end
  63. #===========================自定義數字間隔距離1==========================
  64.        if $game_switches[3628] == false
  65.            d_width = WIDTH * fig + file.rect.width / 10  #
  66.         else
  67.           d_width = WIDTH * fig + file.rect.width / 10  #角色受傷害用的傷害字型
  68.         end
  69. #==========================爆擊特效顯示===============================
  70.         if element == 1
  71.          if $game_switches[3628] == false
  72.            critical = RPG::Cache.numeric("critical") #
  73.          else
  74.            critical = RPG::Cache.numeric("critical") #角色受傷害用的傷害字型
  75.          end
  76. #=======================================================================
  77.           d_width = [d_width, critical.rect.width].max
  78.           d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 3)
  79.           d_x = (d_width - critical.rect.width) / 2
  80.           d_bitmap.blt(d_x, 0, critical, critical.rect)
  81.         else
  82.           d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 3)
  83.        end
  84. #=========================自定義數字間隔距離2===========================
  85.        if $game_switches[3628] == false
  86.          d_x = ((d_width) - (WIDTH * fig + file.rect.width / 10)) / 2  #
  87.        else
  88.          d_x = ((d_width) - (WIDTH * fig + file.rect.width / 10)) / 2  #角色受傷害用的傷害字型
  89.        end
  90. #======================================================================
  91.         while fig >= 0
  92.           d_bitmap.blt(d_x, HEIGHT, file, Rect.new((value / (10 ** fig)) *
  93.             file.rect.width / 10, element * file.rect.height / 3,
  94.             file.rect.width / 10, file.rect.height / 3))
  95. #=========================自定義數字間隔距離3==========================
  96.          if $game_switches[3628] == false
  97.             d_x += WIDTH  #
  98.            else
  99.             d_x += WIDTH  #角色受傷害用的傷害字型
  100.          end
  101. #======================================================================
  102.           value %= 10 ** fig
  103.           fig -= 1
  104.         end
  105.       else
  106.         case value
  107.         when ""
  108.           return Bitmap.new(1, 1)
  109. #===========================傷害未命中顯示=============================
  110.         when "Miss"
  111.         if $game_switches[3628] == false
  112.           file = RPG::Cache.numeric("miss").dup #
  113.         else
  114.           file = RPG::Cache.numeric("miss_actor").dup #角色受傷害用的傷害字型
  115.         end
  116. #======================================================================
  117.         else
  118.           file = RPG::Cache.numeric(value).dup
  119.         end
  120.         d_bitmap = file
  121.       end
  122.       return d_bitmap
  123.     end
  124.   end
  125.   module Cache
  126.     def self.numeric(filename)
  127.       self.load_bitmap("Graphics/DamageSkin/", filename)
  128.     end
  129.   end
  130. end

Lv4.逐梦者

梦石
0
星屑
5846
在线时间
791 小时
注册时间
2019-1-20
帖子
210
2
发表于 2025-6-13 10:55:36 | 只看该作者

  1. SJR_250610=5 #波动幅度

  2. # [XP] 傷害字型自定義顯示
  3. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]

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

  13. module RPG
  14.   class Sprite < ::Sprite
  15.     WIDTH = 23                  # 傷害字型寬度
  16.     HEIGHT = 20                 # 傷害字型高度
  17.     def damage(value, critical)
  18.       dispose_damage
  19.       if value.is_a?(Numeric)
  20.         damage_string = value.abs.to_s
  21.       else
  22.         damage_string = value.to_s
  23.       end
  24.       if value.is_a?(Numeric)
  25.         damage_string = value.abs.to_s
  26.       else
  27.         damage_string = value.to_s
  28.       end
  29.       if value.is_a?(Numeric)
  30.         if value >= 0
  31.           if critical
  32.             d_bitmap = draw_damage(value, 1)
  33.           else
  34.             d_bitmap = draw_damage(value, 0)
  35.           end
  36.         else
  37.           d_bitmap = draw_damage(value, 2)
  38.         end
  39.       else
  40.         d_bitmap = draw_damage(value, 3)
  41.       end
  42.       @_damage_sprite = ::Sprite.new
  43.       @_damage_sprite.bitmap = d_bitmap
  44.       @_damage_sprite.ox = d_bitmap.width / 2
  45.       @_damage_sprite.oy = d_bitmap.height / 2
  46.       @_damage_sprite.x = self.x + self.viewport.rect.x
  47.       @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
  48.       @_damage_sprite.z = 3000
  49.       @_damage_duration = 40
  50.     end
  51.     def draw_damage(value, element)
  52.       width = 0
  53.       if value.is_a?(Numeric)
  54.         value = value.abs
  55.         fig = value.to_s.size - 1
  56. #==========================傷害顯示的樣式============================
  57.       if $game_switches[3628] == false
  58.          file = RPG::Cache.numeric("num") #
  59.        else
  60.          file = RPG::Cache.numeric("num_actor") #角色受傷害用的傷害字型
  61.        end
  62. #===========================自定義數字間隔距離1==========================
  63.        if $game_switches[3628] == false
  64.            d_width = WIDTH * fig + file.rect.width / 10  #
  65.         else
  66.           d_width = WIDTH * fig + file.rect.width / 10  #角色受傷害用的傷害字型
  67.         end
  68. #==========================爆擊特效顯示===============================
  69.         if element == 1
  70.          if $game_switches[3628] == false
  71.            critical = RPG::Cache.numeric("critical") #
  72.          else
  73.            critical = RPG::Cache.numeric("critical") #角色受傷害用的傷害字型
  74.          end
  75. #=======================================================================
  76.           d_width = [d_width, critical.rect.width].max
  77.           d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 3)
  78.           d_x = (d_width - critical.rect.width) / 2
  79.           d_bitmap.blt(d_x, 0, critical, critical.rect)
  80.         else
  81.           d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 3)
  82.        end
  83. #=========================自定義數字間隔距離2===========================
  84.        if $game_switches[3628] == false
  85.          d_x = ((d_width) - (WIDTH * fig + file.rect.width / 10)) / 2  #
  86.        else
  87.          d_x = ((d_width) - (WIDTH * fig + file.rect.width / 10)) / 2  #角色受傷害用的傷害字型
  88.        end
  89. #======================================================================
  90. @sjr_250610_i=0
  91.           while fig >= 0
  92. @sjr_250610_i+=1  
  93.           d_bitmap.blt(d_x, HEIGHT  + (@sjr_250610_i%2==0 ? SJR_250610 : -SJR_250610), file, Rect.new((value / (10 ** fig)) *
  94.             file.rect.width / 10, element * file.rect.height / 3,
  95.             file.rect.width / 10, file.rect.height / 3))

  96. #=========================自定義數字間隔距離3==========================
  97.          if $game_switches[3628] == false
  98.             d_x += WIDTH  #
  99.            else
  100.             d_x += WIDTH  #角色受傷害用的傷害字型
  101.          end
  102. #======================================================================
  103.           value %= 10 ** fig
  104.           fig -= 1
  105.         end
  106.       else
  107.         case value
  108.         when ""
  109.           return Bitmap.new(1, 1)
  110. #===========================傷害未命中顯示=============================
  111.         when "Miss"
  112.         if $game_switches[3628] == false
  113.           file = RPG::Cache.numeric("miss").dup #
  114.         else
  115.           file = RPG::Cache.numeric("miss_actor").dup #角色受傷害用的傷害字型
  116.         end
  117. #======================================================================
  118.         else
  119.           file = RPG::Cache.numeric(value).dup
  120.         end
  121.         d_bitmap = file
  122.       end
  123.       return d_bitmap
  124.     end
  125.   end
  126.   module Cache
  127.     def self.numeric(filename)
  128.       self.load_bitmap("Graphics/DamageSkin/", filename)
  129.     end
  130.   end
  131. end
复制代码

提高解决问题的方法:
查看对应版本的帮助文件或者默认脚本中可能相似的部分 看有没有思路能照搬(不是)
改变问题为更有可能的,常见的,系统性的 如:天气自动变化成下雨→天气系统 要多想几种可能
使用论坛的搜索功能查找相关问题 咦?这跟我想的不一样啊!讨厌啦~\(≧□≦)/~啦啦啦
清楚说明实际上你想解决的问题  想看坛友的女装,想看!  
脚本自己有改过的地方要尽量标明  提高除BUG效率 ... ...
脚本有问题但不是默认脚本的要全部贴出来 大胆点,尽情发,我说的是女装照!
三包原则:包有BUG,包甩锅,包咕咕 长期下线,急事换人!难事换人!啥事都换人!换人换人换人!!!
回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
409
在线时间
301 小时
注册时间
2013-6-1
帖子
129
3
 楼主| 发表于 5 天前 | 只看该作者


謝謝你,剛剛測試之後生效了
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-6-23 15:55

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表