Commit 3a9e778
committed
fix: set GlobalOther=hero before ZS_* loops and dialog condition evaluation
After commit 69d7707 correctly fixed the GlobalOther save/restore in
ExecutePerception, a stale NPC (e.g. a Shadow guard from a recent perception)
remained in GlobalOther between perception calls. This caused two visible bugs:
1. NPCs turned their backs during conversation - routine states like ZS_*_Loop
called B_AssessTalk/B_SmartTurnToNpc using 'other', which pointed to the stale
Shadow instead of the player. NPCs would physically rotate toward that guard.
2. Important dialogs refused to trigger - conditions like Npc_GetDistToNpc(self,other)
or guild attitude checks ran against the Shadow's position/guild, not the hero's,
causing them to return false and skip the dialog entirely.
Fix in AiHandler: set GlobalOther=GlobalHero before executing ZS_* state functions.
This is just a sensible default - perception calls override GlobalOther via their
own save/restore, so combat/assess perceptions are unaffected.
Fix in DialogService: save/restore GlobalOther and explicitly set it to GlobalHero
around Info_*_Condition calls. In Gothic's convention, self=NPC and other=hero in
all dialog condition functions.1 parent b69faf3 commit 3a9e778
2 files changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| 152 | + | |
149 | 153 | | |
| 154 | + | |
150 | 155 | | |
151 | 156 | | |
| 157 | + | |
152 | 158 | | |
153 | 159 | | |
154 | 160 | | |
| |||
0 commit comments