脚本中有关于前后卫位置的设定。
具体在Game_Party中的random_target_actor方法:
[pre lang="Ruby"]def random_target_actor(hp0 = false)
# 初始化轮流
roulette = []
# 循环
for actor in @actors
# 符合条件的场合
if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
# 获取角色职业的位置 [位置]
position = $data_classes[actor.class_id].position
# 前卫的话 n = 4、中卫的话 n = 3、后卫的话 n = 2
n = 4 - position
# 添加角色的轮流 n 回
n.times do
roulette.push(actor)
end
end
end
# 轮流大小为 0 的情况
if roulette.size == 0
return nil
end
# 转轮盘赌,决定角色
return roulette[rand(roulette.size)]
end
[/pre]
这里面的这个部分:
[pre lang="Ruby"]# 前卫的话 n = 4、中卫的话 n = 3、后卫的话 n = 2
n = 4 - position[/pre]
position代表角色位置的编号,前卫为0,中卫为1,后卫为2,计算出的权重相应为4,3,2
如要更改,可以这样(用下面这个脚本替换上面的):
[pre lang="Ruby"]case position
when 0
n = 7
when 1
n = 2
when 2
n = 1
else
n = 0
end[/pre]
def random_target_actor(hp0 = false)
# 初始化轮流
roulette = []
# 循环
for actor in @actors
# 符合条件的场合
if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
# 获取角色职业的位置 [位置]
position = $data_classes[actor.class_id].position
# 前卫的话 n = 4、中卫的话 n = 3、后卫的话 n = 2
# n = 4 - position
case position
when 0
n = 7
when 1
n = 2
when 2
n = 1
else
n = 0
end
# 添加角色的轮流 n 回
n.times do
roulette.push(actor)
end
end
end
# 轮流大小为 0 的情况
if roulette.size == 0
return nil
end
# 转轮盘赌,决定角色
return roulette[rand(roulette.size)]
end