NPC Dialogue¶
文档版本:1.21.50.25
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_version
:format_version
minecraft:npc_dialogue
:object- Specifies the dialogue of an npc.
minecraft:npc_dialogue
scenes
:array- The different scenes.
scenes
<any array element>
:object- A single scene specification.
<any array element>
buttons
:array- 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>
name
:string- Set the text that is going to be displayed on your NPC’s button.
name
:rawtext- 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
}
}
}
}
rawtext
:array- 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>
translate
:string- The key to translate.
with
:array- 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>
rawtext
:array- 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>
text
:string- 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>
selector
:string- 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>
score
:object- The score text component.
score
name
:string- A selector, player name (can be fake), or * to target who is reading the message.
objective
:string- The scoreboard objective to retrieve the value of.
commands
:array- 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_name
:string- 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_name
:rawtext- 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_commands
:array- 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_commands
:array- 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_tag
:string- This is the name you will use to call this scene in-game. This is a required property.
text
:string- 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.
text
:rawtext- 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.