Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPCs continue to warn the player character to sheath his weapon #219

Open
AmProsius opened this issue Mar 31, 2021 · 1 comment
Open

NPCs continue to warn the player character to sheath his weapon #219

AmProsius opened this issue Mar 31, 2021 · 1 comment
Labels
compatibility: easy This issue is easy to make compatible. impl: hook script func This issue requires hooking script functions. provided fix This issue has a fix provided in the comments. type: session fix The fix for this issues is persistent across a session. validation: required This issue needs validation from one of the validators.

Comments

@AmProsius
Copy link
Owner

AmProsius commented Mar 31, 2021

Describe the bug
Sometimes NPCs don't realize that the player character already sheathed his weapon and continue to warn him.

Expected behavior
NPCs now correctly realize if the player character sheathed his weapon.

Additional context
Bug provided by Blubbler.

@AmProsius AmProsius added the validation: required This issue needs validation from one of the validators. label Mar 31, 2021
@szapp
Copy link
Collaborator

szapp commented May 14, 2021

It would be nice to know the exact context when that happens, i.e. a reliable way to reproduce the issue. Without that, it will be impossible to test if the fix worked (similar to #13).

As for fixing the issue, I assume it would help to check again if the player is in any kind of fight mode in ZS_AssessFighter_Loop and in ZS_AssessFighterWait_Loop:

func int ZS_AssessFighter_Loop ()
{
PrintDebugNpc (PD_ZS_LOOP, "ZS_AssessFighter_Loop");
//######## SC in Nahkampfdistanz ! ########
if (Npc_GetDistToNpc(self,other) < HAI_DIST_ABORT_MELEE)
{
PrintDebugNpc (PD_ZS_CHECK, "...SC ist in Nahkampfdistanz!");
//---- Passender Kommentar ! ----

changed to

func int ZS_AssessFighter_Loop ()
{
    if (Npc_IsInFightMode(other, FMODE_NONE)) || (Npc_IsInFightMode(other, FMODE_FIST)) {
        return LOOP_END;
    };

    PrintDebugNpc       (PD_ZS_LOOP,    "ZS_AssessFighter_Loop");

    //######## SC in Nahkampfdistanz ! ########
    if (Npc_GetDistToNpc(self,other) < HAI_DIST_ABORT_MELEE)
    {
        PrintDebugNpc       (PD_ZS_CHECK,   "...SC ist in Nahkampfdistanz!");

        //---- Passender Kommentar ! ----

and

func int ZS_AssessFighterWait_Loop ()
{
PrintDebugNpc (PD_ZS_LOOP, "ZS_AssessFighterWait_Loop" );
//-------- Hat sich der SC mittlerweile entfernt ? --------
if (Npc_GetDistToNpc(self,other) > HAI_DIST_ABORT_MELEE)
{
PrintDebugNpc (PD_ZS_CHECK, "...SC ist außerhalb Nahkampfreichweite!");
B_AssessRemoveWeapon();
};
//-------- Ist die Wartezeit abgelaufen ? --------

changed to

func int ZS_AssessFighterWait_Loop  ()
{
    if (Npc_IsInFightMode(other, FMODE_NONE)) || (Npc_IsInFightMode(other, FMODE_FIST)) {
        return LOOP_END;
    };

    PrintDebugNpc           (PD_ZS_LOOP,    "ZS_AssessFighterWait_Loop" );

    //-------- Hat sich der SC mittlerweile entfernt ? --------
    if (Npc_GetDistToNpc(self,other) > HAI_DIST_ABORT_MELEE)
    {
        PrintDebugNpc       (PD_ZS_CHECK, "...SC ist außerhalb Nahkampfreichweite!");
        B_AssessRemoveWeapon();
    };

    //-------- Ist die Wartezeit abgelaufen ?  --------

Both of these changes are easily implemented by hooking before the respective functions and only continue into them given the added conditions.

@szapp szapp added compatibility: easy This issue is easy to make compatible. impl: hook script func This issue requires hooking script functions. provided fix This issue has a fix provided in the comments. type: session fix The fix for this issues is persistent across a session. labels May 14, 2021
@szapp szapp changed the title NPCs warn the player character to withdraw his weapon NPCs warn the player to sheath their weapon Feb 6, 2022
@szapp szapp changed the title NPCs warn the player to sheath their weapon NPCs continue to warn the player character to sheath his weapon Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility: easy This issue is easy to make compatible. impl: hook script func This issue requires hooking script functions. provided fix This issue has a fix provided in the comments. type: session fix The fix for this issues is persistent across a session. validation: required This issue needs validation from one of the validators.
Projects
None yet
Development

No branches or pull requests

2 participants