Skip to content

Actions

Markus Bordihn edited this page Aug 31, 2024 · 3 revisions

Actions ๐ŸŽฎ

Make your NPC more interactive with powerful actions. Here are some basic examples:

  • /say Hello, ... ๐Ÿ‘‹
  • /give @initiator stone ๐ŸŽ
  • /scoreboard players add @initiator close 5 ๐Ÿ“Š
  • /tp @initiator -28 63 399 ๐Ÿš€

Default permissions limit certain actions, so regular players can't use commands like /give or /tp. Actions can be triggered by specific events such as interacting with a player, NPC getting hurt, NPC dying, player getting close to the NPC, or even opening and closing dialogs.

Action List ๐Ÿ“œ

You can set up multiple actions for an event or a dialog button. Actions are performed in the order you list them.

Action List screen

You can change the order by using the up and down buttons.

Action Entry ๐Ÿ› ๏ธ

Each action has options to customize how it works.

Action Type

The action type decides what the action will do. For example, the command action lets you define the command and who it targets.

Command

Run a command with a specified target.

Action Options screen

  • Check Execute as player to run commands using the player's permission level.
  • Turn on Debug to get insights into errors and more while testing.

Close Dialog

Close Dialog screen

Close the dialog screen after the action is completed.

Interact Block

Trigger an interaction with a block from the NPC.

Interact Block screen

Open Trading Screen

Open the trading screen for the NPC.

Open Trading Screen screen

Open Default Dialog

Open the default dialog for the NPC.

Open Default Dialog screen

Open Named Dialog

Open a specific dialog for the NPC, the dialog name will be validated.

Open Named Dialog screen

Action Placeholders ๐Ÿงฉ

You can use placeholders in actions for a personal touch:

Placeholder Description
@npc Name of the NPC
@npc-uuid UUID of the NPC
@initiator Name of the player who started the dialog
@initiator-uuid UUID of the player who started the dialog

NPC-Specific Commands ๐Ÿค–

Use NPC-specific commands for more advanced actions. For example, you can open a trading screen during a dialog, open a specific dialog, or interact with a block.

Examples:

  • /easy_npc trading open @npc
  • /easy_npc dialog open @npc @initiator <dialog-name>
  • /easy_npc interact block @npc-uuid ~1 ~1 ~

Action Types ๐Ÿš€

Explore the different types of actions you can set up for your NPC:

Basic Actions ๐Ÿ”„

Set up basic actions like player interaction, NPC getting hurt, or NPC dying.

Basic Action Setup screen

Dialog Actions ๐Ÿ’ฌ

Define actions for dialog entries, like opening or closing the dialog screen, or clicking on a dialog button.

Dialog Action Setup screen

Distance Actions ๐Ÿ“

Trigger actions based on how close the player is:

  • Near (within 16 Blocks)
  • Close (within 8 Blocks)
  • Very Close (within 4 Blocks)
  • In Touch (within 1 Block)

Actions trigger once when in range, but can reset and trigger again if the player leaves and re-enters.

Distance Action Setup screen

Default Interaction Actions ๐ŸŽฏ

When players interact with an NPC, it automatically includes the Open Default Dialog and Open Trading actions by default.

Default Interaction Actions screen

These actions will only be triggered if a dialog or trading screen is set up for the NPC. If you prefer not to use these default actions, you can easily remove them under Actions -> Basic Actions -> On Interaction They are only added when the NPC is first spawned and won't be re-added once removed.