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 wake up immediately #1

Closed
AmProsius opened this issue Dec 30, 2020 · 2 comments · Fixed by #67
Closed

NPCs wake up immediately #1

AmProsius opened this issue Dec 30, 2020 · 2 comments · Fixed by #67
Labels
impl: replace func call This issue requires replacing function calls in the scripts. 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: validated This issue is still present even with Systempack/Union.
Milestone

Comments

@AmProsius
Copy link
Owner

AmProsius commented Dec 30, 2020

Describe the bug
NPCs wake up immediately after going to bed.

Expected behavior
NPCs no longer wake up immediately after going to bed, but remain sleeping.

@catalinstoian
Copy link

catalinstoian commented Jan 9, 2021

func int ZS_SleepBed_Loop()
{
PrintDebugNpc (PD_TA_LOOP,"ZS_SleepBed_Loop");
// SN: Workaround dafür, daß Wld_IsMobAvailable() zwar TRUE geliefert hat, AI_UseMob() aber gescheitert ist!
if !C_BodyStateContains(self,BS_MOBINTERACT)
&& (Npc_GetStateTime(self) > 3)
{
AI_StartState (self, ZS_SitAround, 1, "");
};
AI_Wait (self, 1);
return LOOP_CONTINUE;
};

changed to

func int ZS_SleepBed_Loop()
{
    PrintDebugNpc       (PD_TA_LOOP,"ZS_SleepBed_Loop");


    // SN: Workaround dafür, daß Wld_IsMobAvailable() zwar TRUE geliefert hat, AI_UseMob() aber gescheitert ist!
    if  (!Npc_GetBodyState(self) == BS_MOBINTERACT || !Npc_GetBodyState(self) == BS_MOBINTERACT_INTERRUPT)
    &&  (Npc_GetStateTime(self) > 3)
    {
        AI_StartState   (self, ZS_SitAround, 1, "");
    };


    AI_Wait             (self, 1);
    return              LOOP_CONTINUE;
};

@szapp
Copy link
Collaborator

szapp commented Jan 16, 2021

@catalinstoian Are you sure this works as expected? A check against Npc_GetBodyState rarely renders true, because the body state is a bitfield, a combination of multiple active body states. That's why there is the function C_BodyStateContains. Is there a particular reason why you used Npc_GetBodyState?

szapp added a commit that referenced this issue Jan 16, 2021
@AmProsius AmProsius added type: session fix The fix for this issues is persistent across a session. and removed validation required labels Jan 16, 2021
@AmProsius AmProsius linked a pull request Jan 17, 2021 that will close this issue
@AmProsius AmProsius moved this from To Do to In Progress in v1.0.0 Jan 17, 2021
@szapp szapp closed this as completed in #67 Jan 18, 2021
v1.0.0 automation moved this from In Progress to Done Jan 18, 2021
@AmProsius AmProsius added this to the v1.0.0 milestone Feb 13, 2021
@AmProsius AmProsius added provided fix This issue has a fix provided in the comments. validation: validated This issue is still present even with Systempack/Union. labels Mar 13, 2021
szapp added a commit that referenced this issue Mar 13, 2021
No longer the external is hooked but its call intercepted
@szapp szapp added this to Replace function calls in Fix templates Mar 15, 2021
@szapp szapp added the impl: replace func call This issue requires replacing function calls in the scripts. label Mar 16, 2021
@szapp szapp moved this from Replace function calls to NPC state in Fix templates Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impl: replace func call This issue requires replacing function calls in the scripts. 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: validated This issue is still present even with Systempack/Union.
Projects
Fix templates
Modify NPC state
v1.0.0
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants