跳到主要内容

Skills Overview

Skills are actions that mobs can perform in response to triggers. They allow you to create dynamic, interactive mob behaviors.

Skill Syntax

Skills follow this format:

<mechanic>{<parameters>} @<targeter> ~<trigger>

Example:

Skills:
- effect:particles{p=flame;amount=10} @self ~onSpawn
- damage{amount=5} @target ~onAttack

Components

Mechanics

The action to perform (damage, particles, sounds, etc.)

Targeters

Who/what the mechanic affects (@self, @target, @playersInRadius{r=10}, etc.)

Triggers

When the skill activates (~onSpawn, ~onAttack, ~onDamaged, etc.)


Available Triggers

TriggerDescription
~onSpawnWhen the mob spawns
~onAttackWhen the mob attacks an entity
~onDamagedWhen the mob takes damage
~onDeathWhen the mob dies
~onInteractWhen a player right-clicks the mob
~onShootWhen the mob shoots a projectile
~onEnterCombatWhen entering combat
~onDropCombatWhen exiting combat
~onTargetChangeWhen the target changes
~onSignal:<name>When receiving a signal

Common Mechanics

effect:particles

Spawn particles

- effect:particles{p=flame;amount=10;hs=0.2;vs=0.1} @self ~onSpawn

effect:sound

Play a sound

- effect:sound{s=entity.zombie.ambient;v=0.6;p=1.2} @self ~onSpawn

damage

Deal damage to target

- damage{amount=5} @target ~onAttack

message

Send a message

- message{msg="Hello, <target.name>!"} @target ~onInteract

potion

Apply potion effect

- potion{type=SPEED;duration=100;level=1} @self ~onDamaged

Common Targeters

TargeterDescription
@selfThe mob itself
@targetThe mob's current target
@triggerEntity that triggered the skill
@playersInRadius{r=10}All players within radius
@nearestPlayerClosest player
@locationA specific location

Example Mob with Skills

FireDemon:
Type: BLAZE
Display: "&cFire Demon"
Health: 80
Skills:
# Spawn effects
- effect:particles{p=flame;amount=50} @self ~onSpawn
- effect:sound{s=entity.blaze.ambient;v=1.0} @self ~onSpawn

# Combat effects
- effect:particles{p=lava;amount=5} @self ~onAttack
- potion{type=FIRE_RESISTANCE;duration=100} @self ~onDamaged

# Death explosion
- effect:particles{p=explosion;amount=20} @self ~onDeath