#--------------------------------------------------------------------------
# ● 指令“全体上车”
#--------------------------------------------------------------------------
def all_actor_up
for i in 0...$game_party.actors.size
if $game_party.actors[i] <= $game_party.bus_actor
bus_up($game_party.actors[i])
end
end
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ● 指令“全体下车”
#--------------------------------------------------------------------------
def all_actor_down
for i in 0...$game_party.actors.size
if $game_party.actors[i] > $game_party.bus_actor
a = $game_party.actors[i]-$game_party.bus_actor
b = $game_party.bus[a*7+5]
bus_down(b)
end
end
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ● 指令“个别乘降”
#--------------------------------------------------------------------------
def ok
actor = @command_window.current_ext
bus(actor.id)
end
#--------------------------------------------------------------------------
# ● 个别角色判定
#--------------------------------------------------------------------------
def bus(actor)
#判定坐标
if $game_actors[actor].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
elsif $game_actors[actor].index == nil
actor_id_i = $game_party.actor_by[actor]
if $game_actors[actor_id_i].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
else
x = $game_player.followers[$game_actors[actor_id_i].index-1].x
y = $game_player.followers[$game_actors[actor_id_i].index-1].y
d = $game_player.followers[$game_actors[actor_id_i].index-1].direction
end
else
x = $game_player.followers[$game_actors[actor].index-1].x
y = $game_player.followers[$game_actors[actor].index-1].y
d = $game_player.followers[$game_actors[actor].index-1].direction
end
for i in 1..$game_party.bus_max
#如果这辆车没有得到,直接往下判断,本质没什么用,但可以优化一下内存
if $game_party.bus[i*7+6] == false
next
end
#车与角色的位置判定
if $game_party.bus[i*7+4] == false and x == $game_party.bus[i*7] and y == $game_party.bus[i*7+1] and $game_party.bus[i*7+3] == $game_map.map_id
$game_party.bus[i*7+4] = true #更改停放状态
$game_party.bus[i*7+5] = actor #更改此车被几号角色所称
#更改角色所乘战车ID
$game_party.actor_by[actor] = i+$game_party.bus_actor
$game_party.add_actor(i+$game_party.bus_actor) #加人战车
#替换战车与角色位置
$game_party.swap_order($game_actors[actor].index,$game_actors[i+$game_party.bus_actor].index)
$game_party.remove_actor(actor) #角色离队
Audio.se_play("Audio/SE/001-上下车",100,100) #播放上车音效
break #跳出循环
elsif $game_party.bus[i*7+4] == true and $game_party.bus[i*7+5] == actor
$game_party.add_actor($game_party.bus[i*7+5]) #加人角色
$game_party.bus[i*7+4] = false #更改停放状态
#更改角色所乘战车ID
$game_party.actor_by[actor] = nil
a = $game_actors[$game_party.bus[i*7+5]].index
$game_party.bus[i*7+5] = nil #清空车内角色id
#记录战车停放位置
$game_party.bus[i*7] = x
$game_party.bus[i*7+1] = y
$game_party.bus[i*7+2] = d
$game_party.bus[i*7+3] = $game_map.map_id
#替换战车与角色位置
b = $game_actors[i+$game_party.bus_actor].index
$game_party.swap_order(a, b)
$game_party.remove_actor(i+$game_party.bus_actor) #战车离队
Audio.se_play("Audio/SE/001-上下车",100,100) #播放下车音效
break #跳出循环
end
end
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ● 上车判定
#--------------------------------------------------------------------------
def bus_up(actor)
#判定坐标
if $game_actors[actor].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
elsif $game_actors[actor].index == nil
actor_id_i = $game_party.actor_by[actor]
if $game_actors[actor_id_i].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
else
x = $game_player.followers[$game_actors[actor_id_i].index-1].x
y = $game_player.followers[$game_actors[actor_id_i].index-1].y
d = $game_player.followers[$game_actors[actor_id_i].index-1].direction
end
else
x = $game_player.followers[$game_actors[actor].index-1].x
y = $game_player.followers[$game_actors[actor].index-1].y
d = $game_player.followers[$game_actors[actor].index-1].direction
end
for i in 1..$game_party.bus_max
#如果这辆车没有得到,直接往下判断,本质没什么用,但可以优化一下内存
if $game_party.bus[i*7+6] == false
next
end
#车与角色的位置判定
if $game_party.bus[i*7+4] == false and x == $game_party.bus[i*7] and y == $game_party.bus[i*7+1] and $game_party.bus[i*7+3] == $game_map.map_id
$game_party.bus[i*7+4] = true #更改停放状态
$game_party.bus[i*7+5] = actor #更改此车被几号角色所称
#更改角色所乘战车ID
$game_party.actor_by[actor] = i+$game_party.bus_actor
$game_party.add_actor(i+$game_party.bus_actor) #加人战车
#替换战车与角色位置
$game_party.swap_order($game_actors[actor].index,$game_actors[i+$game_party.bus_actor].index)
$game_party.remove_actor(actor) #角色离队
Audio.se_play("Audio/SE/001-上下车",100,100) #播放上车音效
break #跳出循环
end
end
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ● 下车判定
#--------------------------------------------------------------------------
def bus_down(actor)
#判定坐标
if $game_actors[actor].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
elsif $game_actors[actor].index == nil
actor_id_i = $game_party.actor_by[actor]
if $game_actors[actor_id_i].index == 0
x = $game_player.x
y = $game_player.y
d = $game_player.direction
else
x = $game_player.followers[$game_actors[actor_id_i].index-1].x
y = $game_player.followers[$game_actors[actor_id_i].index-1].y
d = $game_player.followers[$game_actors[actor_id_i].index-1].direction
end
else
x = $game_player.followers[$game_actors[actor].index-1].x
y = $game_player.followers[$game_actors[actor].index-1].y
d = $game_player.followers[$game_actors[actor].index-1].direction
end
for i in 1..$game_party.bus_max
#如果这辆车没有得到,直接往下判断,本质没什么用,但可以优化一下内存
if $game_party.bus[i*7+6] == false
next
end
if $game_party.bus[i*7+4] == true and $game_party.bus[i*7+5] == actor
$game_party.add_actor($game_party.bus[i*7+5]) #加人角色
$game_party.bus[i*7+4] = false #更改停放状态
#更改角色所乘战车ID
$game_party.actor_by[actor] = nil
a = $game_actors[$game_party.bus[i*7+5]].index
$game_party.bus[i*7+5] = nil #清空车内角色id
#记录战车停放位置
$game_party.bus[i*7] = x
$game_party.bus[i*7+1] = y
$game_party.bus[i*7+2] = d
$game_party.bus[i*7+3] = $game_map.map_id
#替换战车与角色位置
b = $game_actors[i+$game_party.bus_actor].index
$game_party.swap_order(a, b)
$game_party.remove_actor(i+$game_party.bus_actor) #战车离队
Audio.se_play("Audio/SE/001-上下车",100,100) #播放下车音效
break #跳出循环
end
SceneManager.goto(Scene_Map)
end
end
end