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
| Type | Fields | Does |
|---|---|---|
give_item | item, count=1 | Hands it over, dropping it at their feet if there is no room. |
take_item | item, count=1 | Takes it. All or none, never half a payment. Item or #tag. |
grant_effect | effect, seconds=60, amplifier=0, visible=true | A blessing, a warm meal, a night's rest. |
heal | health=6.0 | In half-hearts. Mends them where they stand. |
give_experience | points=0, levels=0 | Levels mean the same thing at every point in the game; points do not. |
play_sound | sound, volume=1.0, pitch=1.0 | Into the world at the speaker, so a bystander hears it too. |
set_flag | flag, set=true | Writes something down about this player, or rubs it out. |
run_command | command | Any server command, level 2. The escape hatch. |
adjust_gossip | gossip, amount, radius=0 | Moves vanilla's own reputation. 0 radius is the speaker alone. |
open_dialogue | dialogue | Carries on into another file, same speaker. This is how trees are built. |
go_back | none | Returns to whatever they left to ask about this. Pair with can_go_back. |
open_trades | none | Vanilla's merchant screen, through vanilla's own discount path. Returns here after. |
if_so | requires, then | One 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.
| Field | Range |
|---|---|
count | 1 to 64 |
seconds | 1 to 86400 (a day) |
amplifier | 0 to 4 |
health | 0.5 to 100.0 |
points | 0 to 100000 |
levels | 0 to 100 |
volume | 0.0 to 2.0 |
pitch | 0.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_itemover the same thinghas_itemsguards.go_backbehindcan_go_back.open_tradesbehindhas_trades.
Adding your own
A record, a MapCodec, and one call. See For mod developers.
