Pixel Dream StudiosWiki

Actions

Everything a conversation can give, take, or do about the world, including running any command a datapack function could.

"type" in a choice's actions, or in a dialogue's on_close. They run in the order they are written.

An unnamespaced type means one of this mod's: "give_item" and "rpg_dialogue:give_item" are the same thing.

The list

TypeFieldsDoes
give_itemitem, count=1Hands it over, dropping it at their feet if there is no room.
take_itemitem, count=1Takes it. All or none, never half a payment. Item or #tag.
grant_effecteffect, seconds=60, amplifier=0, visible=trueA blessing, a warm meal, a night's rest.
healhealth=6.0In half-hearts. Mends them where they stand.
give_experiencepoints=0, levels=0Levels mean the same thing at every point in the game; points do not.
play_soundsound, volume=1.0, pitch=1.0Into the world at the speaker, so a bystander hears it too.
set_flagflag, set=trueWrites something down about this player, or rubs it out.
run_commandcommandAny server command, level 2. The escape hatch.
adjust_gossipgossip, amount, radius=0Moves vanilla's own reputation. 0 radius is the speaker alone.
open_dialoguedialogueCarries on into another file, same speaker. This is how trees are built.
go_backnoneReturns to whatever they left to ask about this. Pair with can_go_back.
open_tradesnoneVanilla's merchant screen, through vanilla's own discount path. Returns here after.
if_sorequires, thenOne choice that pays differently depending on the world.

Ranges

Values outside these are reported when the pack is read, rather than silently clamped at runtime.

FieldRange
count1 to 64
seconds1 to 86400 (a day)
amplifier0 to 4
health0.5 to 100.0
points0 to 100000
levels0 to 100
volume0.0 to 2.0
pitch0.5 to 2.0
amount (gossip)1 to 100
radius (gossip)0.0 to 128.0

The ones worth knowing about

run_command

A conversation can do anything a datapack function can: place a structure, grant an advancement, move a scoreboard, start your own quest, without anyone writing Java.

{ "type": "run_command", "command": "function mypack:open_the_gate" }

It runs from the player's position with @s bound to them, at permission level 2, with output suppressed.

adjust_gossip

This moves vanilla's own gossip: the same number that already sets trade prices, already decides whether the golems mind you, and already spreads between villagers on its own.

{ "type": "adjust_gossip", "gossip": "minor_positive", "amount": 5, "radius": 16.0 }

A radius of 0 means the speaker alone, which is the usual one: they will pass it on themselves. For scale, vanilla hands out 25 for laying hands on a villager, so keep anything a conversation gives away well under that.

open_trades

Opens vanilla's merchant screen through vanilla's own discount path, so reputation earned in the conversation is already priced in. The conversation returns when the trades are closed.

A digit held into the trades

Vanilla's container screens read 1–9 as "swap the hovered slot with that hotbar slot", so a digit held into a choice that opens the trades can swap whatever the pointer is resting on. It needs both a held key and a pointer over a slot.

if_so

One choice that pays differently depending on the world, rather than two choices with the same words on them.

{
  "type": "if_so",
  "requires": [ { "condition": "at_hour", "span": "night" } ],
  "then": [
    { "type": "give_item", "item": "minecraft:torch", "count": 4 }
  ]
}

go_back

Returns the player to whatever conversation they left to ask about this one. Pair it with the can_go_back condition so the way back is only offered where there is one:

"choices": [
  {
    "label": { "translate": "mypack.back" },
    "requires": [ { "condition": "can_go_back" } ],
    "actions": [ { "type": "go_back" } ]
  },
  {
    "label": { "translate": "mypack.back" },
    "requires": [ { "condition": "inverted", "of": { "condition": "can_go_back" } } ]
  }
]

Two choices with the same label, one that returns and one that simply closes, so the same wording works whether the player arrived from a menu or walked up to the speaker.

Write them in pairs

An action that takes something goes with a condition that checks for it, and the player is never offered what they cannot afford.

  • take_item over the same thing has_items guards.
  • go_back behind can_go_back.
  • open_trades behind has_trades.

Adding your own

A record, a MapCodec, and one call. See For mod developers.

On this page