structure
on npc click "<name>":HyperCitizensRuns when a player right-clicks the NPC of that name
on npc click "Shopkeeper":
execute player command "shop"← All of the Docs HyperCitizens
on npc click "<name>":HyperCitizensRuns when a player right-clicks the NPC of that name
on npc click "Shopkeeper":
execute player command "shop"on npc left click "<name>":HyperCitizensRuns when a player hits it
on npc left click "Guard":
make npc "Guard" say "Hands off."on npc click:HyperCitizensWithout a name: runs for every NPC
on npc click:
log "%player.name% clicked %{_name}% (number %{_npc}%)"What this event gives a script
| In the block | What it is |
|---|---|
{_npc} | The NPC's number |
{_name} | Its name |
on npc click "Shopkeeper":
execute player command "shop"
on npc click "Healer":
cooldown: 30 seconds
heal player
make npc "Healer" say "There you go."
on npc left click "Guard":
make npc "Guard" say "Hands off."
on npc click:
log "%player.name% clicked %{_name}% (number %{_npc}%)"
| Syntax | Effect |
|---|---|
on npc click "<name>": | Runs when a player right-clicks the NPC of that name |
on npc left click "<name>": | Runs when a player hits it |
on npc click: | Without a name: runs for every NPC |
player is whoever clicked, as in HyperScript's own events. {_npc} is the NPC's number and {_name} its name."Guide" finds an NPC called &aGuide. If two NPCs share a name, the block runs for both.