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

Does item pickup have a victim (picking up items marked as theft) #717

Open
mmind opened this issue Jan 15, 2025 · 2 comments
Open

Does item pickup have a victim (picking up items marked as theft) #717

mmind opened this issue Jan 15, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@mmind
Copy link
Contributor

mmind commented Jan 15, 2025

In Gothic 1 every time I pick up an item from the ground (i.e. a berry at the startpoint) while a Npc looks, he'll shout "Behind you!".

Tracking that down to b_assesstheft(), I can see:

    ai_quicklook(self, other);
    if (npc_canseenpc(self, other)) {
        printdebugnpc(pd_zs_check, "...NSC kann den Dieb sehen!");
        if (hlp_isvaliditem(item) && (!hlp_isvalidnpc(victim))) {
            printdebugnpc(pd_zs_check, "...Item wurde aufgehoben!"); // Item picked up
    ...
        }
        else {
            printdebugnpc(pd_zs_check, "...Taschendiebstahl!"); //pickpocket
            if (...) {
    ...
                ai_pointatnpc(self, other);
                b_say(self, other, "$BEHINDYOU");

So the condition (hlp_isvaliditem(item) && (!hlp_isvalidnpc(victim)) should be true to indicated something picked up, but isn't, leading to the pickpocket branch.

I'm not yet sure what part is wrong though.

@mmind mmind added the bug Something isn't working label Jan 15, 2025
@mmind
Copy link
Contributor Author

mmind commented Jan 15, 2025

Interestingly Gothic 2 does if (hlp_isvalidnpc(other) && npc_isplayer(other)) and Gothic 1 also does similar things, like if ((hlp_isvalidnpc(other) && (!c_npcisdown(other))) && (!npc_isplayer(other)) , so the player is a valid Npc in both games in other places.

But I guess the player being the "victim" when picking up an item might be strange?

@mmind
Copy link
Contributor Author

mmind commented Jan 15, 2025

I guess the culprit might be living in Npc::takeItem, which does
owner.sendPassivePerc(*this,*this,*this,*it,PERC_ASSESSTHEFT);
marking the player as the victim of the theft. I guess victim might need to be optional?

@mmind mmind changed the title Behaviour difference hlp_isvaliditem() or hlp_isvalidnpc() Does theft have a victim Jan 15, 2025
@mmind mmind changed the title Does theft have a victim Does item pickup have a victim (picking up items marked as theft) Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant