The Chocolate Quest Wiki

Chocolate Quest Global NPC Variables

Welcome to using the advanced features of the Chocolate Quest NPC dialogs.

This tutorial is an elaboration on something in this one, so it's recommended to read that one first.

This Tutorial goes over how to use the "actions" "conditions" and "answers" in the dialog editor for NPCs and the various uses for these, like setting up shops or upgrading items.

Special Characters[]

You can type in "@sp" anywhere in an NPC's dialog box, and it will be replaced with the username of the player talking to the NPC.

Also, a dialog can include the term '@name' to display the speaker's name, allowing 1 dialog to be used by multiple NPCs.

You can also put in an item name-id in this format: [minecraft:fence] or [chocolateQuest:ninjaDagger] depending on whether you want a vanilla item or a chocolatequest item. The name of any item should work, however it may take a few tries to find the specific name used. You can use this page for the vanilla ones, and this page for the ones from this mod. This is hypothetically workable with IDs from other mods, however not suggested, as that may cause issues if the NPC is loaded up without the other mod.


To use an Answer, Click on 'add' in the answer bar. Then you will be moved to another GUI that will look like the first one, except with no information in it. This is the answer's GUI. Pressing the '+' Icon will allow you to change the file it uses from what you already have, and typing in the box will allow you to make a new one. Remember to press the save button when done.

Basically The answer's display name will become a clickable option when a player talks to the NPC, which will bring you to the shown message. You CAN add answers to answers.

Note that conditions and actions cannot be used in the first chat bar, but only inside of answers.


You can add an action in the GUI for any answer. Actions will perform different tasks depending on which one you select.

Open Shop[]

This action will cause a shop GUI to open where the player can trade items. To set up the trades, click the Edit button and a GUI will open where you can set up all the trades you want. Put the item you want the NPC to offer in the red box and put the required items to trade in the green boxes. Then click Add Trade.

Open Item Upgrade[]

This action will cause different types of GUIs to open for the player depending on what type of upgrade you choose. Blacksmith, Enchantment, Gunsmith or Staff Enchantment.

Open Inventory[]

This action will open the NPCs inventory GUI for the player. The player can then choose to do things like have the NPC join the players team and follow them.

Join Team[]

This action will cause the NPC to join a team. This can be permanent or it can have a time limit. To have the NPC join teams with the player who is currently speaking to the NPC, type @sp in the Team Name field. To have the NPC leave a team just create a new Join Team action and leave the Team Name field blank. There are several team names amongst Chocolate Quest mobs and NPCs. You can also make up any team name that you like. Some useful team names are Inquisition and mob_undead.

NPC Variable[]

This action is useful for making NPCs dialogs progress, so that they say and do different things over time or after certain events. It is used in combination with the NPC Variable Condition. An NPC Variable can only be accessed by the owner NPC, the NPC who's dialog you are currently editing, unlike a Global Variable which can be accessed by all NPCs.

Global Variable[]

This is similar to the NPC Variable except that it can be accessed by all NPCs.


This action is used to add or subtract from the players reputation with the different factions or teams. In the Faction Name field you enter a team name like Inquisition or mob_undead. Then you enter the value of how many reputation points you want to add or subtract. You can use negative numbers to subtract. You can make up any team name that you want or choose one of the existing teams.

Give Item[]

This action is used to give the player an item. Type the name of the items you give the player into the search bar. The items from your personal inventory will appear below the search bar at. This is useful if you want to give a more complicated item, like one that has enchantments on it or even a Soul In A Bottle item filled with 9 armored NPCs. The Give Item may be used in combination with the Consume Item action to set up a type of simple trade.

Consume Item[]

This command will remove an item from the players inventory. This useful whenever you want the player to give an item to an NPC. This can be used with the Give Item command to set up a simple trade. After the trade you may want to use the Set Equipment action to make the item appear in the NPCs hand.


Here you can enter a Minecraft command like you would in a Minecraft Command Block or in the Minecraft chat window.

Set Owner[]

This action makes the NPC join teams with the player that you name. This is often used to make an NPC join teams with the player that they are currently speaking with "@sp". To make the NPC leave a team and be a member of no team, leave the Player Name field blank. You make make the NPC only join the team for a limited amount of time by entering a value in the Owned Ticks field. There are 20 ticks in a second and 24,000 ticks in a Minecraft day.

Set Equipment[]

This allows you to equip the NPC with different armor and weapons. You may want to use this with the Consume Item action.

Set AI[]

This allows you to tell the NPC how to behave when he is not in battle, just like you would if you were viewing the NPCs inventory. The choices are Follow, Formation, Guard, Path, Sit and Wander.

Load Data From NBT[]

Load NBT data.

Spawn Monster[]

This action spawns a monster in the location of your choosing. Before using this command you must have the monster that you want to spawn saved inside a Soul In A Bottle Item in your inventory

Kill Counter[]

This action is used to create or delete a kill counter for the player. The format is "COUNTER_NAME ENTITY_ID ENTITY_TAGS". COUNTER_NAME is the name of the counter.


This action creates a timer with the specified name for the NPC. You can name the timer anything you want. The time Value is measured in ticks. There are 20 ticks in a second and 24,000 ticks in a Minecraft day.

Set Current Position as Home[]

This action sets the NPCs current position as the home position.


You can add a condition to any answer or action, different conditions do different things as well. A condition is a set of criteria that need to be met for the action to be performed, or the answer to show up at all.

NPC Variable[]

This condition checks to see what the value of a particular NPC Variable is. It is used in combination with the NPC Variable action. NPC Variables only apply to one NPC.

Global Variable[]

The Global Variable condition is similar to the NPC Variable condition except that global variables are accessible by all NPCs.

Score Variable[]

This condition checks to see if the players score for a named variable is a certain value.


This condition checks to see if the players reputation with a particular faction is a certain value.

Item on Inventory[]

This condition checks to see if the player has a certain item in their inventory.

On Team[]

This condition checks to see if the player belongs to a certain team.


This condition checks to see if the time of day is a certain value.


This condition executes a /testfor command and compares the result with the value.

Kill Counter[]

This condition checks to see if a Kill Counter is a certain value.

Nearby Entity[]

This condition checks to see if there is an entity nearby with the specified id and data. The syntax is ENTITY_ID {ENTITY_DATA} For example, to search for a nearby NPC tagged as innkeeper you would enter chocolateQuest.CQ_npc {nameID:"innkeeper"}


This condition checks the value of a timer that you had previously set up with the Timer action.