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 guarding gate switches don't reset the switch during their state loop #195
Comments
That bug was already fixed by Gothic Mod FIx RU , the ZS routine code is below which may be useful , however there are defined funcions which are not present in vanilla scripts. gothic-1-community-patch/scriptbase/_work/Data/Scripts/Content/Story/ZS/ZS_GuardWheelOpen.d Lines 6 to 47 in 9f4b6ca
changed to func void ZS_GuardWheelOpen()
{
b_checkpc(self);//new func
GuardPerception();
Npc_PercDisable(self,PERC_OBSERVEINTRUDER);
Npc_PercDisable(self,PERC_MOVENPC);
AI_Standup(self);
AI_StopLookAt(self);
AI_RemoveWeapon(self);
self.aivar[AIV_ITEMSTATUS] = FALSE;
self.aivar[AIV_FOUNDPERSON] = FALSE;
self.aivar[32] = NOTINPOS;
};
func int ZS_GuardWheelOpen_Loop()
{
if(self.aivar[32] == ISINPOS)
{
if(guardcheckgatestate(self) == 1)//new cond
{
AI_Wait(self,1);
self.aivar[32] = NOTINPOS;
return LOOP_CONTINUE;
};
if(!self.aivar[AIV_FOUNDPERSON])
{
if(Npc_GetDistToNpc(self,hero) < 500)
{
if(Npc_CanSeeNpc(self,hero) || ((Npc_GetDistToNpc(self,hero) < 200) && !C_BodyStateContains(hero,BS_SNEAK)))
{
B_SmartTurnToNpc(self,hero);
self.aivar[AIV_FOUNDPERSON] = TRUE;
return LOOP_CONTINUE;
};
};
if(Npc_GetStateTime(self) > self.aivar[21])
{
if(self.aivar[AIV_ITEMFREQ] == 1)
{
AI_PlayAni(self,"R_SCRATCHLSHOULDER");
}
else if(self.aivar[AIV_ITEMFREQ] == 3)
{
AI_PlayAni(self,"R_SCRATCHEGG");
}
else if(self.aivar[AIV_ITEMFREQ] == 5)
{
AI_PlayAni(self,"R_LEGSHAKE");
}
else if(self.aivar[AIV_ITEMFREQ] == 7)
{
AI_PlayAni(self,"R_SCRATCHHEAD");
}
else if(self.aivar[AIV_ITEMFREQ] == 9)
{
AI_PlayAni(self,"R_SCRATCHRSHOULDER");
};
self.aivar[AIV_ITEMFREQ] = Hlp_Random(100) % 10;
self.aivar[21] = (Hlp_Random(100) % 5) + 5;
Npc_SetStateTime(self,0);
};
AI_Wait(self,1);
return LOOP_CONTINUE;
};
if(Npc_GetDistToNpc(self,hero) > 600)
{
self.aivar[AIV_FOUNDPERSON] = FALSE;
self.aivar[32] = NOTINPOS;
return LOOP_CONTINUE;
};
B_SmartTurnToNpc(self,hero);
AI_Wait(self,1);
return LOOP_CONTINUE;
};
if(Npc_GetDistToWP(self,self.wp) > 300)
{
AI_StopLookAt(self);
AI_SetWalkMode(self,NPC_WALK);
AI_GotoWP(self,self.wp);
return LOOP_CONTINUE;
};
if(guardcheckgatestate(self) == 1)
{
AI_StopLookAt(self);
AI_SetWalkMode(self,NPC_WALK);
if(Wld_IsMobAvailable(self,"VWHEEL"))
{
if(Wld_GetMobState(self,"VWHEEL") == 0)
{
AI_UseMob(self,"VWHEEL",1);
};
AI_Wait(self,0.5);
AI_UseMob(self,"VWHEEL",0);
AI_UseMob(self,"VWHEEL",-1);
}
else if(Wld_IsMobAvailable(self,"LEVER"))
{
if(Wld_GetMobState(self,"LEVER") == 0)
{
AI_UseMob(self,"LEVER",1);
};
AI_Wait(self,0.5);
AI_UseMob(self,"LEVER",0);
AI_UseMob(self,"LEVER",-1);
};
AI_GotoWP(self,self.wp);
};
AI_StopLookAt(self);
if(Npc_IsOnFP(self,"VWHEEL"))
{
AI_SetWalkMode(self,NPC_WALK);
AI_GotoFP(self,"VWHEEL");
AI_AlignToFP(self);
}
else if(Wld_IsFPAvailable(self,"VWHEEL"))
{
AI_SetWalkMode(self,NPC_WALK);
AI_GotoFP(self,"VWHEEL");
AI_AlignToFP(self);
}
else
{
AI_AlignToWP(self);
};
self.aivar[32] = ISINPOS;
self.aivar[AIV_ITEMFREQ] = Hlp_Random(100) % 10;
self.aivar[21] = (Hlp_Random(100) % 5) + 5;
Npc_SetStateTime(self,0);
return LOOP_CONTINUE;
};
func void ZS_GuardWheelOpen_End()
{
AI_StopLookAt(self);
self.aivar[32] = 0;
self.aivar[AIV_FOUNDPERSON] = 0;
self.aivar[21] = 0;
self.aivar[AIV_ITEMSTATUS] = 0;
self.aivar[AIV_ITEMFREQ] = 0;
}; |
Я дополню пост оригинальными (недекомпилированными функциями). Из Gothic Mod Fix
|
The essential gist of it is this: gothic-1-community-patch/scriptbase/_work/Data/Scripts/Content/Story/ZS/ZS_GuardWheelOpen.d Lines 25 to 42 in 9f4b6ca
changed to func int ZS_GuardWheelOpen_Loop()
{
if (Wld_GetMobState (self, "VWHEEL") == 1) {
AI_UseMob (self, "VWHEEL", 0);
AI_UseMob (self, "VWHEEL", -1);
AI_AlignToWP (self);
};
PrintDebugNpc (PD_TA_LOOP,"ZS_GuardWheelOpen_Loop");
if (Npc_GetDistToWP(self,self.wp)>200)
{
AI_SetWalkmode (self,NPC_RUN);
AI_GotoWP (self, self.wp);
return LOOP_CONTINUE;
}
else if (Npc_GetDistToNpc(self,hero) > HAI_DIST_GUARDPASSAGE_ATTENTION)
{
AI_AlignToWP (self);
};
AI_Wait (self,1);
return LOOP_CONTINUE;
}; The same will have to be done for the daily routine to guard a closed switch: gothic-1-community-patch/scriptbase/_work/Data/Scripts/Content/Story/ZS/ZS_GuardWheelClosed.d Lines 26 to 43 in 9f4b6ca
changed to func int ZS_GuardWheelClosed_Loop()
{
if (Wld_GetMobState (self, "VWHEEL") == 0) {
AI_UseMob (self, "VWHEEL", 1);
AI_UseMob (self, "VWHEEL", -1);
AI_AlignToWP (self);
};
PrintDebugNpc (PD_TA_LOOP,"ZS_GuardWheelClosed_Loop");
if (Npc_GetDistToWP(self,self.wp)>200)
{
AI_SetWalkmode (self,NPC_RUN);
AI_GotoWP (self, self.wp);
return LOOP_CONTINUE;
}
else if (Npc_GetDistToNpc(self,hero) > HAI_DIST_GUARDPASSAGE_ATTENTION)
{
AI_AlignToWP (self);
};
AI_Wait (self,1);
return LOOP_CONTINUE;
}; This can be realized by hooking before the function This fix will probably require a manual test (just teleport to a gate that is guarded closed and then to one that is guarded open). An important part is to test this fix with mods that have already addressed that issue! |
What's with |
It seems there is no such AI state for levers, only for winches. All the scripts posted before go much beyond the actual fix. |
As far as I know there is only one mod adressed to this issue : "Gothic Mod Fix" and it is only one mod I would not play together with G1CP. Is possible that G1CP will not run with GMF automatically ? (settings in INI could be changed). |
Why wouldn’t you play the Gothic Mod Fix with the G1CP? |
GMF has fixed stucked gates already. Playing together with G1CP this bug occurs again. I have tested it. I would exclude this one fix for GMF (if it possible to exclude some fixes for some mods/patches). |
As in medicine, it may be wiser to treat the cause instead of the symptoms ;) What I am saying is, it would be better to find out why there might be a conflict, and make it compatible in the G1CP. Disabling fixes in conjunction with certain mods/patches seems like a cheap, unsatisfying (and never ending) way. I haven’t looked at this specific issue here, but from the top of my head I don’t recall where the G1CP does something about stuck gates. How do you come to the conclusion that the G1CP undoes the fix? Did you test this systematically? PS: It seems like this potential bug report is not at all related to this here issue ticket. It should be discussed in the correct ticket #193 instead. |
Describe the bug
A clear and concise description of what the bug is.
NPC don't use gateswitches after fight !
Expected behavior
A clear and concise description of what you expected to happen.
Steps to reproduce the issue
Additional context
The bug can be easily reproduce at OC gates.
The text was updated successfully, but these errors were encountered: