From cf0142ea8511fad2bec0328748c7ed5c79d89100 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sun, 2 Aug 2026 09:36:25 -0400 Subject: [PATCH] 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) Claude-Session: https://claude.ai/code/session_01KzBDV2fqgnUAcqCKqKvc71 --- docs/21-tutorial-jrpg.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/21-tutorial-jrpg.md b/docs/21-tutorial-jrpg.md index c30661c..a67d1a8 100644 --- a/docs/21-tutorial-jrpg.md +++ b/docs/21-tutorial-jrpg.md @@ -962,6 +962,13 @@ range, otherwise do nothing. #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 #define TOWNSFOLK_COUNT (sizeof(TOWNSFOLK) / sizeof(TOWNSFOLK[0])) ```