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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
30 小时
注册时间
2015-5-6
帖子
40
跳转到指定楼层
1
发表于 2016-4-20 01:46:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
血条的有很多,貌似没见到有蓝条的,伸手一回

Lv3.寻梦者

梦石
0
星屑
1297
在线时间
995 小时
注册时间
2014-12-14
帖子
3016

开拓者

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


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

使用道具 举报

Lv2.观梦者

梦石
0
星屑
400
在线时间
1400 小时
注册时间
2010-9-23
帖子
557
3
发表于 2016-4-20 10:15:55 | 只看该作者





RUBY 代码复制
  1. #==============================================================================
  2.     # 功能:战斗中显示敌人血和蓝于敌人脚下
  3.     # 适用:RMVX Ace
  4.     # 作者:殇殃 2012.3.10
  5.     # 使用方法:复制整个脚本插入到Main之前
  6.     # 注意:由于血条是显示在敌人脚下,所以敌群的位置不能太靠底部,不然会被挡住。
  7.     #       可以自行更改坐标修改显示位置、血条的颜色等。
  8.     #==============================================================================
  9.     # ■ Window_Base
  10.     #------------------------------------------------------------------------------
  11.     #  游戏中全部窗口的超级类。
  12.     #==============================================================================
  13.  
  14.     class Window_Base < Window
  15.       #--------------------------------------------------------------------------
  16.       # ● 描绘敌人HP
  17.       #--------------------------------------------------------------------------
  18.       def draw_enemy_hp(enemy, x, y, width = 80)
  19.         draw_gauge(x, y, width, enemy.hp_rate, hp_gauge_color1, hp_gauge_color2)
  20.         self.contents.font.color = system_color
  21.         self.contents.draw_text(x, y, 30, line_height, Vocab::hp_a)
  22.         self.contents.font.color = hp_color(enemy)
  23.         self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.hp, 2)
  24.         #一个数字占16像素
  25.       end
  26.       #--------------------------------------------------------------------------
  27.       # ● 绘制敌人MP
  28.       #--------------------------------------------------------------------------
  29.       def draw_enemy_mp(enemy, x, y, width = 80)
  30.         draw_gauge(x, y, width, enemy.mp_rate, mp_gauge_color1, mp_gauge_color2)
  31.         self.contents.font.color = system_color
  32.         self.contents.draw_text(x, y, 30, line_height, Vocab::mp_a)
  33.         self.contents.font.color = mp_color(enemy)
  34.         self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.mp, 2)
  35.       end
  36.     end
  37.     #==============================================================================
  38.     # ■ Sprite_Battler
  39.     #------------------------------------------------------------------------------
  40.     #  战斗显示用活动块。Game_Battler 类的实例监视、
  41.     # 活动块的状态的监视、活动块状态自动变化。
  42.     #==============================================================================
  43.  
  44.     class Sprite_Battler < Sprite_Base
  45.       #--------------------------------------------------------------------------
  46.       # ● 初始化对象
  47.       #     viewport : 视区
  48.       #     battler  : 战斗者 (Game_Battler)
  49.       #--------------------------------------------------------------------------
  50.       def initialize(viewport, battler = nil)
  51.         super(viewport)
  52.         @battler = battler
  53.         @battler_visible = false
  54.         @effect_type = nil      
  55.         @effect_duration = 0   
  56.         if @battler.is_a?(Game_Enemy)
  57.           width = 24 + 80 #边距12*2+血条的长度(在draw_enemy_hp中定义)
  58.           height = 24 + 24*2 #边距12*2+line_height*2
  59.           x = @battler.screen_x - width/2 #screen_x是怪物图片水平方向上的中点位置
  60.           y = @battler.screen_y - 12 #边距12,显示HP/MP的窗口无边框
  61.           @enemy_hpmp_window = Window_Base.new(x, y, width, height)
  62.           @enemy_hpmp_window.opacity = 0
  63.           @enemy_hpmp_window.contents = Bitmap.new(width - 24, height - 24)#位图比窗口小24像素取消边框
  64.           @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0)
  65.           @old_hp = -1
  66.           @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24)
  67.           @old_mp = -1
  68.         end
  69.       end
  70.       #--------------------------------------------------------------------------
  71.       # ● 释放
  72.       #--------------------------------------------------------------------------
  73.       def dispose
  74.         if self.bitmap != nil
  75.           self.bitmap.dispose
  76.           @enemy_hpmp_window.dispose
  77.         end
  78.         super
  79.       end
  80.       #--------------------------------------------------------------------------
  81.       # ● 更新画面
  82.       #--------------------------------------------------------------------------
  83.       def update
  84.         super
  85.         if @battler == nil
  86.           self.bitmap = nil
  87.         else
  88.           @use_sprite = @battler.use_sprite?
  89.           if @use_sprite
  90.             update_bitmap
  91.             update_origin
  92.             update_position
  93.           end
  94.           setup_new_effect
  95.           setup_new_animation
  96.           update_effect
  97.           if @enemy_hpmp_window != nil and (@old_hp != @battler.hp or @old_mp != @battler.mp)
  98.             if @battler.hp == 0
  99.               @enemy_hpmp_window.hide
  100.             else
  101.               @enemy_hpmp_window.contents.clear
  102.               @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0)
  103.               @old_hp = @battler.hp
  104.               @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24)
  105.               @old_mp = @battler.mp
  106.               @enemy_hpmp_window.show #怪物死后再被复活
  107.             end #if battler.hp == 0
  108.           end
  109.         end #if @battler == nil
  110.       end
  111.  
  112.     end

点评

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

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-21 03:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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