Say how close an NPC has to be placed to be talked to
A reader drew their own town, put the elder 115 pixels from anywhere the player could stand, and spent the rest of their time looking for the bug in jrpg_cmhf_talk. There is no bug: the handler finds nobody within TALK_RANGE and returns success, which is indistinguishable from the game not being wired up. The chapter stated the constant and not what it means in the editor. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KzBDV2fqgnUAcqCKqKvc71
This commit is contained in:
@@ -962,6 +962,13 @@ range, otherwise do nothing.
|
|||||||
#define TALK_RANGE 64.0f
|
#define TALK_RANGE 64.0f
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Place your NPCs with that number in mind.** The distance is measured between the two
|
||||||
|
actors' positions, and both sprites are 32 pixels, so 64 is two sprite widths — close, by
|
||||||
|
design. An NPC parked behind a building or across a wall from anywhere the player can stand
|
||||||
|
is an NPC the player can see and never talk to, and nothing reports that: the handler finds
|
||||||
|
nobody in range and returns success. If a conversation will not open, print the distance
|
||||||
|
before you go looking at the code.
|
||||||
|
|
||||||
```c excerpt=examples/jrpg/world.c
|
```c excerpt=examples/jrpg/world.c
|
||||||
#define TOWNSFOLK_COUNT (sizeof(TOWNSFOLK) / sizeof(TOWNSFOLK[0]))
|
#define TOWNSFOLK_COUNT (sizeof(TOWNSFOLK) / sizeof(TOWNSFOLK[0]))
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user