On this page
  1. Fields
    1. in_range
    2. talking
    3. conversation
    4. from

rmp::behavior::Talker

behavior #include <rmp/behavior.h> include/rmp/behavior.h:631
struct Talker

Someone to talk to. When player is within range and action is pressed — or as soon as it is within range, with no action — it loads dialogue (a .yarn of resources/, once), starts it at node and hands it to on_talk, where the game shows it: a presenter of rmp::ui in a scene pushed on top when it should pause the world (DialogueBox and DialogueStage), or a DialogueBubble drawn in this scene's _draw(). in_range() is for the prompt over its head — rmp::ui::at(self.position, ...) "Talk". once talks a single time; the dialogue's variables and visits stay with it.

From the editor: "dialogue" (String), "node" (String), "range" (Float), "once" (Bool).

Added to an object with add<rmp::behavior::Talker>(); the framework calls its _update with the object it is on.

Fields

FieldTypeDefaultWhat it is
dialoguestd::string

The .yarn file

nodestd::string"Start"

Where it starts

rangefloat40

World units between the two positions

playerHandle<Object>{}

Who talks to it

actionstd::string"interact"

The rmp::input action; "" = on arriving

onceboolfalse

Talks the first time only

on_loadCallback<Dialogue &>

The conversation was loaded, before it first starts: where the game binds its variables and registers its functions and commands.

on_talkCallback<Dialogue &>

The conversation started: show it

on_doneCallback<>

...and finished

oursstruct { … }

What it is keeping track of; not yours to write.

in_range

bool in_range() const

Close enough to talk

talking

bool talking() const

A conversation is running

conversation

Dialogue &conversation()

What it says

from

static Talker from(const MapObject &object)

A Talker with the fields the map's entity has by these names — dialogue, node, range, once — and the defaults for the rest.