implementation of talk window

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: implementation of talk window

Post by Interkarma »

Just thinking out loud here...

The way this mechanism works in A0C00Y12 is that player is directed to house where npc is currently placed at that time of day. When player then subsequently enters house, the npc is removed and an enemy is spawned for the player to fight.

To learn about where the thief is, the player must speak with informant. The mechanism for when dialog is revealed appears to be the difference between "dialog link" and "add dialog".

"dialog link" just reserves connection to a resource. Then "add dialog" determines when that dialog should be visible/active in talk system.

Provided you don't allow the dialog to show until "add dialog" is called (which happens after you talk to the informant), everything should run in the correct order.

If you're able to ask "where is > thief" too early in quest, possibly the problem is that dialog is available before "add dialog" is executed by speaking to informant.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: implementation of talk window

Post by Interkarma »

Update: Yep, that's the problem alright. The "where is > person" dialog option is being made available before "add dialog" has been called.

The dialog shouldn't become active until S.05 has been triggered by clicking npc _informant_ in S.05. This then activates the dialog with "add dialog". It actually has nothing to do with "hide npc". :)

Code: Select all

_S.05_ task:
	clicked npc _informant_ say 1025 
	add dialog for person _thief_  // only at this point should any "dialog link" for _thief_ become active
	log 1035 step 1 
Attachments
dialog-added.jpg
dialog-added.jpg (118.33 KiB) Viewed 2349 times

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: implementation of talk window

Post by Interkarma »

I'm stepping through the code and I can see that "dialog link for location _store_ person _thief_" is correctly setting questResource.availableForDialog=false when run.

But that _thief_ dialog option is definitely being presented before "add dialog" is called to set questResource.availableForDialog=true again. I can set a breakpoint in AddDialog action and it's never called but the dialog is actually available.

Something seems to be triggering dialog available check a bit early.

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: implementation of talk window

Post by Nystul »

thanks for the report - will take a look if there is a regression bug from my code-rewrite

anyway regarding this quest:

Code: Select all

_S.05_ task:
	clicked npc _informant_ say 1025 
	add dialog for person _thief_ 
	log 1035 step 1
the thief gets added as dialog option as soon as informant is clicked - but only hidden when pc enters house - this seems odd - I need to test this quest in vanilla df again. maybe it works different then I remembered - because now we know there are these 2 quests which are similar but different - so maybe I only tested the other quest

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: implementation of talk window

Post by Interkarma »

I also noticed that "place npc" doesn't seem to be adding the informant properly to local tavern on start. Have you encountered this one as well?

Update: The above happens if player exits and re-enters local tavern. The quest resource is not added a second time. This is a recent mistake from myself that I recently introduced. Will fix this now.

That's nothing to do with the talk stuff of course, it's just something else I found on the journey. :)

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: implementation of talk window

Post by Interkarma »

Nystul wrote: Wed May 16, 2018 8:21 am I thought boolean field "IsPlaced" in person resource is used for this - sry my misunderstanding then
Just to clarify this one as well. The IsPlaced is part of scene layout logic, it wasn't really intended to check whether "place <thing>" was called or not.

I've also discovered this is breaking re-injection when player exits and re-enters a building an npc is placed inside of. I'll see if I can rework this, but I might have to revert this change.

Sorry to side-track things, just wanted to make sure IsPlaced isn't used.

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: implementation of talk window

Post by Nystul »

update from my side as well:
this quest is indeed behaving the same in vanilla df, the thief is also available for dialog in "where is" section as soon as informant is clicked
it is also bugged for several other reasons in vanilla. book name is generated as empty string resulting in funny bugs in the talk window.

I consider the quest A0C00Y12 weird in regard of "thief" resource - adding both "tell me about" and "where is" entries for "thief" is unlogical.

quest N0C00Y10 is the same quest like it should look and it works.

A0C00Y12 could be fixed by moving the "hide npc" command to tasks _S.02_ ,_S.03_ and _S.04_
should we try to fix this by fixing the quest code?

update: won't use IsPlaced - promised ;)

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: implementation of talk window

Post by Interkarma »

Interesting! Yeah, give that a go.

Honestly, so many of the classic quests have weird little logic flaws. It's sometimes hard to tell if we're chasing problems on our end or just with the script itself.

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: implementation of talk window

Post by Nystul »

:lol:

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: implementation of talk window

Post by Nystul »

yes, moving the hide npc command solves my problems ;)
nice :D

Post Reply