Who dealt the damage: a player's name or a mob type such as zombie. For an arrow or other projectile this is whoever shot it. Unset for damage with no attacker, such as falling
%event.victim%
victim
text
Who was hurt: a player's name or a mob type
%event.damage%
damage
number
Damage actually taken, after armour and effects; 2 is one heart
%event.cause%
cause
text
Why: FALL, FIRE, ENTITY_ATTACK, PROJECTILE, DROWNING, VOID and so on
%event.entity%
entity
text
The victim's entity type, e.g. player or zombie
%event.location%
location
Where the victim is
x of event's location
number
The x of %event.location%, as a number
y of event's location
number
The y of %event.location%, as a number: how high it is
z of event's location
number
The z of %event.location%, as a number
Can be cancelled: Yes
player is: The victim if a player was hurt; otherwise the attacker if a player dealt the damage; otherwise nobody
effectspawn mob <name> at <location>since 1.7.28example
Make one of a described mob there. last summoned entity is the creature
command /boss:
permission: op
players only: true
trigger:
spawn mob "Frost Giant" at player's location
set {_giant} to last summoned entity
make {_giant} target player
Which mob block a creature was made from, as its name; unset for any other creature
command /summongiant:
permission: op
players only: true
trigger:
spawn mob "Frost Giant" at player's location
set {_made} to last summoned entity
send "&7That is a &f" + mob name of {_made}
A mob block describes a creature once: what it is, how strong, what it carries and drops, and what happens when it dies. spawn mob then makes one wherever you like.
mob "&bFrost Giant":
type: zombie
health: 100
damage: 8
holding: diamond axe
wearing: diamond helmet, diamond chestplate
drops: 3 diamond, 1 ice
experience: 50
on death:
broadcast "&bThe Frost Giant has fallen to %player.name%!"
on hit:
apply slowness 2 to player for 3 seconds
command /giant:
permission: "mobs.spawn"
players only: true
trigger:
spawn mob "Frost Giant" at player's location
Inside the block
Meaning
type: <creature>
What kind of creature it is: zombie, skeleton, iron golem. A zombie if left out
name: <text>
The name shown above it; the block's own name if left out, and name: none for no name
health: <n>
Its health, in half hearts, up to 2048
damage: <n>
How hard it hits, for a creature that attacks
speed: <n>
How fast it is, as a multiple of what such a creature usually is: 1.5 is half as fast again
holding: <item>
What it has in its hand
wearing: <item>, <item>
Its armour; each piece goes where it belongs
drops: <item>, <item>
What it leaves when it dies, in place of what such a creature usually drops. drops: nothing for nothing
experience: <n>
The experience it leaves
glowing: true / silent: true / baby: true
As it says
on spawn:
Runs when one is spawned. player is whoever's script spawned it, if anybody
on death:
Runs when one dies. player is who killed it; there is none if nobody did
on hit:
Runs when it hurts a player, who is player
on hurt:
Runs when a player hurts it; player is that player
Syntax
Meaning
spawn mob <name> at <location>
Make one of a described mob there. last summoned entity is the creature
mob name of <entity>
Which mob block a creature was made from, as its name; unset for any other creature
Inside the four blocks {_mob} is the creature and {_name} its mob's name; in on hit: and on hurt:{_damage} is how much damage was done. cancel event in those two stops the damage.
A mob is known by its name without colours, whatever capitals it is written with: the block above is spawned as "Frost Giant" or "frost giant".
A creature remembers which mob it is. After a restart or a reload its blocks still run, as long as a script still has a mob block of that name.
The block's lines are worked out when one is spawned, so health: {boss.health} takes the saved variable as it is then. Local variables cannot be used in them.
For creatures with skills, phases and models of their own, the MythicMobs plugin and the HyperMobs addon go further.