查看: 2127|回复: 2

[已经过期] 想求一个同时显示敌人血条和蓝条的脚本

[复制链接]
梦石
0
星屑
50
在线时间
30 小时
注册时间
2015-5-6
回帖
23
发表于 2016-4-20 01:46:52 | 显示全部楼层 |阅读模式

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

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

×
血条的有很多,貌似没见到有蓝条的,伸手一回
梦石
0
星屑
1297
在线时间
995 小时
注册时间
2014-12-14
回帖
2939

开拓者

发表于 2016-4-20 03:49:22 | 显示全部楼层
这问题有点太水了,多花点时间实验一下吧
根据脚本的不同,血条大约分为两类:
1.图片素材,此类直接使用图像软件修改即可
2.脚本生成,此类在下一时忘记了。但是在预设脚本中全局搜索“HP”就有线索了,然后按照预设脚本中的设置方法,对照插件脚本来修改应该可以


【RMVA教程】
---------------------
欲买桂花同载酒,终不似,少年游.
回复

使用道具 举报

梦石
0
星屑
199
在线时间
1452 小时
注册时间
2010-9-23
回帖
492
发表于 2016-4-20 10:15:55 | 显示全部楼层





  1.     #==============================================================================
  2.     # 功能:战斗中显示敌人血和蓝于敌人脚下
  3.     # 适用:RMVX Ace
  4.     # 作者:殇殃 2012.3.10
  5.     # 使用方法:复制整个脚本插入到Main之前
  6.     # 注意:由于血条是显示在敌人脚下,所以敌群的位置不能太靠底部,不然会被挡住。
  7.     #       可以自行更改坐标修改显示位置、血条的颜色等。
  8.     #==============================================================================
  9.     # ■ Window_Base
  10.     #------------------------------------------------------------------------------
  11.     #  游戏中全部窗口的超级类。
  12.     #==============================================================================

  13.     class Window_Base < Window
  14.       #--------------------------------------------------------------------------
  15.       # ● 描绘敌人HP
  16.       #--------------------------------------------------------------------------
  17.       def draw_enemy_hp(enemy, x, y, width = 80)
  18.         draw_gauge(x, y, width, enemy.hp_rate, hp_gauge_color1, hp_gauge_color2)
  19.         self.contents.font.color = system_color
  20.         self.contents.draw_text(x, y, 30, line_height, Vocab::hp_a)
  21.         self.contents.font.color = hp_color(enemy)
  22.         self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.hp, 2)
  23.         #一个数字占16像素
  24.       end
  25.       #--------------------------------------------------------------------------
  26.       # ● 绘制敌人MP
  27.       #--------------------------------------------------------------------------
  28.       def draw_enemy_mp(enemy, x, y, width = 80)
  29.         draw_gauge(x, y, width, enemy.mp_rate, mp_gauge_color1, mp_gauge_color2)
  30.         self.contents.font.color = system_color
  31.         self.contents.draw_text(x, y, 30, line_height, Vocab::mp_a)
  32.         self.contents.font.color = mp_color(enemy)
  33.         self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.mp, 2)
  34.       end
  35.     end
  36.     #==============================================================================
  37.     # ■ Sprite_Battler
  38.     #------------------------------------------------------------------------------
  39.     #  战斗显示用活动块。Game_Battler 类的实例监视、
  40.     # 活动块的状态的监视、活动块状态自动变化。
  41.     #==============================================================================

  42.     class Sprite_Battler < Sprite_Base
  43.       #--------------------------------------------------------------------------
  44.       # ● 初始化对象
  45.       #     viewport : 视区
  46.       #     battler  : 战斗者 (Game_Battler)
  47.       #--------------------------------------------------------------------------
  48.       def initialize(viewport, battler = nil)
  49.         super(viewport)
  50.         @battler = battler
  51.         @battler_visible = false
  52.         @effect_type = nil      
  53.         @effect_duration = 0   
  54.         if @battler.is_a?(Game_Enemy)
  55.           width = 24 + 80 #边距12*2+血条的长度(在draw_enemy_hp中定义)
  56.           height = 24 + 24*2 #边距12*2+line_height*2
  57.           x = @battler.screen_x - width/2 #screen_x是怪物图片水平方向上的中点位置
  58.           y = @battler.screen_y - 12 #边距12,显示HP/MP的窗口无边框
  59.           @enemy_hpmp_window = Window_Base.new(x, y, width, height)
  60.           @enemy_hpmp_window.opacity = 0
  61.           @enemy_hpmp_window.contents = Bitmap.new(width - 24, height - 24)#位图比窗口小24像素取消边框
  62.           @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0)
  63.           @old_hp = -1
  64.           @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24)
  65.           @old_mp = -1
  66.         end
  67.       end
  68.       #--------------------------------------------------------------------------
  69.       # ● 释放
  70.       #--------------------------------------------------------------------------
  71.       def dispose
  72.         if self.bitmap != nil
  73.           self.bitmap.dispose
  74.           @enemy_hpmp_window.dispose
  75.         end
  76.         super
  77.       end
  78.       #--------------------------------------------------------------------------
  79.       # ● 更新画面
  80.       #--------------------------------------------------------------------------
  81.       def update
  82.         super
  83.         if @battler == nil
  84.           self.bitmap = nil
  85.         else
  86.           @use_sprite = @battler.use_sprite?
  87.           if @use_sprite
  88.             update_bitmap
  89.             update_origin
  90.             update_position
  91.           end
  92.           setup_new_effect
  93.           setup_new_animation
  94.           update_effect
  95.           if @enemy_hpmp_window != nil and (@old_hp != @battler.hp or @old_mp != @battler.mp)
  96.             if @battler.hp == 0
  97.               @enemy_hpmp_window.hide
  98.             else
  99.               @enemy_hpmp_window.contents.clear
  100.               @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0)
  101.               @old_hp = @battler.hp
  102.               @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24)
  103.               @old_mp = @battler.mp
  104.               @enemy_hpmp_window.show #怪物死后再被复活
  105.             end #if battler.hp == 0
  106.           end
  107.         end #if @battler == nil
  108.       end

  109.     end
复制代码

点评

这个脚本我用过,完美显示,就是不怎么美观 嘻嘻  发表于 2016-4-20 13:59

评分

参与人数 1赞 +1 收起 理由
匿名RM爱好者 + 1 帮忙了老铁!

查看全部评分

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部