implementation of talk window

Discuss coding questions, pull requests, and implementation details.
User avatar
Nystul
Posts: 1185
Joined: Mon Mar 23, 2015 8:31 am

Re: started implementation of talk window

Post by Nystul » Tue May 08, 2018 6:36 pm

just for the records:
the roadmap for quest status shows these things as red but they should be green:
  • add dialog for item anItem
  • add dialog for person anNPC
  • add dialog for location aSite
  • add dialog for location aSite person anNPC item anItem
  • add dialog for location aSite item anItem
  • add dialog for person anNPC item anItem
  • dialog link for item anItem
  • dialog link for person anNPC
  • dialog link for location aSite
  • dialog link for location aSite person anNPC item anItem
  • dialog link for location aSite item anItem
  • dialog link for person anNPC item anItem
  • rumor mill nnnn
and in the general roadmap:
  • Where is (talk: where is NPC or location)

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

Re: started implementation of talk window

Post by Nystul » Tue May 08, 2018 6:55 pm

I got a question about factions and faction ids, more specific FactionData:
is ggroup the id of the faction/guild a npc belongs to and sgroup the subgroup inside the faction/guild?
if yes why do npcs that are members of the mages guild have faction id 10 but the guild code for the mages guild (MagesGuild.cs) says that faction id is 40?
if no, where do I get the faction id for npcs instead?

User avatar
Deepfighter
Posts: 57
Joined: Sun Mar 22, 2015 10:24 am
Location: Iliac-Bay
Contact:

Re: started implementation of talk window

Post by Deepfighter » Wed May 09, 2018 7:45 am

Nystul wrote:
Tue May 08, 2018 6:55 pm
I got a question about factions and faction ids, more specific FactionData:
is ggroup the id of the faction/guild a npc belongs to and sgroup the subgroup inside the faction/guild?
if yes why do npcs that are members of the mages guild have faction id 10 but the guild code for the mages guild (MagesGuild.cs) says that faction id is 40?
if no, where do I get the faction id for npcs instead?
Yeah, you assumed correctly:
ggroup (=Guild Group): Faction they do belong to ("People of...", "Mages Guild",...)
sgroup (=Social Group): What they are in Daggerfall/respective in their Faction ("Scholar", "Merchant", "Noble", "Underworld",...)

Regarding the ID: Both are correct. for the Mages Guild the faction ID is 40 and the ggroup is 10. By the way is faction ID 40 already correctly associated with the ggroup 10 for the Mages Guild, as well as other Mage Guild associated like The Master at Arms or The Academics which are also ggroup 10. What I can tell you is that ggroup is solely used within the FACTIONS.TXT (haven't seen it somewhere else) for grouping and the faction ID is the number associated with the Guild/Person/Temple. For referencing the Faction I would therefore go for the factions ID, as they are also used in the TEXT.RSC (as far as I know). I am not 100% sure, though but it makes the most sense this way. Nevertheless, the numbers seem correct for me in this example.

Side note: You have to be aware that the original FACTIONS.TXT has some serious mistakes and is here and there a bit messed up. For example are The Patricians (Mages Guild trainers) tagged up as belonging to the underworld and as a region. Or some regions are associated with the wrong race (Alik'ra as Breton instead of Redguard). There are already fixes out there for that.

Best,
Deepfighter
Head of the German Daggerfall translation - www.daggerfalldeutsch.de
and German translator for The Elder Scrolls V: Skyrim and Lore-Expert for The Elder Scrolls: Online

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

Re: started implementation of talk window

Post by Nystul » Wed May 09, 2018 10:13 am

so where do i get the ggroup for the different guilds/factions via code? I mean I know how to get it for the npcs but where is the collection/list for guilds/factions.
I need to do something like

Code: Select all

if (npc.factionData.ggroup == guild['Mages Guild'].ggroup)
else if (npc.factionData.ggroup == guild['Thieves Guild'].ggroup)
...
I can also hard code the values - but I need this list of values for guilds (don't want to find it on my own)

edit: I found an answer in allofich latest pr

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

Re: started implementation of talk window

Post by Interkarma » Wed May 09, 2018 11:10 am

Just in case it still helps, the best place to get faction data is from PlayerEntity.FactionData. This exposes PersistantFactionData class for player which is their live set of faction information with all current reputations.

Use PlayerEntity.FactionData.FactionDict property to access a dictionary of information keyed by factionID. Entries are of type FactionFile.FactionData, which expose the following information. This includes ggroup for that factionID.

Code: Select all

public struct FactionData
        {
            public int id;
            public int parent;
            public int type;
            public string name;
            public int rep;
            public int summon;
            public int region;
            public int power;
            public int flags;
            public int ruler;
            public int ally1;
            public int ally2;
            public int ally3;
            public int enemy1;
            public int enemy2;
            public int enemy3;
            public int face;
            public int race;
            public int flat1;
            public int flat2;
            public int sgroup;
            public int ggroup;
            public int minf;
            public int maxf;
            public int vam;
            public int rank;
            public int randomValue;
            public int randomPowerBonus;
            public int ptrToNextFactionAtSameHierarchyLevel;
            public int ptrToFirstChildFaction;
            public int ptrToParentFaction;

            public List<int> children;
        }
There's also a name to ID lookup helper if needed. But generally all you should need to do is query by factionID and all the live data is available.

The persistent faction data is instantiated at time of character creation from FACTION.TXT (which is read by ContentReaders in DaggerfallUnity). The persistent faction data evolves with player over time as they complete quests and go up and down in reputation with various entities around the Illiac Bay.

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

Re: started implementation of talk window

Post by Nystul » Thu May 10, 2018 11:11 pm

hi interkarma,
there is a small bug with quest resources that is happening because of program execution order related to quest action execution:

when quest resources are created also talk topics are injected and visible by default
a "dialog link" command may come later that makes them invisible
when accepting a quest from a questor that has a npc submenu (with entries like e.g. join guild, service action, talk) one will return to this submenu, making it possible to start a conversation by clicking on "talk" - when doing so "dialog link" commands will not be reached before the talk window opens leading to entries that should be hidden being visible. There is no problem when the questor does not have a submenu or when exiting the submenu and start conversation then (because update function of dialog link class will have its chance to do its magic)

what can we do about this. One easy fix would be to close the submenu after one option was chosen (this is btw. what vanilla daggerfall does)

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

Re: started implementation of talk window

Post by Interkarma » Thu May 10, 2018 11:56 pm

Nystul wrote:
Thu May 10, 2018 11:11 pm
what can we do about this. One easy fix would be to close the submenu after one option was chosen (this is btw. what vanilla daggerfall does)
This sounds like it will be the easiest fix. It should be possible to just scrape that submenu off the top of the UI stack with uiManager.PopWindow() once an option is selected.

I'm open to other options as well. Perhaps there's a way to fix execution order somehow. I just can't think of anything right now off the top of my head.

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

Re: started implementation of talk window

Post by Nystul » Fri May 11, 2018 7:49 am

ok I will try to make that change then, if everybody is ok with it

update: is there a better way to make the submenu go than inserting a uiManager.PopWindow() at the end of each callback for handling processing the corresponding menu entry? furthermore a call to uiManager.PopWindow() e.g. in callback TalkButton_OnMouseClick() will result in the talk window closing immediately after opening which is clear to me now that i have though about it. because it closes the talkwindow... even this.PopWindow() inside the specific PopupWindow class does not work and closes the talk window

update2: found an easy way to close submenu by calling this.CloseWindow() in function DaggerfallTalkWindow.OnPop() after the base.OnPop() call - submenu will be closed only if talk entry was picked - other selection behave like before - hope this is ok, we could work through other windows as well to have consistent behaviour but I think it is ok to leave it like this for now

update3: just realized the real problem I have to fix is when getting a quest that the menu must close after accepting/declining it ;) my bad

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

Re: started implementation of talk window

Post by Interkarma » Fri May 11, 2018 9:29 am

Sounds like you're smashing it. Sometimes it just takes a few cracks to zero in on the best solution. Awesome stuff mate!

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

Re: started implementation of talk window

Post by Nystul » Fri May 11, 2018 12:38 pm

fixed in pull request

Post Reply