Mechanic

command

Executes a command

Aliases

cmd

Configuration Fields (5)

NameTypeDefaultDescription
command
cmd, c
PlaceholderStringThe command to execute
asCaster
caster, ac, sudo, asmob
booleanfalseWhether to execute the command as the caster of the skill
asTarget
target, at, sudotarget
booleanfalseWhether to execute the command as the targeted entity of the skill
requireTarget
rt
booleanfalseExecute the command if the skill has a target
asOp
op
booleanfalseWhether to execute the command with all permissions

Examples & Notes

Examples

Correctly written command-skills

  Skills:
  - command{c="give <target.name> gold_ingot 20"} @trigger ~onInteract
  - command{c="minecraft:tp <target.name> <mob.uuid>"} @self ~onDamaged
  - command{c="say HELLO <target.name>";asTarget=true;asOp=true} @NearestPlayer{r=10}

Invalid command-skills

The below example(s) won’t work because certain symbols haven’t been substituted with message variables.

  Skills:
  - command{c="minecraft:summon Zombie ~ ~ ~ {NoAI:true,CustomName:"Summoned Zombie"}"}

In this specific case, the ~ symbol is a problem: while normally, in vanilla, it would just mean “the position of the one that is executing the command”, this is not possible with this specific setup, as it is the console that is executing the command, and as such there is no “position” that can be used. A way to fix this would have been to use the <caster.l.x>,<caster.l.y> and <caster.l.z> placeholders

Making a player execute a command

This example will execute the “say” commands for the player that interacted with the mob

ExampleMob:
  Type: ZOMBIE
  Skills:
  - command{c="say <target.name>";asTarget=true;asOp=true} @trigger ~onInteract

Universal Mechanic Options

Author:
Ashijin
Community-maintained documentation for the Mythic plugin ecosystem.