Commands/dialogue

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:
 * Example: Open the dialogue of an NPC with tag "ducky" showing scene "ducky_intro" to the nearest player.
 * Example: Open the dialogue of an NPC with tag "ducky" showing scene "ducky_intro" to the nearest player.


 * 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:
 * Example: Change the dialogue of an NPC with tag "ducky" toward the initiator into scene "duck_intro".
 * Example: Change the dialogue of an NPC with tag "ducky" toward the initiator into scene "duck_intro".

Arguments



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




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




 * Specifies what scene to show from the dialogue folder in a behavior pack from the  property.
 * Must be either a single word (no spaces) or a quoted string.
 * Must be specified in  mode. In   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) 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  property indicated in the given scene data.

See this documentation for scene file setup.

History
Comandos/dialogue 命令/dialogue