HyperScript
Docs

← All of the Docs The world

Entities

expressionlast summoned entitysince 1.7.0

The creature the last summon of this trigger made

set {_boss} to last summoned entity
Try it
expressionevent entitysince 1.7.0

The creature the current event is about

on mob spawn:
    set {_mob} to event entity
    set name of {_mob} to "&cWild thing"
Try it
expressionvictim entity / attacker entitysince 1.7.0

In on entity damage: the creatures themselves, not their names

push victim entity backward with force 0.8
Try it
expressionclicked entitysince 1.7.0

In on entity click

on entity click:
    push clicked entity upward with force 0.6
Try it
expressiontarget entity of <who>since 1.7.0

What they are looking at, up to 50 blocks away

set {_looking} to target entity of player
if {_looking} is set:
    send "&7You are looking at &f%{_looking}%"
Try it
expressionname of <entity> / health of <entity>since 1.7.27

Read or set. How much health it can have is given when it is summoned: with health <n>

set name of {_boss} to "&c&lThe Boss"
Try it
effectkill <who>since 1.7.0

Works on a player or an entity

kill arg.1 as player
Try it
effectkill <who> as <who>since 1.7.39

The same, but the server takes it for a kill by the second one, a player or a creature: the death message names them, %event.killer% is them, and they get the drops, the experience and the credit other plugins give for a kill. kill arg.1 as player

kill arg.1 as player
Try it
effectmake <creature> follow <who>since 1.7.17

It walks after them until told otherwise, or until either is gone. make <creature> stop following ends it. Needs a Paper server

command /pet:
    trigger:
        summon wolf named "&b%player%'s pet" at player
        set {%player%.pet} to last summoned entity
        make {%player%.pet} follow player
Try it
effectmake <creature> walk to <location>since 1.7.17

It finds its own way there, if there is one. Needs a Paper server

command /callguard:
    trigger:
        summon iron golem at player
        make last summoned entity walk to location 10 blocks in front of player
Try it
effectmake <creature> stay still / make <creature> move againsince 1.7.17

Takes away its own will, so it neither walks nor turns nor is pushed; and gives it back

command /statue:
    trigger:
        summon zombie named "&7Statue" at player silent
        make last summoned entity stay still
Try it
effectmake <who> look at <location>since 1.7.37

Turn a player or a creature so that they face that place. The place is a location, x, y, z, or somebody: make player look at arg.1 looks them in the eyes. They stay where they are; only where they look changes

make player look at arg.1
Try it
effectmake <who> look northsince 1.7.37

Turn them straight north, east, south or west, or make them look up or down

make player look north
Try it
effectmake <who> ride <creature> / make <who> dismountsince 1.7.17

Seat a player, or another creature, on top of one

command /mount:
    trigger:
        summon horse at player
        make player ride last summoned entity
Try it
effectmake <who> swing armsince 1.7.70

The movement of a hit, without hitting anything

make player swing arm
Try it
effectdamage <who> by <n>since 1.7.0

Hurt by that much; 2 is one heart

damage tool of player by 25
Try it
effectpush <who> upward / downward / forward / backward [with force <n>]since 1.7.0

Shove in a direction. forwards, backwards, upwards and downwards are read the same, and at speed <n> says what with force <n> does: push player forwards at speed 2

push player upward with force 1.2
Try it
effectpush <who> towards <location> [with force <n>]since 1.7.0

Shove towards a place

push player towards {spawn} with force 0.8
Try it
effectpush <who> away from <location> [with force <n>]since 1.7.67

Shove the other way: away from an explosion, a boss, a wall

push player away from {boss.place} with force 1.5
Try it
effectpush <who> left / right [with force <n>]since 1.7.67

Shove sideways, as they stand

push player left with force 0.8
Try it
expressionlaunch <who> [upward] [at speed <n>] [without fall damage]since 1.7.67

A push, upward unless another direction is named. With without fall damage the landing does not hurt, which is what a jump pad wants; push takes those words too

on right click:
    if block is "slime_block":
        launch player upward at speed 2 without fall damage
Try it
effectmake <entity> target <who>since 1.7.0

Send a mob after someone

make {_boss} target player
Try it
effectremove entity <entity>since 1.7.0

Make it disappear

summon zombie at player's location
set {_mob} to last summoned entity
wait 10 seconds
remove entity {_mob}
Try it
effectremove all <type> within <n> blocks of <location>since 1.7.0

Clear out every creature of a kind nearby

remove all zombies within 20 blocks of player's location
Try it
effectwith health <n>since 1.7.15

Its health, in half hearts, up to 2048. It starts at full health

summon iron golem named "&bGuardian" at player with health 400
Try it
effectwith speed <n>since 1.7.15

How fast it moves, as a multiple of what is normal for it: 2 is twice as fast, 0.5 half

summon 5 zombie at player with speed 1.6
Try it
effectwith damage <n>since 1.7.15

How hard it hits, in half hearts. Only creatures that attack have it

summon zombie named "&4Brute" at player with damage 20
Try it
expressionholding <item>since 1.7.15

What it has in its hand

summon zombie at player holding iron sword enchanted with sharpness 3
Try it
expressionwearing <item>, <item>since 1.7.15

Its armour; each piece goes where it belongs, and anything that is not armour goes on its head

summon zombie at player wearing diamond helmet, iron chestplate, iron boots
Try it
expressiondropping <item>, <item>since 1.7.15

What it leaves behind when it dies, instead of what such a creature usually drops. dropping nothing for nothing at all

summon chicken named "&6Golden hen" at player dropping 3 gold ingot
Try it
expressionglowing, silent, babysince 1.7.15

An outline that shows through walls; no sounds; a young one

summon villager at player glowing silent baby
Try it
expressioninvisiblesince 1.7.17

It cannot be seen; what it holds and wears still can. Minecraft 1.16.3 or newer

summon armor stand at player invisible holding diamond sword
Try it
expressionsmall, marker, with arms, without gravity, without base platesince 1.7.17

For an armor stand: half size; nothing can touch or select it; arms to hold things in; it floats where it was put; no stone plate under it. without gravity works on any creature

command /trophy:
    trigger:
        summon armor stand named "&6Champion" at player small with arms without base plate holding golden apple wearing diamond helmet
Try it
effectset drops to <item>, <item>since 1.7.15

Replace what falls. set drops to nothing, or clear drops, for nothing

on entity death:
    if event.entity is "creeper":
        set drops to 3 gunpowder, 1 tnt
Try it
effectadd <item> to dropssince 1.7.15

One more thing, on top of the rest

on entity death:
    if event.entity is "zombie":
        if chance of 10%:
            add 1 emerald to drops
Try it
effectmake <who> shoot a <projectile>since 1.7.42

The same as shoot <projectile> from <who>, said the other way round. Add at speed <n>: make player shoot an arrow at speed 3

make player shoot a small fireball at speed 2
Try it
expressionshoot <projectile> from <who>since 1.7.15

Launch an arrow, snowball, egg, fireball, small fireball, ender pearl, trident or the like, the way they are looking. Add with speed <n>: 1 is a gentle throw, 3 a fully drawn bow

on right click with blaze rod:
    if player is on cooldown "fireball":
        stop
    start cooldown "fireball" of 2 seconds
    shoot small fireball from player with speed 2
Try it
Guide and examples

A mob or animal can be kept in a variable and told what to do, just like a player.

command /boss:
    permission: op
    trigger:
        summon zombie at player's location with health 100
        set {_boss} to last summoned entity
        set name of {_boss} to "&c&lThe Boss"
        make {_boss} target player

on entity damage:
    if attacker is "zombie":
        push victim entity backward with force 0.8
SyntaxMeaning
last summoned entityThe creature the last summon of this trigger made
event entityThe creature the current event is about
victim entity / attacker entityIn on entity damage: the creatures themselves, not their names
clicked entityIn on entity click
target entity of <who>What they are looking at, up to 50 blocks away
name of <entity> / health of <entity>Read or set. How much health it can have is given when it is summoned: with health <n>
kill <who>Works on a player or an entity
kill <who> as <who>The same, but the server takes it for a kill by the second one, a player or a creature: the death message names them, %event.killer% is them, and they get the drops, the experience and the credit other plugins give for a kill. kill arg.1 as player
make <creature> follow <who>It walks after them until told otherwise, or until either is gone. make <creature> stop following ends it. Needs a Paper server
make <creature> walk to <location>It finds its own way there, if there is one. Needs a Paper server
make <creature> stay still / make <creature> move againTakes away its own will, so it neither walks nor turns nor is pushed; and gives it back
make <who> look at <location>Turn a player or a creature so that they face that place. The place is a location, x, y, z, or somebody: make player look at arg.1 looks them in the eyes. They stay where they are; only where they look changes
make <who> look northTurn them straight north, east, south or west, or make them look up or down
make <who> ride <creature> / make <who> dismountSeat a player, or another creature, on top of one
make <who> swing armThe movement of a hit, without hitting anything
damage <who> by <n>Hurt by that much; 2 is one heart
push <who> upward / downward / forward / backward [with force <n>]Shove in a direction. forwards, backwards, upwards and downwards are read the same, and at speed <n> says what with force <n> does: push player forwards at speed 2
push <who> towards <location> [with force <n>]Shove towards a place
push <who> away from <location> [with force <n>]Shove the other way: away from an explosion, a boss, a wall
push <who> left / right [with force <n>]Shove sideways, as they stand
launch <who> [upward] [at speed <n>] [without fall damage]A push, upward unless another direction is named. With without fall damage the landing does not hurt, which is what a jump pad wants; push takes those words too
make <entity> target <who>Send a mob after someone
remove entity <entity>Make it disappear
remove all <type> within <n> blocks of <location>Clear out every creature of a kind nearby
  • An entity prints as its name, or its type if it has none, so "%{_boss}%" works in text.
  • Everything in this table takes a player too: push player upward with force 1.2, kill arg.1. <who> means a player or an entity; <entity> means it only makes sense for one.
  • An entity is only good while it exists. Once it has died or its chunk has unloaded, acting on it does nothing. For that reason entities are for local variables, not saved ones.
  • remove all takes zombie, zombies, any other type, mobs (every hostile and passive mob) or entities (everything but players), up to 128 blocks away. Players are never removed.
  • Force is in blocks per tick: 0.5 is a nudge, 1.5 throws someone high into the air.

Creatures of your own. After the position, summon takes any of these, in any order:

WrittenEffect
with health <n>Its health, in half hearts, up to 2048. It starts at full health
with speed <n>How fast it moves, as a multiple of what is normal for it: 2 is twice as fast, 0.5 half
with damage <n>How hard it hits, in half hearts. Only creatures that attack have it
holding <item>What it has in its hand
wearing <item>, <item>Its armour; each piece goes where it belongs, and anything that is not armour goes on its head
dropping <item>, <item>What it leaves behind when it dies, instead of what such a creature usually drops. dropping nothing for nothing at all
glowing, silent, babyAn outline that shows through walls; no sounds; a young one
invisibleIt cannot be seen; what it holds and wears still can. Minecraft 1.16.3 or newer
small, marker, with arms, without gravity, without base plateFor an armor stand: half size; nothing can touch or select it; arms to hold things in; it floats where it was put; no stone plate under it. without gravity works on any creature
  • Write glowing, silent and baby before the items. After an item, glowing belongs to the item (dropping 1 stick glowing drops a shimmering stick).
  • What a creature holds and wears is its own and does not fall when it dies; say what it leaves behind with dropping.
  • What it drops stays with the creature, so it is still right after a restart.

What a creature leaves behind can also be changed when it dies, in on entity death::

on entity death:
    if event.entity is "zombie":
        add 1 emerald to drops
    if event.entity is "creeper":
        set drops to 3 gunpowder, 1 tnt
StatementEffect
set drops to <item>, <item>Replace what falls. set drops to nothing, or clear drops, for nothing
add <item> to dropsOne more thing, on top of the rest
make <who> shoot a <projectile>The same as shoot <projectile> from <who>, said the other way round. Add at speed <n>: make player shoot an arrow at speed 3
shoot <projectile> from <who>Launch an arrow, snowball, egg, fireball, small fireball, ender pearl, trident or the like, the way they are looking. Add with speed <n>: 1 is a gentle throw, 3 a fully drawn bow

%event.drops% is the list of what is about to fall, in on entity death: as in on block break:.

Shooting, turning and the tab list:

command /blast:
    trigger:
        set player's pitch to 0
        set player's yaw to -90
        make player shoot a small fireball at speed 2
        make player shoot an arrow

command /ghost <player>:
    permission: "ghost.use"
    trigger:
        hide player from tab list of arg.1
        send "&7%arg.1% no longer sees you on the list."
        wait 30 seconds
        show player in tab list of arg.1

A kill that counts for somebody:

command /smite <player>:
    permission: "smite.use"
    trigger:
        if arg.1 is not a player:
            send "&c%arg.1% is not online."
            stop
        strike fake lightning at player's location
        kill arg.1 as player
        send "&eYou smote %arg.1%."

Turning somebody to face a place, a player or a direction:

command /lookat <player>:
    trigger:
        make player look at arg.1
        make arg.1 look at player's location

command /spawnview:
    trigger:
        make player look at 0, 80, 0
        wait 2 seconds
        make player look north