# Action Types

Actions run when a player clicks an NPC, walks up to it or picks a dialogue choice. They run in order, top to bottom. Each one is written as the type in brackets, then its arguments separated by `;`.

## Action Types

| Action Type | Description |
| ----------- | ----------- |
| \[MESSAGE] | Send a message to the player |
| \[COMMAND] | Run a command as the console, the player or the player with OP |
| \[SERVER] | Send the player to another server on the proxy |
| \[PHOENIXSHOP] | Open a PhoenixShop shop or one of its categories |
| \[TRADE] | Open the NPC's vanilla trade window |
| \[GIVE\_ITEM] | Give the player an item |
| \[OPEN\_MENU] | Open a DeluxeMenus, ChestCommands or TrMenu menu |
| \[PERMISSION] | Stop here for players without a permission |
| \[CONDITION] | Stop here for players who fail a condition |
| \[RANDOM] | Run one action picked at random |
| \[DIALOGUE] | Open a step of the NPC's dialogue |
| \[SOUND] | Play a sound to the player |
| \[ACTION\_BAR] | Show a message in the action bar |
| \[TITLE] | Show a title and subtitle |
| \[DELAY] | Wait before running the next actions |
| \[SPEAK] | Show a speech bubble above the NPC to the player |
| \[TELEPORT] | Teleport the player to a location |
| \[ITEM\_COST] | Take items from the player, or stop when they have too few |
| \[EXP\_COST] | Take experience from the player, or stop when they have too little |
| \[FOLLOW] | Make the NPC follow the player |
| \[STOP\_FOLLOW] | Make the NPC stop following |
| \[WALK] | Make the NPC walk to an anchor, the player, home or a spot |
| \[MYTHIC\_SKILL] | Cast a MythicMobs skill from the NPC at the player |
| \[MYTHIC\_SPAWN] | Spawn a MythicMobs mob at the NPC |

Other plugins can add action types of their own through the [API](../api/README.md#custom-actions), such as the [currency actions](#currency-actions) of PhoenixCurrencies.

## Message

* **Syntax:** `[MESSAGE] <message>`
* **Example:** `[MESSAGE] &aWelcome, %player%!`

## Command

`op` runs the command as the player with OP for that one command, and only when [Allow Op Commands](../configurations/main-configuration.md#allow-op-commands) is on. It is off by default: while it is off, an `op` command is skipped and the console warns once per NPC. The editor's command builder only offers `console` and `player`.

* **Syntax:** `[COMMAND] <console|player|op>; <command>`
* **Example:** `[COMMAND] console; give %player% diamond 1`

## Server

Uses the BungeeCord plugin channel, so the proxy has to accept it. The server name is the one in the proxy's config.

* **Syntax:** `[SERVER] <server>`
* **Example:** `[SERVER] survival`

## PhoenixShop

Opens a shop of PhoenixShop or PhoenixShop Lite, as if the player typed `/phoenixshop open`, so the shop's own permissions and conditions apply. With a category, that category opens straight away. Without PhoenixShop installed the action does nothing, and the console says so once per NPC. In the editor's Action Builder the shop is picked from a list when PhoenixShop is installed.

* **Syntax:** `[PHOENIXSHOP] <shop>; [category]`
* **Example:** `[PHOENIXSHOP] shop; ores-and-gems`

## Trade

Opens a vanilla villager trade window with the NPC's [trades](../main-features/npcs/edit-npc.md#trades). Without a shop name it uses the trades of this NPC; a name uses the trades saved under that name, the id of the NPC they were made on.

* **Syntax:** `[TRADE] [shop]`
* **Example:** `[TRADE]`

## Give Item

Gives the player the items, or drops them at their feet when the inventory is full. Give a material, or `item:` and the encoded item for an item exactly like one you held. With `once` each player gets it only one time.

* **Syntax:** `[GIVE_ITEM] <amount>; <material|item:...>; [once]`
* **Example:** `[GIVE_ITEM] 1; BREAD; once`

## Open Menu

Opens a menu of another menu plugin for the player. `auto` uses the first of DeluxeMenus, ChestCommands and TrMenu that is installed. Add `player` to run the open command as the player instead of the console. Without the menu plugin the action does nothing, and the console says so once.

* **Syntax:** `[OPEN_MENU] <auto|deluxemenus|chestcommands|trmenu>; <menu>; [console|player]`
* **Example:** `[OPEN_MENU] auto; spawn_menu`

## Permission

A player without the permission is told they are not allowed, and no later action runs. An empty permission lets everyone through.

* **Syntax:** `[PERMISSION] <permission>`
* **Example:** `[PERMISSION] server.vip`

## Condition

A player who fails the [condition](../features/nameplate-and-indicator.md#conditions) gets the optional message, and no later action runs.

* **Syntax:** `[CONDITION] <condition>; [message]`
* **Example:** `[CONDITION] %player_level% >= 10; &cCome back at level 10.`

## Random

Picks one of the actions separated by `||` and runs it, then carries on with the rest of the list.

* **Syntax:** `[RANDOM] <action> || <action> || ...`
* **Example:** `[RANDOM] [MESSAGE] &eHello! || [MESSAGE] &eNice day. || [MESSAGE] &eGo away.`

## Dialogue

Opens a step of the NPC's [dialogue](../features/dialogues.md). Without a step, the start step opens.

* **Syntax:** `[DIALOGUE] [step]`
* **Example:** `[DIALOGUE] step_2`

## Sound

* **Syntax:** `[SOUND] <sound>; <volume>; <pitch>`
* **Example:** `[SOUND] ENTITY_VILLAGER_YES; 1; 1`

## Action Bar

* **Syntax:** `[ACTION_BAR] <message>`
* **Example:** `[ACTION_BAR] &eRight-click again to buy.`

## Title

Fade in, stay and fade out are in ticks.

* **Syntax:** `[TITLE] <title>; <subtitle>; <fadein>; <stay>; <fadeout>`
* **Example:** `[TITLE] &6Welcome; &7to the server; 10; 40; 10`

## Delay

Waits that many seconds before the actions below it run. The rest of the list is dropped if the player leaves.

* **Syntax:** `[DELAY] <seconds>`
* **Example:** `[DELAY] 1.5`

## Speak

Shows the text above the NPC's name to the player only, for the given seconds or the NPC's [bubble time](../features/speech-bubbles.md#bubble-time). Placeholders work, and `\n` starts a new line.

* **Syntax:** `[SPEAK] <text>; [seconds]`
* **Example:** `[SPEAK] &eHello, %player%!; 5`

## Follow

The NPC follows the player who clicked it, see [Movement](../features/movement.md#follow). `[STOP_FOLLOW]` ends it and sends the NPC back to its route or home.

* **Syntax:** `[FOLLOW]`, `[STOP_FOLLOW]`

## Walk

The NPC walks to one of its anchors, `player` for the one who clicked, `home`, or `x y z` in its own world. The next actions run without waiting for it to arrive.

* **Syntax:** `[WALK] <anchor | player | home | x y z>`
* **Example:** `[WALK] market`

## MythicMobs

Needs MythicMobs. `[MYTHIC_SKILL]` casts a skill with the NPC as the origin and the player as the target. `[MYTHIC_SPAWN]` spawns a mob at the NPC, at level 1 unless a level is given.

* **Syntax:** `[MYTHIC_SKILL] <skill>`, `[MYTHIC_SPAWN] <mob>; [level]`
* **Example:** `[MYTHIC_SPAWN] SkeletalKnight; 5`

## Teleport

Works on Folia, across regions and worlds. The builder's Use Your Location button fills in where you stand.

* **Syntax:** `[TELEPORT] <world>; <x>; <y>; <z>; [yaw]; [pitch]`
* **Example:** `[TELEPORT] world; 100.5; 64; -20.5; 90; 0`

## Item Cost

Takes the items from the inventory and off hand. A player with too few gets a message and no later action runs. Give a material to take any item of it, or `item:` and the encoded item for items exactly like one you held; the builder fills that in from your hand.

* **Syntax:** `[ITEM_COST] <amount>; <material|item:...>`
* **Example:** `[ITEM_COST] 5; DIAMOND`

## Experience Cost

Takes levels or experience points. A player with too little gets a message and no later action runs.

* **Syntax:** `[EXP_COST] <amount>; <levels|points>`
* **Example:** `[EXP_COST] 10; levels`

Before the first cost of a list runs, every cost up to the next `[DELAY]` is checked, so a player who can pay the first cost but not the second keeps both.

## Currency Actions

With PhoenixCurrencies installed, three more types sell, reward or check for any of its currencies. A take or require the player cannot afford stops the actions after it, so put it before the reward.

* **Syntax:** `[CURRENCY_GIVE] <currency> <amount>`, `[CURRENCY_TAKE] <currency> <amount>`, `[CURRENCY_REQUIRE] <currency> <amount>`
* **Example:** `[CURRENCY_TAKE] gems 50`

See the PhoenixCurrencies page [NPCs & Holograms](../../phoenix-currencies/features/npcs-and-holograms.md).

Source: https://www.phoenixplugins.com/docs/phoenix-npcs/plugin-information/action-types