赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 21790 |
最后登录 | 2017-9-29 |
在线时间 | 28 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 28 小时
- 注册时间
- 2008-12-11
- 帖子
- 124
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
把地图界面的状态显示脚本改了一下,模仿那个邓稼先传的显示效果,不会脚本,自己不敢乱删,还有些问题:比如原来的菜单框没消失,还有人名的长度只显示三个字。。请高手帮忙看下哪些没用的地方可以删掉
原脚本地址:
http://rpg.blue/web/htm/news816.htm
以下是改动过的脚本:彩色部分是自己替换了的地方
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 处理地图画面的类。
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● 在这里控制脚本的属性
#--------------------------------------------------------------------------
SWITCH_ID = 2 #在这里设定开关的编号……
$center_hud = false #这里决定是否将HUD(状态窗口)居中显示……
#--------------------------------------------------------------------------
# ● 初始化别名
#--------------------------------------------------------------------------
alias raz_hud_main main
alias raz_hud_update update
#--------------------------------------------------------------------------
# ● 主进程
#--------------------------------------------------------------------------
def main
@size = $game_party.actors.size
raz_hud_main
@hud_window.dispose
for i in 0...$game_party.actors.size
@hud_dummy.dispose
end #for
end #def
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
if @size != $game_party.actors.size
@hud_window.refresh
show_window
end #if
if @hud != true
main_window
end #if
turn_hud_on_off
@hud_window.update
raz_hud_update
end #def
#--------------------------------------------------------------------------
# ● 与状态窗口的显示行为相关的语句
#--------------------------------------------------------------------------
def show_window
@size = $game_party.actors.size
for i in 0..3
@hud_dummy.visible = ($game_party.actors != nil)
end #for
end #def
#--------------------------------------------------------------------------
# ● 与状态窗口的创建相关的语句
#--------------------------------------------------------------------------
def main_window
@opacity = 130
@hud_dummy = []
for i in 0...4
y = $game_party.actors.size - 1
x = 240 - (y * 80)
if $center_hud == true
@hud_dummy = Window_Base.new(160 * i + x, 372,160, 108)
else
@hud_dummy = Window_Base.new(160 * i, 372,160, 108)
end #if
@hud_dummy.opacity = @opacity
@hud_dummy.visible = false
end #for
@hud_window = Window_HUD.new
for i in 0...$game_party.actors.size
@hud_dummy.visible = $game_party.actors != nil
end #for
@hud = true
end #def
#--------------------------------------------------------------------------
# ● 与状态窗口的开关相关的语句
#--------------------------------------------------------------------------
def turn_hud_on_off
if $game_switches[SWITCH_ID] == false #关掉开关
@hud_window.visible = false
for i in 0...$game_party.actors.size
@hud_dummy.visible = false
end #for
end #if
if $game_switches[SWITCH_ID] == true #打开开关
for i in 0...$game_party.actors.size
end #for
end #if
end #def
end #class
#======================================
# ■ Window Base
#======================================
class Window_Base < Window
#--------------------------------------------------------------------------
def draw_actor_hp_bar(actor, x, y, width = 70, height = 10, bar_color = Color.new(255, 0, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
return if actor.maxhp == 0
w = width * actor.hp / actor.maxhp
for i in 0..height
r = bar_color.red * (height -i)/height
g = bar_color.green * (height -i)/height
b = bar_color.blue * (height -i)/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
def draw_actor_sp_bar(actor, x, y, width = 70, height = 10, bar_color = Color.new(0, 0, 255, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
return if actor.maxsp == 0
w = width * actor.sp / actor.maxsp
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
def draw_dash_bar(x, y, width = 50, height = 10)
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
case $ABS.dash_level
when 0 .. 1
bar_color = Color.new(255, 0, 0, 255)
when 2 .. 3
bar_color = Color.new(255, 255, 0, 255)
else
bar_color = Color.new(0, 255, 0, 255)
end
w = width * $ABS.dash_level / 5
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
def draw_sneak_bar(x, y, width = 50, height = 10)
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
case $ABS.sneak_level
when 0 .. 1
bar_color = Color.new(255, 0, 0, 255)
when 2 .. 3
bar_color = Color.new(255, 255, 0, 255)
else
bar_color = Color.new(0, 255, 0, 255)
end
w = width * $ABS.sneak_level / 5
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
end
#==============================================================================
# ■ Window_HUD
#------------------------------------------------------------------------------
# 地图画面中显示的状态窗口。
#==============================================================================
class Window_HUD < Window_Base
attr_accessor :our_actor
#--------------------------------------------------------------------------
def initialize
super(0, 400, 640, 80)
@our_actor = $game_party.actors[0]
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = 20
self.opacity = 100
draw_actor_graphic($game_party.actors[0], 20, 48)
self.contents.draw_text(40,8,128,20,$game_party.actors[0].name)
update
end
#--------------------------------------------------------------------------
def refresh
self.contents.font.color = normal_color
rect = Rect.new(40, 28, 120, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
rect = Rect.new(100, 0, 540, 64)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
draw_actor_hp_bar($game_party.actors[0], 40, 34)
bitmap = RPG::Cache.icon("021-Potion01")
self.contents.blt(160, 12, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(185,0,200,48,"常规药:")
self.contents.draw_text(185,0,200,48," "+$game_party.item_number(1).to_s)
bitmap = RPG::Cache.icon("022-Potion02")
self.contents.blt(300, 12, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(325,0,200,48,"高级药:")
self.contents.draw_text(325,0,200,48," "+$game_party.item_number(2).to_s)
bitmap = RPG::Cache.icon("006-Weapon06")
self.contents.blt(440, 12, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(465,0,200,48,"飞刀数量:")
self.contents.draw_text(465,0,200,48," "+$game_party.item_number(36).to_s)
Graphics.frame_reset
end
#--------------------------------------------------------------------------
def update
return if Graphics.frame_count % 10 != 0
return if self.visible == false
refresh
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def draw_actor_hp_bar(actor, x, y, width = $game_actors[1].maxhp/11, height = 10)
w = width * actor.hp / [actor.maxhp,1].max
hp_color_1 = Color.new(255, 0, 0, 192)
hp_color_2 = Color.new(255, 255, 0, 192)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
if width == 1
self.contents.set_pixel(x, y, start_color)
else
self.contents.fill_rect(x, y, width, width, start_color)
end
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
if width == 1
self.contents.set_pixel(x, y, Color.new(r, g, b, a))
else
self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor
#获取当前EXP
def now_exp
return @exp - @exp_list[@level]
end #def
#获取下一级需要EXP的数值
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end #def
end
版务信息:本贴由楼主自主结贴~ |
|