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...
NameTrait
Syntaxtrait (state:true/false/{toggle}) [<trait>] (to:<npc>|...)
Short DescriptionAdds or removes a trait from an NPC.
Full DescriptionThis command adds or removes a trait from an NPC.

Use "state:true" to add or "state:false" to remove.
If neither is specified, the default is "toggle", which means remove if already present or add if not.

Note that a redundant instruction, like adding a trait that the NPC already has, will give an error message.

The trait input is simply the name of the trait, like "sentinel".

Optionally, specify a list of NPCs to apply the trait to. If unspecified, the linked NPC will be used.
Related Tags<NPCTag.has_trait[<trait>]> Returns whether the NPC has a specified trait.
<NPCTag.traits> Returns a list of all of the NPC's traits.
<server.traits> Returns a list of all available NPC traits on the server.
Usage Example
# Use to add the Sentinel trait to the linked NPC.
- trait state:true sentinel
Usage Example
# Use to toggle the MobProx trait on the linked NPC.
- trait mobprox
Groupnpc
RequiresCitizens
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/npc/TraitCommand.java#L29