Non Playing Characters (NPCs) - Full Guide! ♦

*Joystick**Joystick* Member
edited August 2022 in Community


Intrigued about how to properly code NPCs? Say less, this guide's made for you!

Get started

NPCs are recognizable from other mannequins by the name that shows up on top on them. You will also have a "Talk" button & a "Code" button if you own that mannequin.


Now that your mannequin is dressed up, you can start coding it using the code button!


Coding your NPC

After clicking the button, the "scenes" window will appear. On there, you will find every scene which contains a program, and 4 buttons.

NEW - Creates a new scene. You will enter the name of the scene and it will appear next to the other ones.
EDIT - Allows you to edit the program of the selected scene*.
NAME - Changes the name of the selected scene*.
DELETE - Removes the selected scene*.

*Click on a scene to select it, it will appear darker than the other ones. On the picture, the scene 'Two' is selected.


Select a scene and click EDIT and the command prompt will appear. Everything you code here will work for that only scene.

Click on "ADD COMMAND" to start programming. You will have to choose between 10 commands :

ECHO - Sends a message in the chatbar.

FIREWORK AT - Shoots a red firework at the desired spot (simply click on the block).

SAY - The NPC will say that message.
PITCH - Changes the speaking tone of the NPC (the bigger the higher the value is, the higher the tone will be).
REPLY - Will let the player choose an option to reply to the NPC. Reply goes along a GOTO command.
START CHAT - Is required for the NPC to talk. Must be placed before a 'SAY' command.
GOTO - Sends to the desired scene.
GIVE - The NPC will give an amount of the desired item.
TAKE - The NPC will take an amount of the desired item if the player has it.
Does the player has a - If the player has this kind of item, then sends to a different scene. Otherwise sends to a different scene.

On this picture, if the player has a Green Keycard, the program will move to the 'Ending' scene. Otherwise, it will move to the 'Restart' scene.

Here is an example of a scene.

In this one, the NPC will say the first line. The player will click anywhere for the NPC to say the 2nd line. There, the player will have to click on the reply "Oh, why's that?" to go to the scene named 'Two'.

NOTES

• The commands that does NOT count as talking must be placed BEFORE a 'START CHAT' to work. Or on another scene.
• The given items will disappear if you log off / throw them away.
• Every item can let you access portals that wear the same sentry. For instance, you will be able to go through a door that has a skull sentry if you're in possession of a skull in your inventory. Only Diamonds don't have a specific sentry.


Live example

Here is an example of a NPC I coded for this guide. You can view the Programs and scenes and the result in video.

Program



Scene 'One'

Scene 'Two'

Scene 'Reference'

Scene 'Ending'

Scene 'Ending2'

Result




Comments

  • cool guide
  • cool guide
  • Here's some extra useful info:
    Maximum number of blocks per program is 10
    Maximum number of programs per NPC is 32 (Although right now there is a bug where you can't scroll through your programs without creating a new program so you might want to consider making less so that you can make a new temporary program)
    Maximum amount of times a specific program can execute in a single "talk" command is 3 (The NPC will immediately stop talking if you try to go to it a 4th time)
  • Here's some extra useful info:
    Maximum number of blocks per program is 10
    Maximum number of programs per NPC is 32 (Although right now there is a bug where you can't scroll through your programs without creating a new program so you might want to consider making less so that you can make a new temporary program)
    Maximum amount of times a specific program can execute in a single "talk" command is 3 (The NPC will immediately stop talking if you try to go to it a 4th time)

    Thanks for those, will add them when I'll be back from work!
Sign In or Register to comment.