Harlok ignores player at first even when being defeated before
Describe the bug Even if the player defeated Harlok before, he has to finish Harlok's "ignore" dialog and speak to him again to get him to the weed masher.
Expected behavior Harlok no longer ignores the player character when he was defeated by him before.
Additional context Bug provided by Blubbler.
If Harlok was defeated before, this dialog option:
https://github.com/AmProsius/gothic-1-community-patch/blob/3df3d13f2264425fa787cedcb833551c2f3c665e/scriptbase/_work/Data/Scripts/Content/Story/Missions/DIA_NOV_1358_Harlok.d#L64-L70
should lead to
https://github.com/AmProsius/gothic-1-community-patch/blob/3df3d13f2264425fa787cedcb833551c2f3c665e/scriptbase/_work/Data/Scripts/Content/Story/Missions/DIA_NOV_1358_Harlok.d#L132-L149
like this:
AI_Output (other, self,"DIA_Harlok_FetchHarlok_OrElse_15_00"); //Get your ass to the weed mashers or you'll be for it.
if (self.aivar[AIV_WASDEFEATEDBYSC] == TRUE)
{
AI_Output (self, other,"DIA_Harlok_SendHarlok_01_01"); //You damn pain in the butt! Why do you have to meddle in my affairs?
AI_Output (other, self,"DIA_Harlok_SendHarlok_15_02"); //I just want to see you mashing.
AI_Output (self, other,"DIA_Harlok_SendHarlok_01_03"); //Okay, okay - I'm on my way... sucker!
[...]
} else {
AI_Output (self, other,"DIA_Harlok_FetchHarlok_OrElse_01_01"); //Just TRY to mess with me again, sucker!
AI_StopProcessInfos(self);
}
Additionally, the condition of the latter dialog should be extended:
https://github.com/AmProsius/gothic-1-community-patch/blob/3df3d13f2264425fa787cedcb833551c2f3c665e/scriptbase/_work/Data/Scripts/Content/Story/Missions/DIA_NOV_1358_Harlok.d#L124-L130
changed to
FUNC int DIA_Harlok_SendHarlok_Condition()
{
if ( (self.aivar[AIV_WASDEFEATEDBYSC] == TRUE)
&& Npc_KnowsInfo(hero, DIA_Harlok_FetchHarlok)
&& (Ghorim_KickHarlok == LOG_RUNNING) )
{
return 1;
};
};
I would suggest this instead (less intrusive and more compatible with possible changes): https://github.com/AmProsius/gothic-1-community-patch/blob/3df3d13f2264425fa787cedcb833551c2f3c665e/scriptbase/_work/Data/Scripts/Content/Story/Missions/DIA_NOV_1358_Harlok.d#L48-L56 changed to
FUNC VOID DIA_Harlok_FetchHarlok_Info()
{
AI_Output (other, self,"DIA_Harlok_FetchHarlok_15_00"); //Ghorim sent me.
AI_Output (self, other,"DIA_Harlok_FetchHarlok_01_01"); //What?
Info_ClearChoices (DIA_Harlok_FetchHarlok);
if (self.aivar[AIV_WASDEFEATEDBYSC]) {
Info_Addchoice (DIA_Harlok_FetchHarlok,DIALOG_BACK ,DIA_Harlok_FetchHarlok_BACK);
Info_Addchoice (DIA_Harlok_FetchHarlok,"Get your arse to the weed mashers or you'll be for it. ",DIA_Harlok_FetchHarlok_OrElse);
Info_Addchoice (DIA_Harlok_FetchHarlok,"I'm here to remind you that you're to take over from him.",DIA_Harlok_FetchHarlok_Please);
};
};
This would result in the dialog:
Dialog options
A) Ghorim sent me. B) END
A) "Ghorim sent me." "What?"
Dialog options
A) Well, d'you feel like giving your pal a break now? B) END
A) "Well, d'you feel like giving your pal a break now?" "You damn pain in the butt! Why do you have to meddle in my affairs?" ...
In order to implement this, the function DIA_Harlok_FetchHarlok_Info would have to be analyzed to have exactly those three added choices. If that is confirmed, hook after the function DIA_Harlok_FetchHarlok_Info likes so
/*
* Hook after the dialog function
*/
func void G1CP_210_HarlokDefeatedDialog_Hook() {
G1CP_ReportFuncToSpy();
// Call the original function first
ContinueCall();
// If the NPC was defeated before, remove the added choices to return to the root dialog menu
if (G1CP_NpcGetAiVar(self, "AIV_WASDEFEATEDBYSC", FALSE)) {
Info_ClearChoices(MEM_GetSymbolIndex("DIA_Harlok_FetchHarlok"));
};
};