Project1
标题:
用脚本在地图上显示血条的一些问题
[打印本页]
作者:
鲜鲜兔
时间:
2010-9-14 00:45
标题:
用脚本在地图上显示血条的一些问题
本帖最后由 鲜鲜兔 于 2010-9-23 18:39 编辑
我用的是下面这个脚本,这个脚本只默认显示带头者的血条,而我想实现显示整队人的血条,我已经做了一些修改,添加了 for i in ...$game_party.actors.size 等等这样的语句,结果
actor = $game_party.actors
出现这样的效果:例如初期是三个人,只能显示2个人的血条,中途加人就更不可能显示了;另外,中途减人最最离谱,明明就剩1个人了,地图上居然还显示2个人的血条,狂汗 -_-|||
到底是什么原因造成的丫,麻烦各位高手帮我解答一下,多谢了!!!
DT_SWITCH = 66
#有问题,找蚂蚁 redant修改
#_______________________________________________________________________________
# MOG_MPW HUD Elena V2.0
#_______________________________________________________________________________
# By Moghunter
# [url]http://www.atelier-rgss.com[/url]
#_______________________________________________________________________________
module MOG
#HUD Position.
STMAPX = -10 # X Pos
STMAPY = 410 # Y Pos
STMAPVIS = 1 #Disable HUD Switch ID.
STMAPSKIN = "" #Windowskin name.
STMAPOPA = 0 #Window Opacity.
end
$mogscript = {} if $mogscript == nil
$mogscript["mpstelen"] = true
#=============================================#
#window_Base #
#=============================================#
class Window_Base < Window
def draw_maphp2(actor, x, y)
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
text = RPG::Cache.picture("Bar_Meter")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt( 56+140*i, 13, text, src_rect)
meter = RPG::Cache.picture("HP_Meter")
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt( 56+140*i ,13 , meter, src_rect)
end
end
def draw_mapsp2(actor, x, y)
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
text = RPG::Cache.picture("Bar_Meter")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt( 56+140*i, 25, text, src_rect)
meter = RPG::Cache.picture("SP_Meter")
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt( 56+140*i, 25, meter, src_rect)
end
end
def draw_mexp(actor, x, y)
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
bitmap = RPG::Cache.picture("Exp_Meter")
if actor.level < 99
cw = bitmap.width * rate
else
cw = bitmap.width
end
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(56 ,37, bitmap, src_rect)
end
end
def nada
face = RPG::Cache.picture("")
end
def draw_heroface(actor,x,y) #"Graphics/system/menu/headp/" + actor.name + ".png"
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
face = RPG::Cache.picture($game_party.actors[i].name) rescue nada
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(0+140*i , 8, face, src_rect)
end
end
end
#=====================================================#
# Game_Actor #
#=====================================================#
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#=====================================================#
# Window_Status_Map #
#=====================================================#
class Window_Sthero < Window_Base
def initialize
super(0, 0, 310, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin(MOG::STMAPSKIN)
self.contents.font.bold = true
self.contents.font.size = 20
self.contents.font.name = "Georgia"
self.opacity = MOG::STMAPOPA
refresh
end
def refresh
if $game_switches[DT_SWITCH]
self.contents.clear
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
draw_maphp2(actor, 35, 35)
draw_mapsp2(actor, - 40, 60)
draw_hpstore(actor, 100, 10) #*************************
# draw_mexp(actor, 100, 10)
draw_heroface(actor, 0, 70)
end
end
end
end
#====================================================#
# Game_Player #
#====================================================#
class Game_Player < Game_Character
attr_accessor :wref
end
#====================================================#
# Scene_Map #
#====================================================#
class Scene_Map
alias mog11_main main
def main
@sthero = Window_Sthero.new
@sthero.x = MOG::STMAPX
@sthero.y = MOG::STMAPY
if $game_switches[MOG::STMAPVIS] == false
@sthero.visible = true
else
@sthero.visible = false
end
mog11_main
@sthero.dispose
end
alias mog11_update update
def update
mog11_update
if $game_switches[MOG::STMAPVIS] == false
@sthero.visible = true
else
@sthero.visible = false
end
if $game_switches[DT_SWITCH]
@sthero.visible = true
if $game_player.wref == true
@sthero.refresh
$game_player.wref = false
end
else
@sthero.visible = false
$game_player.wref = false
end
end
end
#======================================================#
# Game_Party #
#======================================================#
class Game_Party
alias mog11_check_map_slip_damage check_map_slip_damage
def check_map_slip_damage
for actor in @actors
if actor.hp > 0 and actor.slip_damage?
$game_player.wref = true
end
end
mog11_check_map_slip_damage
end
end
#=====================================================#
# Interpreter #
#=====================================================#
class Interpreter
alias mog11_command_311 command_311
def command_311
mog11_command_311
$game_player.wref = true
end
alias mog11_command_312 command_312
def command_312
mog11_command_312
$game_player.wref = true
end
alias mog11_command_313 command_313
def command_313
mog11_command_313
$game_player.wref = true
end
alias mog11_command_314 command_314
def command_314
mog11_command_314
$game_player.wref = true
end
alias mog11_command_315 command_315
def command_315
mog11_command_315
$game_player.wref = true
end
end
#====================================================#
# Game_Battler #
#====================================================#
class Game_Battler
alias mog11_attack_effect attack_effect
def attack_effect(attacker)
mog11_attack_effect(attacker)
$game_player.wref = true
end
alias mog11_skill_effect skill_effect
def skill_effect(user, skill)
mog11_skill_effect(user, skill)
$game_player.wref = true
end
alias mog11_item_effect item_effect
def item_effect(item)
mog11_item_effect(item)
$game_player.wref = true
end
alias mog11_add_state add_state
def add_state(state_id, force = false)
mog11_add_state(state_id, force = false)
$game_player.wref = true
end
end
复制代码
作者:
fux2
时间:
2010-9-14 17:06
回复
鲜鲜兔
的帖子
在队员加入时初始化一次这个脚本。
作者:
seasoneast
时间:
2010-9-14 22:03
本帖最后由 seasoneast 于 2010-9-16 08:12 编辑
回复
鲜鲜兔
的帖子
你可以试试这个,范例里面有说明,地图上显示小队名称,生命值,魔法值,状态,可自行修改显示哪些数据,增减队员都没有问题。
Project1.rar
(186.62 KB, 下载次数: 363)
2010-9-16 08:12 上传
点击文件名下载附件
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1