All Homes Locations owned by the same NPC?

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
User avatar
The Holy Knight
Posts: 47
Joined: Wed Jun 26, 2019 11:51 pm

All Homes Locations owned by the same NPC?

Post by The Holy Knight »

I started to travel to some of the home locations on the map and I noticed all of them have the same NPC "Alabywyr Hawkford" in every location I visited. I don't know if anyone else is experiencing this

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: All Homes Locations owned by the same NPC?

Post by BadLuckBurt »

Do you happen to have a list of locations you traveled to? I think I know what's going on but would like to check it in classic DF to be sure
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

User avatar
The Holy Knight
Posts: 47
Joined: Wed Jun 26, 2019 11:51 pm

Re: All Homes Locations owned by the same NPC?

Post by The Holy Knight »

In the Daggerfall Region I went to "The Old Buckingcroft Place" and "The Ashsmith Cabin" and a couple other homes to confirm but it seems its only be happening in the same Interior Model.
Screenshot (1).png
Screenshot (1).png (1005.83 KiB) Viewed 1065 times

User avatar
The Holy Knight
Posts: 47
Joined: Wed Jun 26, 2019 11:51 pm

Re: All Homes Locations owned by the same NPC?

Post by The Holy Knight »

I already checked in classic DF and the names were different

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: All Homes Locations owned by the same NPC?

Post by BadLuckBurt »

The Holy Knight wrote: Sun Nov 24, 2019 7:50 pm I already checked in classic DF and the names were different
Thanks, I appreciate it. I've seen the same thing happen while testing World Data stuff and making copies of locations. I wasn't sure if classic had the same behaviour or not. What version of DFU are you using?
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

User avatar
The Holy Knight
Posts: 47
Joined: Wed Jun 26, 2019 11:51 pm

Re: All Homes Locations owned by the same NPC?

Post by The Holy Knight »

I'm using the recent Build 0.10.11

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: All Homes Locations owned by the same NPC?

Post by BadLuckBurt »

The Holy Knight wrote: Sun Nov 24, 2019 8:01 pm I'm using the recent Build 0.10.11
Thanks. I'm still using an older version but I'll have a look at the code that generates the NPC names. It's supposed to take the location's id into account but apparently that's not happening.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

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

Re: All Homes Locations owned by the same NPC?

Post by Hazelnut »

Are all these places a single block or multiple?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: All Homes Locations owned by the same NPC?

Post by BadLuckBurt »

Hazelnut wrote: Sun Nov 24, 2019 10:05 pm Are all these places a single block or multiple?
They're all the same interior like we discussed before. Which in itself is fine but the NPCs (and maybe inventories) should be unique.

I dug a bit in the code and at some point in DaggerfallInterior, the static npcs are created at which point they receive their name.

Changing this:

Code: Select all

// Add StaticNPC behaviour
StaticNPC npc = go.AddComponent<StaticNPC>();
npc.SetLayoutData(obj, entryDoor.buildingKey);
To this:

Code: Select all

// Add StaticNPC behaviour
StaticNPC npc = go.AddComponent<StaticNPC>();
DFLocation location = GameManager.Instance.PlayerGPS.CurrentLocation;
int key = entryDoor.buildingKey + location.LocationIndex;
npc.SetLayoutData(obj, key);
takes care of the problem. Death to the carbon copies :lol:
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

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

Re: All Homes Locations owned by the same NPC?

Post by Interkarma »

Prior to March 2018, this used flat position as well for uniqueness like below.

Code: Select all

npcData.nameSeed = (int) obj.Position ^ buildingKey;
There must have been an issue with this approach, as it was changed as part of #645 in following commit.

https://github.com/Interkarma/daggerfal ... 76060433ef

When no longer mixing in flat position, it means that every building with the same ID will have the same NPC names.

BadLuckBurt's solution above should be fine if Hazelnut is happy with it. I can't recall why this was changed back in 2018. It's mainly important the seed is deterministic and unique per building in each location. I'd definitely want Hazelnut's take on this first.

Post Reply