Repository navigation
Send PERC_ASSESSREMOVEWEAPON when the player's weapon is away - #1087
Open
pieterdeschepper wants to merge 1 commit into
Open
pieterdeschepper wants to merge 1 commit into
pieterdeschepper wants to merge 1 commit into
Conversation
The perception was sent when the sheathe animation started. Until the animation's fight-mode event, the player still counts as armed. An npc whose B_AssessSC runs in that window (Gothic 1: ZS_AssessFighter via B_AssessFighter) starts reacting after the signal has already gone, and then never gets one. It keeps its weapon drawn, waits, and eventually attacks the unarmed player (Try#944, item 16). Send the perception from implSetFightMode when the player's fight mode becomes NONE, and from closeWeapon only when there is no animation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes item 16 of #944 (NPCs keep their weapons drawn):
Cause
Npc::closeWeaponsentPERC_ASSESSREMOVEWEAPONas soon as the sheathe animation started. The player still counts as armed until the animation's fight-mode event, which comes about 0.5 s later.An npc whose perception runs in that window (in Gothic 1:
B_AssessSC→B_AssessFighter→ZS_AssessFighter) starts reacting after the signal has already been sent. While it was still in its routine state the signal was ignored, and no second one comes.ZS_AssessFighteronly stands down on that perception or on distance, so the npc keeps its weapon drawn. If the player stays withinHAI_DIST_ABORT_MELEE, it goes toZS_AssessFighterWaitand thenZS_Attackagainst the unarmed player.Change
implSetFightModesendsPERC_ASSESSREMOVEWEAPONwhen the player's fight mode becomesNONE, i.e. when the weapon is actually away.closeWeaponstill sends it directly fornoAnim, since no animation event follows.Testing
Gothic 1 on macOS (Apple M3 Pro). In a test build the hero was scripted to draw and immediately sheathe next to an Old Camp crossbow guard (
GRD_229), with logging of the guard's perceptions and states:ZS_AssessFighterafter the signal, never stood down, and switched toZS_Attackwith the crossbow drawn.It was also checked in normal play. These were local builds.
🤖 Generated with Claude Code