Create a new NPC - LeonidMem/DialogsM-Wiki GitHub Wiki
To create a new NPC just use the command /npc create {name}
and click on the entity you want to make the NPC - it will create a new template (you can use /
at the name in any quantity, so it will be placed to the specified folder and will create it if this folder doesn't exist).
Properties of NPC File
UUID [Necessary property]
Must be represented as String
. This value converts to the UUID and it will try to find attached entity.
Name [Necessary property]
Must be represented as String
. This value will be shown to a player as the name of the NPC when dialog will be opened.
Dialogs
Must be represented as String
(it converts to the list automatically) or List of Strings
. When NPC will be clicked, it will open the first dialog with suitable conditions from the list if possible.
Signs
Must be represented as List of Signs
. A sign is an object with three properties: text
, color
, and conditions
. It will show the first sign above NPC's with suitable conditions from the list if possible.
Text
Must be represented as String
. This value will be displayed above the NPC.
Color
Must be represented as String
and represent Minecraft colors' names (f.e. green, red) or Hex color (f.e. #FF0000). This value will define the color of the text above NPC.
Conditions
There are 8 types of conditions that must be represented as String
(it converts to the list automatically) or List of Strings
.
beforeDialogs
- if the player has any dialog from this list as read, dialog won't be opened to him.afterDialogs
- if the player doesn't have at least one dialog from this list this as read, dialog won't be opened to him.beforeQuests
- if the player has any quest from this list as read, dialog won't be opened to him.afterQuests
- if the player doesn't have at least one quest from this list as completed, dialog won't be opened to him.whenQuests
- if the player doesn't have at least one quest from this list as a quest in progress, dialog won't be opened to him.ifTags
- if the player doesn't have at least one scoreboard tag (/minecraft:tag
) from this list, dialog won't be opened to him.ifNoTags
- if the player has any scoreboard tag (/minecraft:tag
) from this list, dialog won't be opened to him.ifScoreboard
- if the player doesn't match at least one expression from this list, dialog won't be opened to him. Format:objectiveName [math sign] score
.
Math signs:
>
Greater>=
Greater or equal<
Less<=
Less or equal==
Equal!=
Not equal
Template:
{
"uuid": "{uuid}",
"name": "Villager",
"dialogs": ["1", "2", "3"],
"signs": [
{
"text": "&l!",
"color": "yellow",
"conditions": {
"beforeDialogs": [
"1"
],
"afterDialogs": [
"2"
],
"beforeQuests": [
"1"
],
"afterQuests": [
"2"
],
"whenQuests": [
"1"
],
"ifTags": [
"Tag1"
],
"ifNoTags": [
"Tag2"
],
"ifScoreboard": [
"Name > 10"
]
}
}
]
}