Project1
标题:
在地图上显示等级
[打印本页]
作者:
79904396
时间:
2011-4-25 16:46
标题:
在地图上显示等级
就是需要一个小窗口,显示角色的等级
“您现在的等级为:*”
就是这样……
以前获得过一个脚本:
#==============================================================================
# ■ Window_Actorlevel
#------------------------------------------------------------------------------
# 显示角色等级的窗口。
#==============================================================================
class Window_Actorlevel < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 100)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor_x = i * 160
draw_actor_level(actor, actor_x, 10)
end
end
end
class Scene_Map
alias old_main main
def main
@Window_Actorlevel = Window_Actorlevel.new
old_main
@Window_Actorlevel.dispose
end
end
但是这个脚本一不可以更改显示的文字“您现在的等级为……”,第二我发现即使我人物的等级变了它还是显示为1……
所以……求教新脚本或> <更正方法 dsu_plus_rewardpost_czw
作者:
沙漠点灰
时间:
2011-4-25 17:19
本帖最后由 沙漠点灰 于 2011-4-25 17:40 编辑
回复
79904396
的帖子
#==============================================================================
# ■ Window_Actorlevel
#------------------------------------------------------------------------------
# 显示角色等级的窗口。
#==============================================================================
class Window_Actorlevel < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 100)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@lv = $game_party.actors.inject([]){|a,i|a<<i.level}
self.contents.clear ; x = 0
$game_party.actors.each {|i|
self.contents.draw_text(x % 2* 320, x/2 * 32, 200, 32, "#{i.name} 等级:#{i.level}" , 0)
x += 1
}
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update
super
refresh if @lv != $game_party.actors.inject([]){|a,i|a<<i.level}
end
end
class Scene_Map
alias old_main main unless Scene_Map.method_defined? "old_main"
def main
@Window_Actorlevel = Window_Actorlevel.new
old_main
@Window_Actorlevel.dispose
end
alias old_update_ update unless Scene_Map.method_defined? "old_update_"
def update
old_update_
@Window_Actorlevel.visible = $game_switches[99]
@Window_Actorlevel.update
end
end
复制代码
修改完毕,这个窗口怎么没有出现?
把游戏开关99打开就会出现窗口,关掉99号开关就消失了
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1