Interactive NPC Generator

If you know what you're doing you may edit the commands below. Modifications in the form above will overwrite your changes below. This will be what is saved into the exported datapack zip file.
Setup Commands
Run these commands once to set everything up. Run

Cleanup Commands
Run these commands if you want to remove everything relating to this NPC. Run

Main Loop
Command Sets

What is this?

This is an Interactive NPC (Non-Player Character) Generator. With this tool, you can make a Minecraft entity communicate with the player with tellraw commands. The player can then choose from one or more options. When an option is clicked a set of commands can be run. After this you can then set what the NPC says next. The NPC entity itself is not generated with this tool. You use MCStacker for that. You just need to give it a tag that corresponds to the base tag set with this tool. The generator outputs a datapack zip file for you to put in your minecraft world or server.

Potential Uses


Tutorial Part One: Using the Generator

Step 1

You have to set your base settings.

Base TagThe ‘Base Tag’ needs to be the same tag as the NPC you will generate in MCStacker later
NamespaceThe functions that are generated need to belong to a ‘Namespace’ set this here.
Datapack NameThis is the name of the generated zip file
Main Tick TagChecking this will make it so the main function loop runs every tick after the vanilla tick. If you don’t check this you have to run the main function from a repeating command block.
DistanceDistance is the range in blocks you have to be in order to interact with the NPC.
Text ColorThis the text color of what the NPC says to the player.
Option ColorThis is the text color of the options the NPC gives the player.

Step 2

In the green box labelled: Statement 1 (The first thing it says), Write some text like this:

I can do magic.\nWhat would you like me to do?

Step 3

Now add some options. Click the ‘Add Option’ button twice. In Option 1 set the following:

Option TextLevitate You
Hover TextThis will apply the levitate effect to you
Next StatementFinish Talking
Execute AtYou do not need to modify this but you can if you need to for more complex NPC behaviors.

Now add the command by clicking the ‘Add Command’ button. Add this to the Command 1 field:

/effect give @p minecraft:levitation 5 2

In Option 2 set the following:

Option TextTeleport You
Hover TextYou will teleport 5 blocks on each axis
Next StatementFinish Talking
Execute AtYou do not need to modify this but you can if you need to for more complex NPC behaviors.

Now add the command by clicking the ‘Add Command’ button . Add this to the Command 1 field:

/tp @p ~5 ~5 ~5

Step 4

Next you want the NPC to say something after it has levitated or teleported you. Do this by clicking ‘Add NPC Statement’. Write in the following:

Thanks for checking out my magic.

Click the ‘Add Option’ button in this section. In Option 1 set the following:

Option TextNext
Next StatementStatement 1
Execute AtYou do not need to modify this but you can if you need to for more complex NPC behaviors.

Remember the first two options we added into the first statement. You need to change the Next Statement to ‘Statement 2’

That’s it. If your settings look like this, then your datapack is ready to download.

Tutorial Part Two: After You’ve Generated the Datapack

Step 1

Use the ‘Interactive NPC Generator’ to set up your NPCs dialog, options and commands just like in Part One of the Tutorial. Make sure you set the following base settings for this tutorial:

Base TagMyNPC
Datapack NameMyDatapack

Step 2

Click the ‘Download Datapack’ button.

Step 3

You should see a file named in your Downloads folder. Copy this to the datapack folder of your Minecraft world. For example:


Step 4

Go into the world as an operator (cheats enabled). If the world was already running type the /reload command. This will make sure Minecraft loads your datapack into the game.

Step 5

Enable the three scoreboard objectives by running this command:

/function npcgenerator:setup_mynpc

Step 6

You have to now go into MCStacker to generate a summon command for your entity. The entity must have the same tag as the Base Tag.

/summon pig ~ ~ ~ {Tags:["MyNPC"]}

It can be a good idea to set Invulnerable, PersistenceRequired & NoAI to make them not despawn or attack you. But it’s optional:

/summon pig ~ ~ ~ {Invulnerable:1b,PersistenceRequired:1b,NoAI:1b,Tags:["MyNPC"]}

Run the summon command.

Step 7

If you checked the ‘Main Tick Tag’ checkbox, The main function should be executing now and you should see some words said by the NPC.

If you did not check the ‘Main Tick Tag’ checkbox then you will have to run the following command in a repeating command block

/function npcgenerator:main_mynpc

Known Issues