# rmp::behavior::Talker

> Someone to talk to.

Source: https://omardev29.github.io/rmp-docs/reference/behaviors/Talker.html

behavior `#include <rmp/behavior.h>` [include/rmp/behavior.h:631](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L631-L665)

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`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-ui.html) 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`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-ui.html#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 [`rmp::input`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-input.html) action; "" = on arriving |
| `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`

bool in_range() const

function [include/rmp/behavior.h:644](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L644)

Close enough to talk

### `talking`

bool talking() const

function [include/rmp/behavior.h:645](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L645-L647)

A conversation is running

### `conversation`

Dialogue &conversation()

function [include/rmp/behavior.h:648](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L648)

What it says

### `from`

static Talker from(const MapObject &object)

static function [include/rmp/behavior.h:652](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L652)

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