-
Notifications
You must be signed in to change notification settings - Fork 86
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
Fix non-closing gates in Gothic 1 #629
Conversation
There is a reason to implement it like that, for G2: // PERC_MOVEMOB handler
func void B_MoveMob()
{
var string door;
door = Npc_GetDetectedMob(self);
if(Hlp_StrCmp(door,"DOOR"))
{
if(Wld_GetMobState(self,door) == 0)
{
Npc_ClearAIQueue(self);
AI_UseMob(self,door,1);
AI_UseMob(self,door,-1);
};
}
else
{
return;
};
AI_ContinueRoutine(self);
}; This script has only one use-case, that I'm aware of: when Gorn leaves the jail he can open the door by himself |
1b09ea9
to
ebce84d
Compare
Ah didn't see that script but Gorn opening the gate works. I changed the search method to be like For G1 gate guards this search is needed but I could a add a previous check for Closing gates now don't allow npcs like Milten to leave old camp which is another problem caused by #585 |
game/game/gamescript.cpp
Outdated
@@ -1652,8 +1652,8 @@ int GameScript::wld_getmobstate(std::shared_ptr<zenkit::INpc> npcRef, std::strin | |||
return -1; | |||
} | |||
|
|||
auto mob = npc->detectedMob(); | |||
if(mob==nullptr || mob->schemeName()!=scheme) { | |||
auto mob = world().findMob(*npc,scheme); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this line be a part of detectedMob
?
Idea behind detectedMob
is to return:
- actively used modsi
- mobsi that cause collision event
- [new] closemost with valid scheme
Ok
Hmm question is what happens if scheme name doesn't match collision mob. If the npc is interacting with a mob the mob's state is returned even if scheme is different but this seems illogical. Gorn opening the door isn't working in vanilla so couldn't test what a scheme mismatch would do there.
Script comments indicate |
Agreed, lets keep as-is, and revisit if something breaks in future. Merged, thanks! |
At start of chapter 4 gate guards change daily routine to
TA_GuardWheelClosed
. Then in functionZS_GuardWheelClosed()
the state of the next mob with matching scheme name is checked.Wld_GetMobState
internally checks only for mobs the npc has collided with while moving which makes the check fail. This is replaced byWorld::findInteractive
, a search for all mobsis in close range. The default range has been increased slightly, otherwise only one gate could be opened.Script comment for
Wld_GetMobState
says it's looking for the next mob that matches the scheme name. This would be in line with the change.Script also has a command to close the inner gate but this fails in vanilla. In OG with this PR it fails because the mob can't be found. A Problem could be that the responsible npc
GRD_280_Gardist
has wrongid=230
butGRD_230_Gardist
is the npc closing the main gate.For testing you can use
insert sh
and use the first chapter 4 option.Fixes #628