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

Project1

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

[已经解决] 请问有可以显示敌人血条和敌人中了状态显示图标的脚本吗

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1616
在线时间
149 小时
注册时间
2018-12-27
帖子
324
跳转到指定楼层
1
发表于 2019-4-7 19:53:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
显示血条找到了,挺多的,不过看到不少人都说va的好像有bug
然后就是能不能显示UI什么的,比如说敌人流血我想给他加一个特殊的UI
如果我做了新的UI,系统会怎么读取编号?

Lv3.寻梦者

梦石
0
星屑
2323
在线时间
274 小时
注册时间
2017-7-25
帖子
163
2
发表于 2019-4-19 21:58:27 | 只看该作者
  1. #==============================================================================
  2. #  ■エネミーの状態を表示 for RGSS3 Ver0.80-α
  3. # □作成者 kure
  4. #==============================================================================
  5. $kure_base_script = {} if $kure_base_script == nil
  6. $kure_base_script[:InfoBar] = 100
  7. p "エネミーの情報表示"
  8. module KURE
  9.   module InfoBar
  10.     #初期設定(変更しない事)-----------------------------------------------------
  11.     COLOR = []
  12.    
  13.     #表示色(IDによって割り当てが決まっています。)
  14.       #バーの背景色(ID0)
  15.       COLOR[0] = Color.new(32 ,32, 64, 255)
  16.       
  17.       #HPバーの色(ID1,ID2)
  18.       COLOR[1] = Color.new(224 ,128, 64, 255)
  19.       COLOR[2] = Color.new(240 ,192, 64, 255)
  20.    
  21.   end
  22. end

  23. #==============================================================================
  24. # ■ RPG::Enemy(追加定義)
  25. #==============================================================================
  26. class RPG::Enemy < RPG::BaseItem
  27.   #--------------------------------------------------------------------------
  28.   # ☆ バーの表示幅の定義(追加定義)
  29.   #--------------------------------------------------------------------------  
  30.   def infobar_width
  31.     @note.match(/<情報表示幅\s?(\d+)\s?>/)
  32.     return 100 unless $1
  33.     return $1.to_i
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ☆ バーの表示幅の定義(追加定義)
  37.   #--------------------------------------------------------------------------  
  38.   def infobar_visible?
  39.     return false if @note.include?("<情報非表示>")
  40.     return true
  41.   end
  42. end

  43. #==============================================================================
  44. # ■ Game_Enemy
  45. #==============================================================================
  46. class Game_Enemy < Game_Battler
  47.   #--------------------------------------------------------------------------
  48.   # ☆ バーの表示幅の定義(追加定義)
  49.   #--------------------------------------------------------------------------  
  50.   def infobar_width
  51.     return enemy.infobar_width
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ☆ バーの表示幅の定義(追加定義)
  55.   #--------------------------------------------------------------------------  
  56.   def infobar_visible?
  57.     return enemy.infobar_visible?
  58.   end
  59. end

  60. #==============================================================================
  61. # ■ Spriteset_Battle
  62. #==============================================================================
  63. class Spriteset_Battle
  64.   #--------------------------------------------------------------------------
  65.   # ● 敵キャラスプライトの作成(エイリアス再定義)
  66.   #--------------------------------------------------------------------------
  67.   alias k_basescript_before_create_enemies create_enemies
  68.   def create_enemies
  69.     k_basescript_before_create_enemies
  70.     @enemy_info_bar = $game_troop.members.reverse.collect do |enemy|
  71.       Sprite_Infobar.new(@viewport1, enemy)
  72.     end
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 敵キャラスプライトの更新(エイリアス再定義)
  76.   #--------------------------------------------------------------------------
  77.   alias k_basescript_before_update_enemies update_enemies
  78.   def update_enemies
  79.     k_basescript_before_update_enemies
  80.     @enemy_info_bar.each {|sprite| sprite.update }
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 敵キャラスプライトの解放(エイリアス再定義)
  84.   #--------------------------------------------------------------------------
  85.   alias k_basescript_before_dispose_enemies dispose_enemies
  86.   def dispose_enemies
  87.     k_basescript_before_dispose_enemies
  88.     @enemy_info_bar.each {|sprite| sprite.dispose }
  89.   end
  90. end

  91. #==============================================================================
  92. # ■ Sprite_Infobar
  93. #==============================================================================
  94. class Sprite_Infobar < Sprite_Base
  95.   #--------------------------------------------------------------------------
  96.   # ● 公開インスタンス変数
  97.   #--------------------------------------------------------------------------
  98.   attr_accessor :battler
  99.   #--------------------------------------------------------------------------
  100.   # ● オブジェクト初期化
  101.   #--------------------------------------------------------------------------
  102.   def initialize(viewport, battler = nil)
  103.     super(viewport)
  104.     @battler = battler
  105.     @fill_w = nil
  106.     @bitmap_data = Cache.battler(battler.battler_name, battler.battler_hue)
  107.     @state = battler.states
  108.     @icon_set = Cache.system("Iconset")
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● フレーム更新
  112.   #--------------------------------------------------------------------------
  113.   def update
  114.     super
  115.     if @battler
  116.       @use_sprite = @battler.use_sprite?
  117.       if @use_sprite
  118.         update_bitmap
  119.         update_origin
  120.         update_position
  121.       end
  122.     else
  123.       self.bitmap = nil
  124.     end
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● 解放
  128.   #--------------------------------------------------------------------------
  129.   def dispose
  130.     bitmap.dispose if bitmap
  131.     super
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 転送元ビットマップの更新
  135.   #--------------------------------------------------------------------------
  136.   def update_bitmap
  137.     fill_w = @battler.infobar_width * (@battler.hp.to_f / @battler.mhp)
  138.     state = battler.states
  139.     if @fill_w != fill_w or @state != state
  140.       @fill_w = fill_w
  141.       @state = state
  142.       
  143.       width = @battler.infobar_width + 4
  144.       
  145.       new_bitmap = Bitmap.new(width, 35)
  146.       @state.each_with_index {|state, index|
  147.         next if 24 * (index + 1) > new_bitmap.width
  148.         rect = Rect.new(state.icon_index % 16 * 24, state.icon_index / 16 * 24, 24, 24)
  149.         new_bitmap.blt(24 * index, 0, @icon_set, rect, 255)
  150.       }
  151.       new_bitmap.fill_rect(0, 25, width, 10, color(0))
  152.       new_bitmap.gradient_fill_rect(2, 27, fill_w, 6, color(1), color(2))
  153.    
  154.       self.bitmap = new_bitmap
  155.       init_visibility
  156.       
  157.       self.opacity = 0 unless @battler.infobar_visible?
  158.     end
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 可視状態の初期化
  162.   #--------------------------------------------------------------------------
  163.   def init_visibility
  164.     @battler_visible = @battler.alive?
  165.     self.opacity = 0 unless @battler_visible
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 文字色取得
  169.   #--------------------------------------------------------------------------
  170.   def color(num)
  171.     return KURE::InfoBar::COLOR[num]
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 原点の更新
  175.   #--------------------------------------------------------------------------
  176.   def update_origin
  177.     if bitmap
  178.       self.ox = bitmap.width / 2
  179.       self.oy = bitmap.height
  180.     end
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ● 位置の更新
  184.   #--------------------------------------------------------------------------
  185.   def update_position
  186.     self.x = @battler.screen_x
  187.     self.y = @battler.screen_y - @bitmap_data.height
  188.     self.z = @battler.screen_z + 10
  189.   end
  190. end
复制代码

状态UI什么的不是很懂,没弄过

评分

参与人数 1星屑 +50 收起 理由
VIPArcher + 50 塞糖

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1616
在线时间
149 小时
注册时间
2018-12-27
帖子
324
3
 楼主| 发表于 2019-4-21 12:29:38 | 只看该作者
骷髅岛遗老 发表于 2019-4-19 21:58
状态UI什么的不是很懂,没弄过

谢谢你了 就是想单纯的画一些新的ui 毕竟科幻游戏缺ui没办法的
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 01:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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