Denizen Script Commands


Commands are always written with a '-' before them, and are the core component of any script, the primary way to cause things to happen.
Learn about how commands work in The Beginner's Guide.


Showing 1 out of 184 commands...
NameAttack
Syntaxattack [<entity>|...] (target:<entity>/cancel)
Short DescriptionMakes an entity, or list of entities, attack a target.
Full DescriptionThe attack command causes a mob entity to attack a target mob entity or player.

This technically can be used on an NPC, but it will trigger the Citizens internal punching-pathfinder.
This attack mode doesn't work well. If you want NPC combat, consider using Sentinel instead: 🔗https://github.com/mcmonkeyprojects/Sentinel/blob/master/README.md.

To cancel an attack, use the 'cancel' argument instead of specifying a target.
Related Tags<NPCTag.is_fighting> Returns whether the NPC is currently targeting an entity for the Citizens internal punching pathfinder. (...)
<NPCTag.attack_strategy> Returns the NPC's current navigator attack strategy. (...)
<NPCTag.target_entity> Returns the entity being targeted by the NPC's current navigation (if any).
Usage Example
# Use to make the player's target entity attack a nearby entity.
- attack <player.target> target:<npc.location.find.living_entities.within[10].random>
Usage Example
# Use to make a random nearby entity attack a player.
- attack <player.location.find.living_entities.within[10].random> target:<player>
Usage Example
# Use to stop an entity from attacking.
- attack <[entity]> cancel
Groupentity
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/entity/AttackCommand.java#L26