HyperScript
Docs

← All of the Docs The world

Characters

effectcreate npc <name> at <location>since 1.7.23

Make a character there, a villager unless said otherwise. With a name that is taken, the character is moved. Colours in the name are shown; it is known by the name without them, in lower case

command /setguide:
    permission: npc.admin
    players only: true
    trigger:
        create npc "&aGuide" at player's location
        send "&aThe guide stands here now."
Try it
effectcreate npc <name> as <entity> at <location>since 1.7.23

The same as another creature: as iron golem, as armor stand

command /setguard:
    permission: npc.admin
    players only: true
    trigger:
        create npc "&7Guard" as iron golem at player's location
Try it
effectdelete npc <name>since 1.7.23

Take a character away

command /removeguide:
    permission: npc.admin
    trigger:
        delete npc "guide"
Try it
structureon npc click <name>:since 1.7.23

At the left margin: runs when a player right-clicks that character; without a name, any character. {_npc} is its name

on npc click "guide":
    send "&aGuide: &fThe arena is that way."
Try it
expressionnpc <name>since 1.7.23

The creature itself, for what works on a creature: set name of npc "guide" to "...", make player ride npc "guide", remove entity npc "guide". To move a character, create npc it again at the new place

command /announce:
    permission: npc.admin
    trigger:
        make npc "guide" say "The event starts in five minutes!"
Try it
expressionall npcssince 1.7.23

A list of the names of every character

command /npcs:
    trigger:
        send "&7Characters: &f" + join all npcs with ", "
Try it
Guide and examples

A character is a creature that stands where you put it, cannot be hurt or pushed, and runs a block of your script when a player clicks it: a shopkeeper, a quest giver, a guide.

on load:
    create npc "&aGuide" at 10.5, 64, -3.5 in "world"

on npc click "guide":
    send "&aGuide: &fWelcome, %player%! The shop is to your left."
SyntaxMeaning
create npc <name> at <location>Make a character there, a villager unless said otherwise. With a name that is taken, the character is moved. Colours in the name are shown; it is known by the name without them, in lower case
create npc <name> as <entity> at <location>The same as another creature: as iron golem, as armor stand
delete npc <name>Take a character away
on npc click <name>:At the left margin: runs when a player right-clicks that character; without a name, any character. {_npc} is its name
npc <name>The creature itself, for what works on a creature: set name of npc "guide" to "...", make player ride npc "guide", remove entity npc "guide". To move a character, create npc it again at the new place
all npcsA list of the names of every character
  • Characters are remembered: they are still there, and still known by their names, after a restart. Making one in on load: is safe, because making it again only moves it.
  • A character here cannot look like a player. That takes the Citizens plugin and the HyperCitizens addon, which also give characters that walk routes and follow players. With HyperCitizens installed, create npc and on npc click are its, and make Citizens characters.