Minecraft Wiki
Advertisement
Information icon
This feature is exclusive to Bedrock Edition and Minecraft Education. 

Used to open the NPC dialogue to the player and change the dialogue displayed by an NPC.

Syntax[]

dialogue open
Forces open the targeted NPC's dialogue box to the targeted player(s), simulating the experience of clicking on an NPC.
  • A targeted scene can also be indicated.
Syntax:
dialogue open <npc: target> <player: target> [sceneName: string]
Example: Open the dialogue of an NPC with tag "ducky" toward the nearest player showing scene "ducky_intro".
dialogue open @e[type=npc, tag=ducky] @p ducky_intro
dialogue change
Changes the content of the targeted NPC according to the targeted scene, including dialogue, commands, and name.
  • This will close the dialogue box and update for the next time the NPC is interacted.
  • The content can be updated on a per-player basis. If no player is targeted, the dialogue will update for all players.
Syntax:
dialogue change <npc: target> <sceneName: string> [player: target]
Example: Change the dialogue of an NPC with tag "ducky" into scene "duck_intro" toward the initiator.
dialogue change @e[type=npc, tag=ducky] ducky_intro @initiator

Arguments[]

<npc: target>: CommandSelector<Actor>

Specifies the target to open a NPC menu from.
  • Must be a target selector for an entity type that has the minecraft:npc component.

<player: target>: CommandSelector<Player>

Specifies the target(s) to display the NPC menu.
  • Must be a player name or target selector of player type.
  • Must be specified in open mode. In change mode, all players are affected if not specified.

[sceneName: string]: string

Specifies what scene to show from the dialogue folder in a behavior pack from the scene_tag property.
  • Must be either a single word (no spaces) or a quoted string.
  • Must be specified in change mode. In open mode, the last dialogue shown will be used if not specified.

Description[]

Dialogue can be branched with the use of a scene file. The scene file is a json file located inside the dialogue folder in the root directory of the active behavior pack (%localappdata%\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\development_behavior_packs\<your behavior pack folder>) that contains all the information needed for branching dialogue. There is no limit to the amount of scene files, as the game will read all the files in the folder and call based on scene_tag property indicated in the given scene data.

See this documentation for scene file setup.

Result[]

CommandTriggerBedrock Edition
anythe arguments are not specified correctly Failed
if npc: target fails to resolve to a singular entity with the minecraft:npc component.
in change mode, if player: target fails to resolve one or more online players.
if [sceneName: string] fails to resolve to a dialogue tag in a behavior pack.
OtherwiseSuccessful

Output[]

CommandEditionSituationSuccess Count
anyBedrock EditionOn fail0
On success1

History[]

Bedrock Edition
1.17.10beta 1.17.10.22Added /dialogue.
Advertisement