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.
You have to set your base settings.
Base Tag | The ‘Base Tag’ needs to be the same tag as the NPC you will generate in MCStacker later |
Namespace | The functions that are generated need to belong to a ‘Namespace’ set this here. |
Datapack Name | This is the name of the generated zip file |
Description | ¯\_(ツ)_/¯ |
Main Tick Tag | Checking 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. |
Distance | Distance is the range in blocks you have to be in order to interact with the NPC. |
Text Color | This the text color of what the NPC says to the player. |
Option Color | This is the text color of the options the NPC gives the player. |
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?
Now add some options. Click the ‘Add Option’ button twice. In Option 1 set the following:
Option Text | Levitate You |
Hover Text | This will apply the levitate effect to you |
Next Statement | Finish Talking |
Execute At | You 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 Text | Teleport You |
Hover Text | You will teleport 5 blocks on each axis |
Next Statement | Finish Talking |
Execute At | You 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
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 Text | Next |
Next Statement | Statement 1 |
Execute At | You 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.
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 Tag | MyNPC |
Namespace | npcgenerator |
Datapack Name | MyDatapack |
Click the ‘Download Datapack’ button.
You should see a file named MyDatapack.zip in your Downloads folder. Copy this to the datapack folder of your Minecraft world. For example:
C:\Users\MyProfileName\AppData\Roaming\.minecraft\saves\MyMCWorld\datapacks
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.
Enable the three scoreboard objectives by running this command:
/function npcgenerator:setup_mynpc
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.
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