[0.10.23] Turning in the Illessian Hills region fails [GAME-DATA RELATED]

Locked
User avatar
Hazelnut
Posts: 2223
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

[0.10.23] Turning in the Illessian Hills region fails [GAME-DATA RELATED]

Post by Hazelnut » Sat Jun 27, 2020 7:15 pm

I was testing the guild switching for vampires and was in the Ilessan Hills region and didn't change after getting the following exception:

Code: Select all

Exception: GetRegionFaction() found more than 1 matching NPC faction for region 60.
DaggerfallWorkshop.Game.Player.PersistentFactionData.GetRegionFaction (Int32 regionIndex, DaggerfallConnect.Arena2.FactionData& factionData, Boolean duplicateException) (at Assets/Scripts/Game/Player/PersistentFactionData.cs:272)
DaggerfallWorkshop.Game.Formulas.FormulaHelper.GetVampireClan (Int32 regionIndex) (at Assets/Scripts/Game/Formulas/FormulaHelper.cs:385)
DaggerfallWorkshop.Game.MagicAndEffects.MagicEffects.VampirismInfection.get_InfectionVampireClan () (at Assets/Scripts/Game/MagicAndEffects/Effects/Diseases/VampirismInfection.cs:60)
DaggerfallWorkshop.Game.MagicAndEffects.MagicEffects.VampirismInfection.DeployFullBlownVampirism () (at Assets/Scripts/Game/MagicAndEffects/Effects/Diseases/VampirismInfection.cs:177)
DaggerfallWorkshop.Game.UserInterface.UserInterfaceWindow.RaiseOnCloseHandler () (at Assets/Scripts/Game/UserInterface/UserInterfaceWindow.cs:174)
DaggerfallWorkshop.Game.UserInterface.UserInterfaceWindow.CloseWindow () (at Assets/Scripts/Game/UserInterface/UserInterfaceWindow.cs:130)
DaggerfallWorkshop.Game.UserInterfaceWindows.DaggerfallVidPlayerWindow.Update () (at Assets/Scripts/Game/UserInterfaceWindows/DaggerfallVidPlayerWindow.cs:144)
DaggerfallWorkshop.Game.DaggerfallUI.Update () (at Assets/Scripts/Game/DaggerfallUI.cs:363)
Two faction entries are being matched: #350 The Septim Empire and #235 Ilessan Hills both of type 7 (province)

It appears that the only way to distinguish is using the ggroup which is 15 (Region) for the correct entry. The only two type 7 entries that aren't a region are #350 and #358 (Orsinium) and neither have a ggroup of 15.

So I think that PersistentFactionData.GetRegionFaction() needs to pass 15 for the second param to FindFactions() but this could have consequences beyond my knowledge so I'd like this to be checked by Interkarma.

My proposed fix is:

Code: Select all

        public void GetRegionFaction(int regionIndex, out FactionFile.FactionData factionData, bool duplicateException = true)
        {
            FactionFile.FactionData[] factions = GameManager.Instance.PlayerEntity.FactionData.FindFactions(
                (int)FactionFile.FactionTypes.Province, -1, (int)FactionFile.GuildGroups.Region, regionIndex);
This change does allow me to turn vampy in Ilessan Hills region. You can see it in PR#1845 - if you have any concerns about this I will remove it from the PR.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: [0.10.23] Turning in the Illessian Hills region fails

Post by Interkarma » Sat Jun 27, 2020 9:42 pm

Hi mate, please don't include that change with your PR, it's based on bad game data on your end. If we need to approach a fix, we should consider it a save state migration problem as not everyone will have same data here.

Faction #350 has a type of 2 (not 7) in properly patched game data and in DFU itself. I started including FACTION.TXT with the game some time ago because there were so many issues with people running unpatched game data.

https://github.com/Interkarma/daggerfal ... .TXT#L5371

It's still possible to have unpatched game data on your end if you import an old classic save or still have an old DFU save hanging around. Deleting FactionData.txt in your save will update to correctly patched version included with game.

User avatar
Hazelnut
Posts: 2223
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: [0.10.23] Turning in the Illessian Hills region fails

Post by Hazelnut » Sat Jun 27, 2020 10:58 pm

Oh, I feel foolish now.. spending so much time tracking it down. :D

Have removed it from the PR.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: [0.10.23] Turning in the Illessian Hills region fails

Post by Interkarma » Sat Jun 27, 2020 11:09 pm

Thank you mate, and it's all definitely all good! It's probably something we need some handling for anyway, I'd just be inclined to approach it a different way (like fixing that problematic #350 type in faction data on load if not already correct),

There are just so many little bugs in unpatched faction data it's going to be hard to patch everything on the fly, which is why I started including patched FACTION.TXT with the game in Jan 2019. The number of faction-related bugs has dropped significantly since then. In fact, it's been so long that I had to double-check this was another one of those.

Locked