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

Gorn attacks the player in the Free Mine #32

Merged
merged 3 commits into from Mar 5, 2021
Merged

Gorn attacks the player in the Free Mine #32

merged 3 commits into from Mar 5, 2021

Conversation

szapp
Copy link
Collaborator

@szapp szapp commented Mar 5, 2021

Describe the bug
Gorn sometimes attacks the player on the raid of the Free Mine.

Expected behavior
Gorn no longer attacks the player on the raid of the Free Mine.

Test
Run manual test with test 32.

  • Gorn no longer scolds the player for killing NPCs of the Old Camp when talking to him.
    Triggered by killing a guard when out of sight of Gorn.
  • Gorn no longer warns the player of attacking him again when talking to him.
    Triggered by defeating guards of the Old Camp.
  • Gorn no longer attacks the player.
    Triggered by Gorn seeing a guard of the Old Camp attacking the PC first.

@AmProsius AmProsius added this to To Do in v1.0.0 via automation Jan 4, 2021
@AmProsius AmProsius added the validation: required This issue needs validation from one of the validators. label Jan 28, 2021
@AmProsius AmProsius removed this from To Do in v1.0.0 Feb 9, 2021
@catalinstoian

This comment has been minimized.

@AmProsius AmProsius added the provided fix This issue has a fix provided in the comments. label Feb 13, 2021
@AmProsius AmProsius added this to To Do in v1.0.0 Feb 13, 2021
@AmProsius AmProsius added this to the v1.0.0 milestone Feb 13, 2021
@szapp
Copy link
Collaborator

szapp commented Feb 13, 2021

I'd like to find out what exactly is the origin of the problem. I had a look at the scripts and theoretically Gorn should not attack, because he is both of NPC-type "friend" and (most of the time) even a party member. According to the damage assessment functions it looks like, that should be enough to tolerate damage from enemies.

It's nice that we now have a better angle, looking like the attitude may play a role. Given @catalinstoian remarks that this approach might not be so robust, we might find a way to permanently set Gorn's attitude (without it resetting) or get to the root of the actual problem in the scripts.

@szapp szapp added the compatibility: difficult This issue is difficult to make compatible. label Feb 13, 2021
@AmProsius AmProsius removed this from To Do in v1.0.0 Feb 22, 2021
@AmProsius AmProsius removed this from the v1.0.0 milestone Feb 22, 2021
@AmProsius AmProsius added validation: validated This issue is still present even with Systempack/Union. and removed validation: required This issue needs validation from one of the validators. labels Feb 22, 2021
@AmProsius AmProsius added this to the v1.0.0 milestone Feb 24, 2021
@AmProsius AmProsius added this to To Do in v1.0.0 via automation Feb 24, 2021
@szapp
Copy link
Collaborator

szapp commented Mar 4, 2021

Gorn's line "A member of the Old Camp is dead, and your name was mentioned in connection with his death ..." is triggered from the function B_ReactToMemory. The news system seems quite wide spread throughout the scripts. Gorn could have either witnessed the murder or it was conveyed by what the scripts refer to as "gossip" (possibly from the guards of the old camp). The news about a murder seem to be exclusively set in B_AssessAndMemorize which is called from a number of other functions.

I can disable his message successfully by deleting his news. It indeed turns out to be unrelated to his hostility. But it seems to be triggered through a similar event. It seems like Gorn is witnessing himself defeating a guard.

@szapp szapp removed the provided fix This issue has a fix provided in the comments. label Mar 4, 2021
@AmProsius
Copy link
Owner Author

Is there anything I can do (ingame) to narrow the issue down?

@szapp
Copy link
Collaborator

szapp commented Mar 4, 2021

Not sure at the moment. I am currently trying to dissect the function calls to see what is the origin for Gorn's attitude.

@szapp szapp marked this pull request as draft March 5, 2021 00:05
@szapp
Copy link
Collaborator

szapp commented Mar 5, 2021

I pushed some preliminary checks made so far and also have a test here already (test 32 manual).

@szapp
Copy link
Collaborator

szapp commented Mar 5, 2021

I had looked at it last night a little bit and I identified the reason for Gorn attacking. This is the script debug output.

When Gorn is following the PC who is being attacked (by an NPC out of range for Gorn), Gorn's fight sound perception is triggered. In the function B_AssessFightSound, the function C_ChargeWasAttacked correctly determines that an NPC attacked an ally of Gorn (i.e. the PC). This correctly triggers the state ZS_ProclaimAndPunish for Gorn. However, that function falsely assumes that the offender is the PC. Instead of attacking other, the script has Gorn attack hero. That is exactly the inconsistency between other and hero we recently discussed. Actually, it seems fine. The problem is that B_AssessFightSound assumes ZS_ProclaimAndPunish to also work for NPC offenders.

It seems that ZS_ProclaimAndPunish is fully reserved for reactions towards the player. Starting the state ZS_ProclaimAndPunish in B_AssessFightSound should be replaced by starting the state ZS_Attack (if the player is the victim not the offender).

Skript: ### Gorn(5) ### -> B_AssessFightSound .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> C_NpcIsHuman .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...name: Me .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...true .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> C_NpcIsMonster .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...name: Guard .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...false .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> C_NpcIsHuman .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...name: Guard .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...true .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> C_NpcIsMonster .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...name: Me .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...false .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> C_ChargeWasAttacked .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> C_NpcIsGuardArcher .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...false! .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> C_NpcIsGuard .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...true! .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...NSC ist Wache oder FK-Wache! .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...true .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...NSC ist Wache und ein Schützling wurde attackiert! .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> PrintGlobals .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...self:   Gorn .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...other:  Guard .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...victim: Me .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...hero:   Me .... <zError.cpp,#462>
Skript: ### Gorn(5) ### -> ...und der ist auch sauer bzw. flieht! .... <zError.cpp,#462>

@szapp szapp marked this pull request as ready for review March 5, 2021 14:05
@szapp szapp moved this from To Do to In Progress in v1.0.0 Mar 5, 2021
@AmProsius
Copy link
Owner Author

ScreenShot_2021_3_5_20_34_2

@AmProsius AmProsius merged commit e1ba5fe into master Mar 5, 2021
v1.0.0 automation moved this from In Progress to Done Mar 5, 2021
@AmProsius AmProsius deleted the bug032 branch March 5, 2021 19:35
@szapp szapp added this to NPC function in Fix templates Mar 17, 2021
@szapp szapp added impl: hook script func This issue requires hooking script functions. impl: modify/analyze script func This issue requires analyzing and/or modifying the bytecode of script functions. labels Mar 17, 2021
AmProsius added a commit that referenced this pull request Apr 15, 2021
AmProsius added a commit that referenced this pull request May 9, 2021
@szapp szapp added the type: session fix The fix for this issues is persistent across a session. label Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility: difficult This issue is difficult to make compatible. impl: hook script func This issue requires hooking script functions. impl: modify/analyze script func This issue requires analyzing and/or modifying the bytecode of script functions. type: session fix The fix for this issues is persistent across a session. validation: validated This issue is still present even with Systempack/Union.
Projects
Fix templates
Modify NPC function
v1.0.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants