加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
使用方法:使用以下事件脚本
start_pedometer 1
将变量1设置为计步器,以后每走一步变量1的值+1
start_pedometer 2, 3
将变量2设置为计步器,并初始化为3
stop_pedometer 3
停止变量3的计步
stop_pedometer
停止所有变量的计步
#-------------------------------------------------------------------------- # ● require Taroxd基础设置 #-------------------------------------------------------------------------- class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- def_after(:initialize) { @pedometer = [] } #-------------------------------------------------------------------------- # ● 开始计步器 #-------------------------------------------------------------------------- def start_pedometer(var_id, count = nil) @pedometer << var_id unless @pedometer.include?(var_id) $game_variables[var_id] = count if count end #-------------------------------------------------------------------------- # ● 停止计步器 #-------------------------------------------------------------------------- def stop_pedometer(var_id = nil) var_id ? @pedometer.delete(var_id) : @pedometer.clear end #-------------------------------------------------------------------------- # ● 计步 #-------------------------------------------------------------------------- def_after :on_player_walk do @pedometer.each {|var_id| $game_variables[var_id] += 1 } end end class Game_Interpreter #-------------------------------------------------------------------------- # ● 开始 #-------------------------------------------------------------------------- def start_pedometer(var_id, count = nil) $game_party.start_pedometer(var_id, count) end #-------------------------------------------------------------------------- # ● 停止 #-------------------------------------------------------------------------- def stop_pedometer(var_id = nil) $game_party.stop_pedometer(var_id) end end
#--------------------------------------------------------------------------
# ● require Taroxd基础设置
#--------------------------------------------------------------------------
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def_after(:initialize) { @pedometer = [] }
#--------------------------------------------------------------------------
# ● 开始计步器
#--------------------------------------------------------------------------
def start_pedometer(var_id, count = nil)
@pedometer << var_id unless @pedometer.include?(var_id)
$game_variables[var_id] = count if count
end
#--------------------------------------------------------------------------
# ● 停止计步器
#--------------------------------------------------------------------------
def stop_pedometer(var_id = nil)
var_id ? @pedometer.delete(var_id) : @pedometer.clear
end
#--------------------------------------------------------------------------
# ● 计步
#--------------------------------------------------------------------------
def_after :on_player_walk do
@pedometer.each {|var_id| $game_variables[var_id] += 1 }
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 开始
#--------------------------------------------------------------------------
def start_pedometer(var_id, count = nil)
$game_party.start_pedometer(var_id, count)
end
#--------------------------------------------------------------------------
# ● 停止
#--------------------------------------------------------------------------
def stop_pedometer(var_id = nil)
$game_party.stop_pedometer(var_id)
end
end
|