移植完毕(其实只改了几个字= =|||)[fold=点我看代码即插即用]
[pre lang="ruby"]class Game_Character
#--------------------------------------------------------------------------
# ● 移动类型 : 自定义
#--------------------------------------------------------------------------
def move_type_custom
# 如果不是停止中就中断
if jumping? or moving?
return
end
# 如果在移动指令列表最后结束还没到达就循环执行
while @move_route_index < @move_route.list.size
# 获取移动指令
command = @move_route.list[@move_route_index]
# 指令编号 0 号 (列表最后) 的情况下
if command.code == 0
# 选项 [反复动作] 为 ON 的情况下
if @move_route.repeat
# 还原为移动路线的最初索引
@move_route_index = 0
end
# 选项 [反复动作] 为 OFF 的情况下
unless @move_route.repeat
# 强制移动路线的场合
if @move_route_forcing and not @move_route.repeat
# 强制解除移动路线
@move_route_forcing = false
# 还原为原始的移动路线
@move_route = @original_move_route
@move_route_index = @original_move_route_index
@original_move_route = nil
end
# 清除停止计数
@stop_count = 0
end
return
end
# 移动系指令 (向下移动~跳跃) 的情况下
if command.code <= 14
# 命令编号分支
case command.code
when 1 # 向下移动
move_down
when 2 # 向左移动
move_left
when 3 # 向右移动
move_right
when 4 # 向上移动
move_up
when 5 # 向左下移动
move_lower_left
when 6 # 向右下移动
move_lower_right
when 7 # 向左上移动
move_upper_left
when 8 # 向右上
move_upper_right
when 9 # 随机移动
move_random
when 10 # 接近主角
move_toward_player
when 11 # 远离主角
move_away_from_player
when 12 # 前进一步
move_forward
when 13 # 后退一步
move_backward
when 14 # 跳跃
jump(command.parameters[0], command.parameters[1])
end
# 选项 [无视无法移动的情况] 为 OFF 、移动失败的情况下
if not @move_route.skippable and not moving? and not jumping?
return
end
@move_route_index += 1
return
end
# 等待的情况下
if command.code == 15
# 设置等待计数
@wait_count = command.parameters[0] * 2 - 1
@move_route_index += 1
return
end
# 朝向变更系指令的情况下
if command.code >= 16 and command.code <= 26
# 命令编号分支
case command.code
when 16 # 面向下
turn_down
when 17 # 面向左
turn_left
when 18 # 面向右
turn_right
when 19 # 面向上
turn_up
when 20 # 向右转 90 度
turn_right_90
when 21 # 向左转 90 度
turn_left_90
when 22 # 旋转 180 度
turn_180
when 23 # 从右向左转 90 度
turn_right_or_left_90
when 24 # 随机变换方向
turn_random
when 25 # 面向主角的方向
turn_toward_player
when 26 # 背向主角的方向
turn_away_from_player
end
@move_route_index += 1
return
end
# 其它指令的场合
if command.code >= 27
# 命令编号分支
case command.code
when 27 # 开关 ON
$game_switches[command.parameters[0]] = true
$game_map.need_refresh = true
when 28 # 开关 OFF
$game_switches[command.parameters[0]] = false
$game_map.need_refresh = true
when 29 # 更改移动速度
@move_speed = command.parameters[0]
when 30 # 更改移动频度
@move_frequency = command.parameters[0]
when 31 # 移动时动画 ON
@walk_anime = true
when 32 # 移动时动画 OFF
@walk_anime = false
when 33 # 停止时动画 ON
@step_anime = true
when 34 # 停止时动画 OFF
@step_anime = false
when 35 # 朝向固定 ON
@direction_fix = true
when 36 # 朝向固定 OFF
@direction_fix = false
when 37 # 穿透 ON
@through = true
when 38 # 穿透 OFF
@through = false
when 39 # 在最前面显示 ON
@always_on_top = true
when 40 # 在最前面显示 OFF
@always_on_top = false
when 41 # 更改图形
@tile_id = 0
@character_name = command.parameters[0]
@character_hue = command.parameters[1]
if @original_direction != command.parameters[2]
@direction = command.parameters[2]
@original_direction = @direction
@prelock_direction = 0
end
if @original_pattern != command.parameters[3]
@pattern = command.parameters[3]
@original_pattern = @pattern
end
when 42 # 更改不透明度
@opacity = command.parameters[0]
when 43 # 更改合成方式
@blend_type = command.parameters[0]
when 44 # 演奏 SE
$game_system.se_play(command.parameters[0])
when 45 # ★ 脚本
case command.parameters[0]
when /if\s(.+)/
@flag = route_eval($1)
command_skip(/else|end/) unless @flag
when "else"
command_skip("end") if @flag
when "end"
else
result = eval(command.parameters[0])
end
end
@move_route_index += 1
end
end
end
def command_skip(text)
@move_route_index += 1
loop do
command = @move_route.list[@move_route_index]
if command.code == 45
case command.parameters[0]
when /^if\s(.+)/
command_skip("end")
when text
return
end
end
@move_route_index += 1
end
end
def route_eval(formula)
s, v = $game_switches, $game_variables
begin
eval(formula)
rescue
print "表达式有误 >///< ↓\n\n", formula
true
end
end
end
[/pre][/fold]
功能和原脚本一样 只能用 if~(else)~end, 其中 s=开关 v=变量 用法见原帖