How To Create A NPC
This guide will teach you how to create a new NPC on our setups with attributes such as commands, skins, position and direction.
Difficulty: Easy
Creating a NPC
This section will explain how to create a new NPC with commands. This is very suited for beginners as you wont have to touch any server files.
1. Create the NPC
First step is to create the NPC. You can do this very easily by entering the command shown below. The NPC will spawn at the exact position you are standing.
You can just let the name of the NPC be "test". We will disable the NPC name anyway.
2. Disable the name of the NPC
The visible name of the NPC should be disabled, as we will use the DecentHolograms plugin to add the hologram above the NPC. Start by making sure that you have the NPC selected. To do this, stand as close as possible to the NPC that you want to select. Then enter this command:
The NPC is now selected. To disable the NPC name, enter the command below until it is set to false and you can't see the NPC name above the NPC.
3. Adding a command to the NPC
This step will explain how to add a command to a NPC. This is what we always do to attach a GUI Menu to a NPC. The command you should enter to attach a command to a NPC is shown below:
When inserting your command, you should not put the / in the command. So if we wanted to add the /vote command to the NPC, this is the command we would enter:
Your command should now be attached to the NPC. The command should be executed when right-clicking the NPC. If you have entered the wrong command, you can unattach the command again by using "remove" instead of "add":
4. Changing the NPC's looking direction
When creating a NPC it will always look in the direction that you looked when creating it. However you can change the direction that the NPC looks. There are 2 different options for how the NPC looks. It can either look in 1 static direction at all times. Or it can be set to always look at the closest player. We will explain how to switch between these modes below:
Static looking direction
The NPC will be set to a static looking direction from default. If you want to change the direction the NPC is looking, you have to select the NPC and use the command below:
Now the NPC will look at you everywhere you go if you stand close enough to it. Now make the NPC look in the direction that you want it to look. When it looks in the correct direction, you can lock the look by entering the "/npc lookclose" command again.
Make the NPC look at the nearest player
If you want the NPC to always look at the nearest player, you can do that by selecting the NPC, and then entering this command:
Now the NPC will always look at the nearest player.
5. Adding a skin to the NPC
This step will explain how to add a custom skin to the NPC. The way that we do this, is that we first find the skin we want for the NPC on the NameMC website: https://namemc.com
On the NameMC website, you can search for skins. When you have found the skin that you want to attach to the NPC, you should go to the Profiles section on the NameMC page. Here you can see all the Minecraft usernames using this skin. You have to use these usernames in a moment.
To attach a skin to a NPC, you can use this command:
Now the %username% that you should insert in the comamnd is the same username as you found from the list above. Put the username in the command and enter the command.
The command might not always give the correct skin at first. This is because some of the Minecraft who used that skin might have changed their skin. Then you will just have to try the next username in the list. If none of the usernames work, you will have to find another skin.
Now you might think to yourself: What if the username I chose from the list changes their skin? This isn't a problem, as the Citizens/NPC plugin stores the skin in a seperate way from the username. So even if the username changes skin, it wont change the NPC's skin on your server.
Removing cape from NPC
Sometimes the username you choose might have a cape. You can remove this cape with the command below.
6. Changing the position of the NPC
If you want to move a NPC to another position/location on your server, you first have to select the NPC. Then you can use the command below to make the NPC teleport to the position you are standing. It will always change the looking direction to your looking direction.
NPC Holograms
All of the NPC's on our setups have a hologram above them to explain their function. These holograms are made with the DecentHolograms plugin. Not the Citizens plugin. This is because using the DecentHolograms plugin makes it much easier to manage the holograms.
To create a hologram, the easist way is to duplicate one of the existing holograms in this folder: plugins > DecentHolograms > holograms
Now change the position/coordinates and the file name of the hologram.
Last updated