implementation of talk window

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

Re: started implementation of talk window

Post by Interkarma » Sat Nov 18, 2017 12:32 am

It's possible to ID the specific NPC who granted quest, which is used as part of hand-in process. This is done like so:

Code: Select all

QuestMachine.Instance.IsNPCDataEqual(person.QuestorData, lastNPCClicked.Data)
Where first variable is the quest person you want to check second variable is LastNPCClicked data from QuestMachine. Check code of QuestMachine.IsNPCDataEqual() to see how the StaticNPC data and Quest Person data are matched. It's matched using a position hash, local mapID, nameSeed, and buildingKey. A match on all these values should guarantee you're talking to any specific StaticNPC.

There's more I probably need to do around this for your needs. The Questor setup is very loose at the moment, it's something I was going to delve into more when conversations started in 0.5 - something you're pulling together much faster than expected. Due to how rough things are on my end, I don't expect good results in its current state. :)

If you go ahead with those dialogs, please let me know how you go and what troubles you run into. I'll do what I can to help when possible.

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

Re: started implementation of talk window

Post by Nystul » Mon Nov 20, 2017 2:54 pm

ok thanks! will take a look ;)

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

Re: started implementation of talk window

Post by Nystul » Tue Nov 21, 2017 9:16 am

hi interkarma,
got a question because things are not working as expected...

i did a fighters guild quest (M0B00Y15) but any non-story quest seems to behave the same
I successfully slained the mobs and the questor is thanking me for fullfilling the quest. But the questComplete flag still stays at value "false" - only questSuccess flag is "true".
What is the questComplete flag used for then?
Because how to check if quest failed then? questSuccess will be "false" until quest is finished, so will be questComplete.

What I would have expected:
quest running and not complete: questComplete = false, questSuccess = false
quest finished but failed: questComplete = true, questSuccess = false
quest finished and success: questComplete = true, questSuccess = true

can you please also shed some light on how quest completion/ending/tombstoning is intended to work?
not sure if everything is working as intended (I think I spotted some differences for story vs non-story quests some time ago)
especially I think you already planned the system for letting a quest stay active some time after it has been completed so that post quest rumors etc. can show up in conversations.

I still looking for the right point where the "final" quest destruction happens to also remove rumor/questor entries from talk window. I thought it would be Quest.EndQuest() but for the mentioned quest above it immediately fires when clicking the questor to hand in the quest...

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

Re: started implementation of talk window

Post by Interkarma » Tue Nov 21, 2017 9:49 am

IsQuestComplete is an internal property to track ending state prior to tombstone. No need to use it on your end.

Use QuestTombstoned to determine if quest execution is completed, but data is still sitting on quest machine. Once tombstone period elapses, quest data will be unloaded from quest machine. If not tombstoned then quest is still actively running.

QuestSuccess is raised when "give pc" action is called. Even "give pc nothing" will raise this flag. This indicates some kind of success condition or reward was granted as part of quest.

Keep in mind the quest system is still in progress. The primary focus of 0.4 was main quest execution. Conversation system wasn't even planned until 0.5, so some of the groundwork you might need isn't necessarily where you need it to be. Will do what I can to help when possible though. Just keep me up to date where you come unstuck and I'll get there. :)

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

Re: started implementation of talk window

Post by Nystul » Wed Nov 22, 2017 9:52 am

ok that works ;)

thanks :)

questor greeting messages after post quest success or failure are now working.

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

Re: started implementation of talk window

Post by Interkarma » Wed Nov 22, 2017 11:29 am

Well done! Very happy to hear you were able to work with it. Looking forward to playing with it soon. :)

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

Re: started implementation of talk window

Post by Nystul » Mon Apr 30, 2018 11:42 am

just checked again, function IsPlayerInSameLocationWorldCell() in Person.cs still always returns null for me

would also need a mechanism to get location of the quest npcs
(similar to StaticNPC.NPCData as available for questor - I think I would be able to implemenent answers correctly then with the information in fields mapID, locationID, buildingKey)

Can we come up with some info for npcs that were placed by quests - it would be enough for npc placed in towns since you cannot ask for npc placed in dungeons anyway

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

Re: started implementation of talk window

Post by Interkarma » Mon Apr 30, 2018 11:50 am

This should be available by drilling into the SiteLink data. Take a gander at how the quest debugger identifies the building NPC is in to place the text marker. I'll be able help more tomorrow, have already shut down for the night as almost bedtime. :)

Will also have a look at IsPlayerInSameLocationWorldCell() tomorrow as well.

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

Re: started implementation of talk window

Post by Interkarma » Mon Apr 30, 2018 9:25 pm

Nystul wrote:
Mon Apr 30, 2018 11:42 am
just checked again, function IsPlayerInSameLocationWorldCell() in Person.cs still always returns null for me
I hopefully just fixed bug with this commit. The correct symbol for Place was not being assigned to Person. So when when check ran it always found null for lastAssignedPlaceSymbol. My mistake. :)

I've just tested this with sample quest __DEMO07 in city of Daggerfall, and it now correctly reports that player is in same world cell as Gothryd, who is moved to a local tavern by the "place npc" quest action.

That's another thing to keep in mind. The IsPlayerInSameLocationWorldCell() check is only able to test for NPCs moved/placed by "place npc". It won't be able to handle static NPCs in their usual home position, or quest NPCs that have not been placed by "place npc" yet. I can probably work around the first problem with static NPCs, but can't solve the second problem as the NPC technically doesn't exist anywhere in world until quest places them with "place npc".

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

Re: started implementation of talk window

Post by Interkarma » Mon Apr 30, 2018 9:38 pm

Nystul wrote:
Mon Apr 30, 2018 11:42 am
would also need a mechanism to get location of the quest npcs
(similar to StaticNPC.NPCData as available for questor - I think I would be able to implemenent answers correctly then with the information in fields mapID, locationID, buildingKey)

Can we come up with some info for npcs that were placed by quests - it would be enough for npc placed in towns since you cannot ask for npc placed in dungeons anyway
Here are a couple of snippets that might move things in the right direction. Let me know if anything I can expand on, or if this doesn't help at all. :)

Use quest.GetAllResources(Person) to find all Person resources associate to a quest.

Code: Select all

QuestResource[] allPersons = quest.GetAllResources(Person)
if (allPersons != null && allPersons.Length > 0)
{
    // Iterate over Person resources
    // Don't forget to cast QuestResource to Person
}
To find the location Person is assigned to (this should be fixed by commit in my previous post).

Code: Select all

// Get Place a Person was assigned to by "place npc" - will be null if "place npc" not called by quest
Symbol assignedPlaceSymbol = person.GetAssignedPlaceSymbol();
if (assignedPlaceSymbol != null)
{
    Place assignedPlace = quest.GetPlace(assignedPlaceSymbol);  // Gets actual place resource
    // From here, use assignedPlace.SiteDetails to get all the juicy info about that place
}

Post Reply