gemrb / gemrb

GemRB is a portable open-source implementation of Bioware’s Infinity Engine.
https://gemrb.org
GNU General Public License v2.0
965 stars 181 forks source link

[bug] Dialogue issue with NPC's PID #259

Open caillean7 opened 4 years ago

caillean7 commented 4 years ago

Description Split from #246, original post & additional info:

If an NPC has Player Initiated Dialogue, it might happen that dialogues do trigger, but then you get to see only the PID, and not the right lines. I've seen this happen at least with Weimer's Solaufein and Valygar in a quest from the Corthala Romantique mod. You mentioned all this dialogue stuff calls on a common function, so it's probably related to #236. Here the details from the Valygar case:

Valygar is supposed to initiate dialogue with Player1, script- and condition-wise all is fine. From Valygar.bcs:

IF
    Global("H#LeoQuest","GLOBAL",8)
    !See("H#LEON")  // Leonora - Leonora De Vallenzzi
THEN
    RESPONSE #100
        Dialog(Player1)
END

Using StartDialogueNoSet instead of Dialog since it's more commonly used in scripts doesn't change anything btw.

Then what's supposed to happen from ValygarJ.dlg:

IF ~Global("H#LeoQuest","GLOBAL",8)~ THEN BEGIN WhatIsIt
SAY @81
++ @82 + TheQuest9
++ @83 + TheQuest1
...

Instead what shows up is the PID:

IF
~IsGabber(Player1)
Global("H#NoFlirt","GLOBAL",0)
CombatCounter(0)
OR(2)
...

Ending the talk will cause him to re-initiate it over and over again, you get caught in a loop and the quest can't be finished. I recently played through it in EE to confirm it's not the mod. Also, removing the PID part from his dialogue script does the trick, while moving it to the bottom of the script didn't.

GemRB version 0.85

To Reproduce

Pastebinned game files PID from ValygarJ.dlg Quest related stuff from ValygarJ.dlg Script stuff

Already ruled out the sequence in the dlg file: I already checked the order of this stuff in the dlg file. If the script is parsed from top to bottom the first thing that matches conditions should trigger - that's what I thought. So I cut & pasted the PID block to the bottom of the script, but it made no difference. Only removing it completely made the dialogue work correctly.

Also tested https://github.com/gemrb/gemrb/blob/3e0aedb88549adbc2beb30428fadfdedce58cd1a/gemrb/core/GameScript/Triggers.cpp#L316

If you negate the IsGabber check or change the code to check for IsTarget instead of IsSpeaker, you should get farther.

He's correct of course ;)

caillean7 commented 4 years ago

Retested too, https://github.com/gemrb/gemrb/commit/0884151919481eb0ad67ed79107f9ea67187429b had no effect on this one.

lynxlynxlynx commented 4 years ago

do I need to install also the third component? Does this change the same Valygar? I just created valyg14 and force-joined him, but setting the var and sleeping for two days didn't start anything.

caillean7 commented 4 years ago

Yep, that's the one, "Leonora - A Guard for the Sphere". One day after Lavok's death Valygar should talk to you about the sphere needing a guardian, and suggest you travel to the Umar Hills to meet Leonara in his cabin there. Click through the first portion of the dialogue, until Leonora disappears so you can talk to Valygar alone. At this point, the first problem happens, as described above.

When I removed the PID block from Valygar's script, I immediately ran into the next issue, where Valygar is supposed to talk to Leonora, but this dialogue won't show up (perhaps it's something like the thing with Mazzy), and he will approach and try talking to her over and over again. Perhaps, while you're at it, we could take a look at this one as well?

lynxlynxlynx commented 4 years ago

I still can't reproduce this, so not much I can do yet.

caillean7 commented 4 years ago

Is the quest not starting or does the whole thing work for you?

lynxlynxlynx commented 4 years ago

Nothing happens at all. Force-talking to Valygar never triggers a PID either. Is he supposed to have a menu?

caillean7 commented 4 years ago

Yes, he has a PID with 3 options, 2 of which are also available if you don't romance him, so this should definitely show up when you talk to him. Works for me with latest code. Dunno - could such things happen due to the consoling?

lynxlynxlynx commented 4 years ago

Yes, I probably just don't have full reproduction steps.

caillean7 commented 4 years ago

Maybe the force joining - you did Ctrl + something on him? Perhaps recruit him the usual way? Here's the relevant script part:

IF
    Global("H#LeoQuest","GLOBAL",0)
    Global("LavokDead","GLOBAL",1)
    GlobalLT("Chapter","GLOBAL",%bg2_chapter_7%)

THEN
    RESPONSE #100
        SetGlobal("H#LeoQuest","GLOBAL",1)
        SetGlobalTimer("H#LeoQuestTimer","GLOBAL",ONE_DAY)
END

//Valygar suggests Leonora as guardian to the sphere
/* activation */
IF
    InParty(Myself)
    !StateCheck(Myself,CD_STATE_NOTVALID)
    See(Player1)
    !StateCheck(Player1,CD_STATE_NOTVALID)
    CombatCounter(0)
    !See([ENEMY])
    GlobalLT("Chapter","GLOBAL",%bg2_chapter_7%)
    GlobalTimerExpired("H#LeoQuestTimer","GLOBAL")
    Global("H#LeoQuest","GLOBAL",1)    
THEN
    RESPONSE #100
        SetGlobal("H#LeoQuest","GLOBAL",2)
END

Lavok has to be dead and the Chapter has to be below 7.

lynxlynxlynx commented 4 years ago

Yes, you stated that in the original steps already.