| 赞 | 5 |
| VIP | |
| 好人卡 | |
| 积分 | 11 |
| 经验 | |
| 最后登录 | 2025-3-11 |
| 在线时间 | 324 小时 |
- 梦石
- 0
- 星屑
- 1090
- 在线时间
- 324 小时
- 注册时间
- 2017-1-24
- 回帖
- 105

|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 戴迪 于 2017-8-20 22:52 编辑
★本人也不保证脚本完美无错误,有什么BUG欢迎留言提出~有时间就会去修改
=====================#↑说在前面的话↑#==================================
★之前有人说有自己的HP,SP条图片,想导入进自己的素材.于是乎我又开始折磨自己(新手不易),最终有了加强版的脚本~可以实现地图显示HP/SP槽的图片,头像和金钱数(华丽的血槽在你手中)
★添加了随角色变化而变化的头像,这方面要感谢芯☆淡茹水大神的指导!
★范例里有原始版本
★老是忘了些细节东西,所以又修改了下范例......
★下面是脚本:
脚本[pre lang="ruby" line="1"]#==============================================================================
# ■地图显示HP/SP槽 + 金钱数量 +头像
# -by:戴迪
# -2017.6.17
#-Ver1.1
#------------------------------------------------------------------------------
#-可自行更改HP/SP槽的大小,显示的坐标.
#-有能力的还可自行添加EXP,等级显示等.
#-HP/SP槽与上一脚本相比,采用了显示图片的方法,使得大家可以导入精美的血条/蓝条图.
#-添加了随角色变化而变化的头像,这方面要感谢芯☆淡茹水大神的指导!
#------------------------------------------------------------------------------
#使用方法:
#1.在Main之前插入此脚本,
#
#2.在Scene_Map里,找到"●主处理下"的 # 生成信息窗口,添加
# @mapshow = Window_Mapshow.new
# @mapshow.opacity = 60 #-------------------------------更改窗口透明度
# 再往下滑,找到 # 释放信息窗口,添加
# @mapshow.dispose
# 再往下滑.....找到"●刷新画面"下的 #刷新信息窗口,添加
# @mapshow.update
#3.将自己准备好的头像,HP/SP条的图片放在"Graphics/Pictures/"这个目录下,
# 头像的名字要与角色的名字一致!
# HP,SP槽的名字分别为"HP""SP".HP/SP槽的底图为"back_bar"/"back_bar_2"
#
# 完毕.
#
#==============================================================================
# ■ Window_Mapshow
#------------------------------------------------------------------------------
# 显示血条的窗口。
#==============================================================================
class Window_Mapshow < Window_Base
Hide_Window_Mapshow = 33 #-----控制窗口的开关为33号开关
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@bmp_HP = Bitmap.new("Graphics/Pictures/HP")
@bmp_SP = Bitmap.new("Graphics/Pictures/SP")
@bmp_back_bar = Bitmap.new("Graphics/Pictures/back_bar")#这里是底图,不要的话可以删
@bmp_back_bar2 = Bitmap.new("Graphics/Pictures/back_bar_2")#这里是底图,不要的话可以删
refresh
end # ↓
#--------------------------------------------------------------------↓
# ● 释放 ↓
#--------------------------------------------------------------------↓
def dispose # ↓
super # ↓
@bmp_HP.dispose
@bmp_SP.dispose
@bmp_back_bar.dispose #要删这里也一起删~
@bmp_back_bar2.dispose #要删这里也一起删~
end
#--------------------------------------------------------------------------
# ● 描绘HP槽
#--------------------------------------------------------------------------
def draw_actor_hp_bar(actor, x, y,width = 200)
w1 = (1.0 * $game_party.actors[0].hp / $game_party.actors[0].maxhp) * width
w1_1 = (1.0 * $game_party.actors[0].maxhp) * width
rect = Rect.new(0,0,w1_1,@bmp_back_bar.height)
self.contents.blt(40,0,@bmp_back_bar,rect,180)
rect = Rect.new(0,0,w1,@bmp_HP.height)
self.contents.blt(40,0,@bmp_HP,rect,255)
end
#--------------------------------------------------------------------------
# ● 描绘SP槽
#--------------------------------------------------------------------------
def draw_actor_sp_bar(actor, x, y,width = 200)
w2 = (1.0 * $game_party.actors[0].sp / $game_party.actors[0].maxsp) * width
w2_2 = (1.0 * $game_party.actors[0].maxsp) * width
rect = Rect.new(0,0,w2_2,@bmp_back_bar2.height)
self.contents.blt(280,0,@bmp_back_bar2,rect,180)
rect = Rect.new(0,0,w2,@bmp_SP.height)
self.contents.blt(280,0,@bmp_SP,rect,255)
end
#--------------------------------------------------------------------------
# ● 描绘头像
#--------------------------------------------------------------------------
def draw_actor_head(actor, x, y,width = 92)
bitmap = Bitmap.new("Graphics/Pictures/#{actor.name}")
rect = Rect.new(0,0,bitmap.width,bitmap.height)
self.contents.blt(0,0,bitmap,rect,225)
end
#--------------------------------------------------------------------------
# ● 描绘金钱数目
#--------------------------------------------------------------------------
def draw_actor_gold(actor, x, y,width = 200)
cx = contents.text_size($data_system.words.gold).width #cx = 11
self.contents.font.color = normal_color
self.contents.draw_text(538, 4, 64-cx-2 ,32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(600-cx, 4, cx, 32, $data_system.words.gold, 2)
end
#--------------------------------------------------------------------------
# ● 刷新--通常在这绘制位图
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_hp_bar($game_party.actors[0], 0, 20)
draw_actor_sp_bar($game_party.actors[0], 0, 20)
draw_actor_gold($game_party.gold.to_s, 0, 20)
draw_actor_head($game_party.actors[0], x, y,width = 92)
self.contents.font.color = Color.new(0,0,0,255) #---------此处加阴影
self.contents.draw_text(41,4 , 36, 32, "HP:")
self.contents.draw_text(38 + 40,4 , 36, 32,$game_party.actors[0].hp.to_s)
self.contents.draw_text(38 + 90,0 + 5, 36, 32, "/")
self.contents.draw_text(38 + 60 + 40,0 + 5, 36, 32,$game_party.actors[0].maxhp.to_s)
self.contents.draw_text(1 + 280,4 , 36, 32, "SP:")
self.contents.draw_text(38 + 280,4 , 36, 32,$game_party.actors[0].sp.to_s)
self.contents.draw_text(38 + 50 + 280,0 + 5, 36, 32, "/")
self.contents.draw_text(38 + 70 + 280,0 + 5, 36, 32,$game_party.actors[0].maxsp.to_s)
self.contents.draw_text(0,40 , 100, 32, "#{$game_party.actors[0].name}")
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(40,4 , 36, 32, "HP:")
self.contents.draw_text(37 + 40,4 , 36, 32,$game_party.actors[0].hp.to_s)
self.contents.draw_text(37 + 90,0 + 5, 36, 32, "/")
self.contents.draw_text(37 + 60 + 40,0 + 5, 36, 32,$game_party.actors[0].maxhp.to_s)
self.contents.draw_text(0 + 280,4 , 36, 32, "SP:")
self.contents.draw_text(37 + 280,4 , 36, 32,$game_party.actors[0].sp.to_s)
self.contents.draw_text(37 + 50 + 280,0 + 5, 36, 32, "/")
self.contents.draw_text(37 + 70 + 280,0 + 5, 36, 32,$game_party.actors[0].maxsp.to_s)
end
#--------------------------------------------------------------------------
def need_refresh
return @data_actor != $game_party.actors[0] ||
@data_rest_hp != $game_party.actors[0].hp ||
@data_max_hp != $game_party.actors[0].maxhp ||
@data_rest_sp != $game_party.actors[0].sp ||
@data_max_sp != $game_party.actors[0].maxsp ||
@data_old_gold != $game_party.gold
end
#--------------------------------------------------------------------------
def recorded_data
@data_actor = $game_party.actors[0]
@data_rest_hp = $game_party.actors[0].hp
@data_max_hp = $game_party.actors[0].maxhp
@data_rest_sp = $game_party.actors[0].sp
@data_max_sp = $game_party.actors[0].maxsp
@data_old_gold = $game_party.gold
refresh
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
self.visible = !$game_switches[Hide_Window_Mapshow]
return unless self.visible #-----unless相当于if not
recorded_data if need_refresh
end
end[/pre]
[pre lang="ruby" line="14"] # 生成信息窗口----------------------------------在此处添加窗口
@message_window = Window_Message.new
@mapshow = Window_Mapshow.new
@mapshow.opacity = 20 #------------------------更改窗口透明度[/pre]
[pre lang="ruby" line="37"] # 释放信息窗口--------------------------------记得在此处释放窗口
@message_window.dispose
@mapshow.dispose[/pre]
[pre lang="ruby" line="75"] # 刷新信息窗口----------------------------记得在此处刷新窗口
@message_window.update
@mapshow.update[/pre]
截图1
工程1↓
9_地图显示HP槽头像(加强版).rar
(203.48 KB, 下载次数: 286)
=====================#2017年8月5日03:27:21更新日志#==================================
★偷懒直接把Ver1.0(完善版),Ver1.1(完善版)放在一个工程里了
★Ver1.1(完善版)需要自备图片素材,或者直接用工程里的.改动比较多,偷懒直接上工程了.
★没有准备图片素材的请用Ver1.0(完善版).将Ver1.0(完善版)插入到自己的脚本里,详见脚本内说明(记得去掉集体注释)
★是好是坏吱一声吧,毕竟做了蛮久
截图2(比原先美观,有图为证)
Ver1.1(完善版)
Ver1.0(完善版)
工程2↓
9_地图显示HP槽头像(完善版).rar
(205 KB, 下载次数: 324)
|
评分
-
查看全部评分
|