# エージェントを指定した場所へテレポートさせる(agent.teleport) > 指定した方向、位置にエージェントをテレポートさせる。 - カテゴリ:エージェント(agent) - ブロック:エージェントを ~0 ~0 ~0 へ 西 向きにテレポートさせる - URL:https://makecode.minecraft-okinawa.com/reference/agent/teleport/ - 公式データ取得日:2026-11-13 - 動作確認:確認待ち ## JavaScript ```javascript agent.teleport(pos(0, 0, 0), WEST) ``` ## Python ```python agent.teleport(pos(0, 0, 0), WEST) ``` ## 引数 | 名前 | 値 | 意味 | |---|---|---| | pos | 座標 | エージェントをテレポートさせる位置 | | dir | 方向 | テレポートさせられたエージェントが向く向きの四方位 | ## 使用例 ### Teleport the Agent 100 blocks up when the agentjump command is typed in the chat. ```javascript player.onChat("agentjump", function () { agent.teleport(pos(0,100,0), WEST); }); ``` ```python def on_on_chat(): agent.teleport(pos(0, 100, 0), WEST) player.on_chat("agentjump", on_on_chat) ``` ### Teleport the agent anywhere in two dimensions from the current location. The Agent goes to a random location 50 blocks North or South, and 50 blocks East or West. The agent moves when the sendagent command is typed in the chat. ```javascript player.onChat("sendagent", function () { agent.teleport(randpos( pos(-50, 0, 50), pos(50, 0, -50)), NORTH); }); ``` ```python def on_on_chat(): agent.teleport(randpos(pos(-50, 0, 50), pos(50, 0, -50)), NORTH) player.on_chat("sendagent", on_on_chat) ``` ## 出典 - [MakeCode for Minecraft 公式リファレンス(agent.teleport)](https://minecraft.makecode.com/reference/agent/teleport) 執筆:鈴木孝昌(現役プロジェクトマネージャー/マイクラカップ指導者)/運営:沖縄マイクラ部 プログラミングスクール「クロスウェーブ」(https://minecraft-okinawa.com/)