加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
游戏的内容是镜子里镜子外两个世界,使用道具后可以从表世界传送到里世界相同位置这样。
已经试过“使用第21个道具后自动执行传送”,“使用公共事件调用脚本”,和“判定拥有特殊道具后按下键盘上指定键自动执行传送”三个方法,均无效。
以下是第三种方法的代码。如果有人可以帮忙修改,有偿。搞定后会公开此脚本。
module Input Q = :X end class Scene_Map alias q_press_update update def update # Call the original update method q_press_update # Check if the Q key is pressed and if the player has the specific item if Input.trigger?(Input::Q) && $game_party.item_number($data_items[21].id) > 0 # Get the current map ID, player coordinates and direction map_id = $game_map.map_id x = $game_player.x y = $game_player.y direction = $game_player.direction # Calculate the target map ID based on the current map ID if map_id < 40 target_map_id = map_id + 17 else target_map_id = map_id - 17 end # Play the teleport SE $game_system.se_play($data_system.teleport_se) # Reserve the transfer to the target map $game_player.reserve_transfer(target_map_id, x, y, direction) # Clear the scene variable to return to the map scene $scene = nil end end end
module Input
Q = :X
end
class Scene_Map
alias q_press_update update
def update
# Call the original update method
q_press_update
# Check if the Q key is pressed and if the player has the specific item
if Input.trigger?(Input::Q) && $game_party.item_number($data_items[21].id) > 0
# Get the current map ID, player coordinates and direction
map_id = $game_map.map_id
x = $game_player.x
y = $game_player.y
direction = $game_player.direction
# Calculate the target map ID based on the current map ID
if map_id < 40
target_map_id = map_id + 17
else
target_map_id = map_id - 17
end
# Play the teleport SE
$game_system.se_play($data_system.teleport_se)
# Reserve the transfer to the target map
$game_player.reserve_transfer(target_map_id, x, y, direction)
# Clear the scene variable to return to the map scene
$scene = nil
end
end
end
|