implementation of talk window

Discuss coding questions, pull requests, and implementation details.
User avatar
Jay_H
Posts: 3145
Joined: Tue Aug 25, 2015 1:54 am

Re: implementation of talk window

Post by Jay_H » Sun Jun 03, 2018 5:34 am

Just to get a preview (I won't be able to touch it until Monday), does this mean all quests will require the use of "create npc" and/or "place npc at" for all named NPCs?
Come join Lysandus' Tomb, a Daggerfall Unity fan Discord.
See the Daggerfall Unity Wiki on the UESP.

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

Re: implementation of talk window

Post by Interkarma » Sun Jun 03, 2018 5:58 am

Everything will work just like it does now. :)

The only difference is that "create npc" will become a supported action and automatically add the NPC to their home location as it should. Previously "create npc" was not implemented at all.

Just keep in mind it's not retroactive to quests already running in your saves as "create npc" did not exist at the time they were compiled. Even now, the CreateNpc action only logs the intention, it doesn't actually do anything. That will be my next step.

I've updated News with more information on what's happening. My main concern right now is that I haven't broken anything else.

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

Re: implementation of talk window

Post by Interkarma » Sun Jun 03, 2018 6:34 am

@Nystul - There's a new event you might be interested in: QuestMachine.OnQuestErrorTermination

This event is raised when a quest is terminated for runtime exceptions. You might be able to use this to clean up any stale data being held for quest in the talk system.

For anything that's pulled directly from quest system (i.e. not cached) you probably won't have to handle this event, as the quest is basically removed from QuestMachine the moment it fails. But cached information could be impacted as quest did not terminate in the usual manner.

This should help systems downstream from QuestMachine (e.g. talk and automap) more robustly handle cases where a quest crashes.

User avatar
Jay_H
Posts: 3145
Joined: Tue Aug 25, 2015 1:54 am

Re: implementation of talk window

Post by Jay_H » Sun Jun 03, 2018 6:42 am

Oh, excellent. Thanks for the clarification. I'll have to go over the last few classic quests to be sure, but that'll be a minor matter.
Come join Lysandus' Tomb, a Daggerfall Unity fan Discord.
See the Daggerfall Unity Wiki on the UESP.

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

Re: implementation of talk window

Post by Interkarma » Sun Jun 03, 2018 6:48 am

Thank you Jay. Just let me know if something breaks that used to work. Feel free to submit a bug report.

Once I've done "create npc" and happy nothing else is broken, then I'll be hitting those other classic quest problems in your list on Quest Hub. Most of those will be fixed just by improving how I handle "saying nnnn" for actions.

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

Re: implementation of talk window

Post by Interkarma » Sun Jun 03, 2018 7:54 am

"create npc" is now implemented and will assign Person to their home. For Local_3.x and Local_4.x Person definitions as found in A0C00Y16, they will be placed to a local building site. I believe this is the intended behaviour.

This is how it looks in the new quest output log:

Code: Select all

Parsing quest A0C00Y16
[A0C00Y16] Generated Home for Person _questgiver_ [Gondard Greencroft] at 'Daggerfall/Daggerfall' in building 'The Restless Djinn'
[A0C00Y16] Generated Home for Person _missingperson_ [Vyctolda Gaerham] at 'Daggerfall/Tunmoth' in building 'The Ashhart Residence'
[A0C00Y16] Generated Home for Person _friend1_ [Mordywyr Moorfield] at 'Daggerfall/Daggerfall' in building 'The Wickston Residence'
[A0C00Y16] Generated Home for Person _friend2_ [Andyn Ashston] at 'Daggerfall/Daggerfall' in building 'The Greensley Residence'
[A0C00Y16] Generated Home for Person _friend3_ [Bedyn Buckinghouse] at 'Daggerfall/Daggerfall' in building 'The Moorsmith Residence'
[A0C00Y16] Generated Home for Person _friend4_ [Gondard Kingsmith] at 'Daggerfall/Daggerfall' in building 'The Moorton Residence'
[A0C00Y16] Created Building SiteLink to The Moorton Residence in Daggerfall/Daggerfall
[A0C00Y16] CreateNpc automatically placed _friend4_ [Gondard Kingsmith] at 'Daggerfall/Daggerfall' in building 'The Moorton Residence'
[A0C00Y16] Created Building SiteLink to The Greensley Residence in Daggerfall/Daggerfall
[A0C00Y16] CreateNpc automatically placed _friend2_ [Andyn Ashston] at 'Daggerfall/Daggerfall' in building 'The Greensley Residence'
[A0C00Y16] Created Building SiteLink to The Moorsmith Residence in Daggerfall/Daggerfall
[A0C00Y16] CreateNpc automatically placed _friend3_ [Bedyn Buckinghouse] at 'Daggerfall/Daggerfall' in building 'The Moorsmith Residence'
[A0C00Y16] Created Building SiteLink to The Wickston Residence in Daggerfall/Daggerfall
[A0C00Y16] CreateNpc automatically placed _friend1_ [Mordywyr Moorfield] at 'Daggerfall/Daggerfall' in building 'The Wickston Residence'
What's happening above is all Person resources are generated at quest compile time and a Home Place is automatically chosen for each one. These are the "Generated Home..." messages. Note that even the questor gets a Place based on where the quest began, This actually comes in handy for the quest debugger as you can see where the quest started now.

The next thing that happens is when quest begins running and executes the startup task. The "create npc" action is called for 4x NPCs and they are all placed to their own home building. These are the "Created Building SiteLink..." and "CreateNpc automatically placed..." messages.

For some reason these buildings aren't showing in the quest debugger or the talk system yet. This is the next thing I'll chase down before issuing new builds with "create npc" active.

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

Re: implementation of talk window

Post by Interkarma » Sun Jun 03, 2018 8:23 am

Quest debugger now refreshes HUD Place markers when the number of SiteLinks changes mid-quest. Previously it would only do this when a quest started/ended or player left the area and came back again.

Now the automatic placements from "create npc" in A0C00Y16 are showing up.
debugger-fix.jpg
debugger-fix.jpg (116.04 KiB) Viewed 1049 times

And when you visit one of the buildings, the appropriate NPC is waiting for you.
create-npc-placed.jpg
create-npc-placed.jpg (107.95 KiB) Viewed 1049 times

Still not showing in talk UI though. I'll play with that next.

Edit: Having trouble with this. Might need some help from @Nystul now that "create npc" is actually placing these NPCs to their chosen homes. I'm not sure what I'm missing for talk manager to pick these up. Also tired, have been coding for about 12 hours straight and going crosseyed. :)

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

Re: implementation of talk window

Post by Nystul » Sun Jun 03, 2018 9:11 am

TalkManager line 2904 is the cause of the problem:

Code: Select all

Symbol assignedPlaceSymbol = person.GetAssignedPlaceSymbol();
returns null for all person resources except _missingperson_ (which is correctly hidden via dialog link command)
I would have expected to return placeSymbols for _friend1_, _friend2_, _friend3_ and _friend4_, but it does not.

I use the assigned place to determine if npc is in same location as pc:

Code: Select all

if (assignedPlaceSymbol != null)
{
	Quest quest = GameManager.Instance.QuestMachine.GetQuest(questID);
	Place assignedPlace = quest.GetPlace(assignedPlaceSymbol);  // Gets actual place resource
	if (assignedPlace.SiteDetails.mapId == GameManager.Instance.PlayerGPS.CurrentMapID)
		IsPlayerInSameLocationWorldCell = true;
}

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

Re: implementation of talk window

Post by Interkarma » Sun Jun 03, 2018 9:13 am

Thank you! I'll see why that isn't being set on my next session. Taking a break right now. If I can look at this before bed I will, otherwise will be in the morning when I'm fresh. Cheers. :)

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

Re: implementation of talk window

Post by Nystul » Sun Jun 03, 2018 9:25 am

at least I can test now a bit more with this quest. I think I might have to do a bug fix session for TalkManager as well before this quest will work correctly. It seems that not all dialog links might get correctly revealed when pc gets the answer messages from the npcs (_missingperson_ does, _friendX_ does not - this might be related to the assigned place thing but it could also be a oversight on my side - so if this quest still does not correctly work after fixing assigned place problem it is likely that I need to put some time into it)

another thing that might not be working like intended is that all buildings involved in the quest can be asked about in talk interface even before pc learned about them. This is less critical since vanilla does the same (in latest patch version, in unpatched it usually correctly hides them), but I consider this an issue that should be fixed in dfunity. ;) I will also tackle this when I will have time again (in a week))

Post Reply