Project1
标题:
给脚本添加开关的问题
[打印本页]
作者:
calvin0703
时间:
2011-3-18 22:25
标题:
给脚本添加开关的问题
#==============================================================================
# ■ Window_Actorlevel
#------------------------------------------------------------------------------
# 显示角色等级的窗口。
#==============================================================================
class Window_Actorlevel < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize
super(80, -9, 640, 100)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
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
复制代码
这是忧雪の伤大大给的显示角色等级脚本 我想要给这脚本弄个开关 XX开关打开 脚本就会停止运行 该怎么弄???
dsu_plus_rewardpost_czw
作者:
天帝·隳
时间:
2011-3-18 23:19
本帖最后由 天帝·隳 于 2011-3-18 23:19 编辑
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
#如果1號開關打開~
if $game_switches[1] == true
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
复制代码
作者:
Wind2010
时间:
2011-3-19 11:50
回复
天帝·隳
的帖子
最上面加
class Window_Actorlevel < Window_Base
然后下面多加一个end?
作者:
天帝·隳
时间:
2011-3-19 17:17
……直接修改那個refresh定義~
作者:
忧雪の伤
时间:
2011-3-19 17:43
id = 5 # 开关id
class Scene_Map
alias old_update update
def update
case $game_switches[id]
when true
@Window_Actorlevel.visible = false
when false
@Window_Actorlevel.visible = true
end
old_update
end
end
复制代码
作者:
沙漠点灰
时间:
2011-3-19 17:55
回复
calvin0703
的帖子
#==============================================================================
# ■ Window_Actorlevel
#------------------------------------------------------------------------------
# 显示角色等级的窗口。
#==============================================================================
class Window_Actorlevel < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize
super(80, -9, 640, 100)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
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
@Window_Actorlevel.visible = false
old_main
@Window_Actorlevel.dispose
end
alias old_update update
def update
@Window_Actorlevel.visible = $game_switches[1]
old_update
end
end
复制代码
脚本中 $game_switches 的[]里面是开关的编号...
打开是显示,关掉是隐藏
直接 visible 就好了嘛 干吗重新定义refresh
作者:
忧雪の伤
时间:
2011-3-19 18:50
沙漠点灰 发表于 2011-3-19 17:55
回复 calvin0703 的帖子
脚本中 $game_switches 的[]里面是开关的编号...
汝要知道我是脚本作者……
不是我来解决的话挺囧。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1