How to control an agent?
and7ey opened this issue · comments
I create an agent with the NewAgent
command. It is created at the user's position.
- How could I teleport the agent to the user's position? The standard command
tp @c
doesn't work (looks like@c
works at Education Edition only). Is there any way to kill and create the agent again? - How could I give something to the agent? I tried
replaceitem
andgive
, but again it doesn't accept neither@c
norplayer.Agent
. I was thinking about using theagent collect
command (it works!), but I see no way to drop blocks near the agent.
This page may be useful: https://education.minecraft.net/wp-content/uploads/Code_Connection_API.pdf. It has an agent tptoplayer
command and and an agent drop
command.
Thanks. I've read that document.
agent tptoplayer
doesn't work - it says 'tptoplayer' part is unknown (I use it withplayer.Exec()
- is that right?). Upd.agent tp
works :).agent drop
drops the items, which is already in the agent's inventory. But I would like to add something to its inventory.
I am experimenting with the standard (non-education) edition of Minecraft. But the education edition option is enabled.
I don't think there is any way to give the agent items without actually dropping it to it, but I'm not entirely sure.
Thanks. Looks like the agent can build something without having blocks in its inventory. The following JS code works in Education Edition -
agent.setItem(RED_SAND, 1, 1)
agent.setAssist(PLACE_ON_MOVE, true)
agent.move(FORWARD, 1)
The question is how to perform the first command?
https://minecraft.makecode.com/reference/agent/set-item