rmp::behavior::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
| Field | Type | Default | What it is |
|---|---|---|---|
dialogue | std::string | The .yarn file | |
node | std::string | "Start" | Where it starts |
range | float | 40 | World units between the two positions |
player | Handle<Object> | {} | Who talks to it |
action | std::string | "interact" | The |
once | bool | false | Talks the first time only |
on_load | Callback<Dialogue &> | The conversation was loaded, before it first starts: where the game binds its variables and registers its functions and commands. | |
on_talk | Callback<Dialogue &> | The conversation started: show it | |
on_done | Callback<> | ...and finished | |
ours | struct { … } | What it is keeping track of; not yours to write. |
in_range
Close enough to talk
talking
A conversation is running
conversation
What it says
from
A Talker with the fields the map's entity has by these names — dialogue, node, range, once — and the defaults for the rest.