Trading - MarkusBordihn/BOs-Easy-NPC GitHub Wiki

Trading 💰

Trading lets an NPC act like a merchant. The current code supports four trading modes, from a simple shared setup to fully custom offers.

Trading Modes 🧭

None Trading

Use this when the NPC should not open a normal trade screen. This is useful if trading is handled by another mod or only opened through actions.

None Trading

Basic Trading

Basic trading is the quickest setup. It uses one shared configuration for all offers on the page:

  • shared max uses
  • shared rewarded XP
  • shared reset timer

It is a good fit for simple shops with a small offer list. The current basic layout supports up to 12 offers.

Basic Trading

Advanced Trading

Advanced trading is used when offers need their own settings. Each offer can have its own:

  • max uses
  • rewarded XP
  • price multiplier
  • demand
  • trade action

Easy NPC also switches to Advanced Trading automatically when at least one offer needs its own settings or when a per-offer action is configured. The current advanced layout supports up to 25 offers.

Advanced Trading

Custom Trading

Custom trading uses NBT-based trade data instead of the normal UI-driven setup. Use this when you want to import or maintain trades in preset data, or when another workflow already provides valid merchant trade NBT. This mode is also useful when the trade structure should stay close to vanilla merchant data.

Custom Trading NBT Data

Uses and Resets 🔁

Easy NPC stores trade usage and shows the remaining uses in the trading editor.

  • Basic Trading shows uses / max uses
  • Advanced Trading shows the current uses next to the editable max-uses field
  • offers that run out of stock are shown accordingly in the trade screen

Both Basic and Advanced Trading support timed resets. If a reset timer is configured, used offers are restored automatically after the configured number of minutes.

You can also reset all offers manually:

  • with the Reset Trades button in the trading screen
  • with the command /easy_npc trading reset <npc>

Trade Actions 🧩

Easy NPC supports actions when a trade is completed. There are two ways to use them:

  • a general On Trade action event in Actions
  • offer-specific actions in Advanced Trading

Offer-specific actions only run for the selected trade offer. This is useful for rewards, follow-up dialogs, scoreboard updates, or special shop logic.

Examples:

  • give a bonus item after buying a rare offer
  • add a scoreboard value after each purchase
  • open a follow-up dialog after a quest item was bought

Trade action editor

Choosing the Right Mode 🎯

  • Use None if trading should be opened only through actions or another mod
  • Use Basic if all offers share the same reset and usage rules
  • Use Advanced if one offer needs its own stats or its own action
  • Use Custom if the trade data should come from presets or direct merchant-style NBT

Opening the Trade Screen 🛒

If the NPC has trading but no dialog, the trade screen can open directly on interaction. If the NPC uses dialogs, you can open trading from:

  • a dialog button
  • a normal action
  • the Open Trading default interaction action

If another player is already trading with the same NPC, Easy NPC blocks a second trade session until the current one is finished.

Open Trading Screen

⚠️ **GitHub.com Fallback** ⚠️