跳转至

NPC Dialogue

文档版本:1.21.0.24

Specifies the dialogue scenes.

架构

dialogue:
{
  format_version "format_version"
  object "minecraft:npc_dialogue" : opt
  {
    array "scenes" : opt
    {
      object "<any array element>" : opt
      {
        array "buttons" : opt
        {
          object "<any array element>" : opt
          {
            string "name" : opt
            rawtext "name"
            array "commands" : opt
            {
              string "<any array element>" : opt
            }
          }
        }
        string "npc_name" : opt
        rawtext "npc_name"
        array "on_close_commands" : opt
        {
          string "<any array element>" : opt
        }
        array "on_open_commands" : opt
        {
          string "<any array element>" : opt
        }
        string "scene_tag" : opt
        string "text" : opt
        rawtext "text"
      }
    }
  }
}
format_versionformat_version
format_version:
string
minecraft:npc_dialogueobject
Specifies the dialogue of an npc.
minecraft:npc_dialogue
scenesarray
The different scenes.
scenes
<any array element>object
A single scene specification.
<any array element>
buttonsarray
This is where you can create buttons for your NPC.
buttons
<any array element>object
This is where you can create buttons for your NPC.
<any array element>
namestring
Set the text that is going to be displayed on your NPC’s button.
namerawtext
Set the text that is going to be displayed on your NPC’s button.
rawtext:
{
  array "rawtext" : opt
  {
    string "<any array element>" : opt
    object "<any array element>" : opt
    {
      string "translate" : opt
      array "with" : opt
      {
        string "<any array element>" : opt
        object "<any array element>" : opt
        {
          array "rawtext" : opt
        }
      }
    }
    object "<any array element>" : opt
    {
      string "text" : opt
    }
    object "<any array element>" : opt
    {
      string "selector" : opt
    }
    object "<any array element>" : opt
    {
      object "score" : opt
      {
        string "name" : opt
        string "objective" : opt
      }
    }
  }
}
rawtextarray
The raw text component, which consists of an array of text components.
rawtext
<any array element>string
<any array element>object
A text component that will attempt to translate the given key through the languages files.
<any array element>
translatestring
The key to translate.
witharray
Specifies for the translator that additional text component needs to be inserted, this will cause the translator to look for variables in the translation text and replaced them with the corresponding 'With' text component.
with
<any array element>string
<any array element>object
Specifies that this 'with' component needs to be processed.
<any array element>
rawtextarray
The raw text component, which consists of an array of text components.
rawtext
<any array element>object
A simple text component, will display the text raw (without processing).
<any array element>
textstring
The text to display.
<any array element>object
A text component that turns a selector into text, will usually display like: Player1, Player2 and Player3.
<any array element>
selectorstring
The selector to target, for dialogue files, you can use @initiator.
<any array element>object
A text component that grabs the score from an given target and turns its value of a specified score.
<any array element>
scoreobject
The score text component.
score
namestring
A selector, player name (can be fake), or * to target who is reading the message.
objectivestring
The scoreboard objective to retrieve the value of.
commandsarray
allows you to add commands which will be run in-game when the button is pressed.
commands
<any array element>string
The commands to execute.
npc_namestring
This is where you can add or change a name for your NPC dialogue box. This is an optional property that is useful for dynamically changing NPC names.
npc_namerawtext
This is where you can add or change a name for your NPC dialogue box. This is an optional property that is useful for dynamically changing NPC names.
on_close_commandsarray
This is where you can define which commands will fire when the NPC dialogue box closes.
on_close_commands
<any array element>string
A minecraft command to execute.
on_open_commandsarray
This is where you can define which commands will fire when the NPC dialogue box opens.
on_open_commands
<any array element>string
A minecraft command to execute.
scene_tagstring
This is the name you will use to call this scene in-game. This is a required property.
textstring
This is where you enter the dialogue you want your NPC to display in-game for this scene. You can type the dialogue text directly here or use raw text if you are using a language file. This is an optional property, but without it your NPC dialogue box will be empty.
textrawtext
This is where you enter the dialogue you want your NPC to display in-game for this scene. You can type the dialogue text directly here or use raw text if you are using a language file. This is an optional property, but without it your NPC dialogue box will be empty.