Locating a specific building in a location's JSON?

Discuss modding questions and implementation details.
Post Reply
User avatar
XJDHDR
Posts: 122
Joined: Thu Jan 10, 2019 5:15 pm
Location: New Zealand
Contact:

Locating a specific building in a location's JSON?

Post by XJDHDR »

I have a question about the JSON files that are exported when you use the "dumplocation" function. The scenario is that I want to modify the data for a specific building in a settlement. What is the best way to figure out which of the numerous buildings in the Buildings array is the one I'm looking for.

For example, let's say that I've modified one of the houses in a Map Block Record to be a shop. Now I want to modify the corresponding data for that building in a location file. What is the best way to pinpoint which of the array's objects is the one I need to modify? So far, this hasn't been a problem for me because the buildings I've modified were unique ones in that settlement and I only needed to search for the data that made it unique. This won't work if it's a building that is not unique.

User avatar
Ralzar
Posts: 1716
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Locating a specific building in a location's JSON?

Post by Ralzar »

I've not messed with exporting like that myself, but when I needed the object ID of fountains in towns, Hazelnut gave me this tips:

viewtopic.php?p=50266#p50266
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

User avatar
XJDHDR
Posts: 122
Joined: Thu Jan 10, 2019 5:15 pm
Location: New Zealand
Contact:

Re: Locating a specific building in a location's JSON?

Post by XJDHDR »

Thanks for the help Ralzar. I do use those tips for some of the other things I've had to modify but it doesn't help in this one. This is an example of what an object in the Buildings array looks like:

Code: Select all

			{
				"NameSeed": 5039,
				"FactionId": 0,
				"Sector": 4,
				"LocationId": 50032,
				"BuildingType": "Town23",
				"Quality": 8
			},
As you can see, the model used by the building is not present in this data. That's defined in the Map Block Record. I suspect that locating the building in question involves the order in which the list of MBRs used by the location is processed.

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

Re: Locating a specific building in a location's JSON?

Post by BadLuckBurt »

You are correct, the order is determined by the array indexes of both lists. Easiest would be to merge them into one list which is trivial to do.

Another solution would be to generate a unique identifier for each entry and assign it to the items of both lists for cross referencing them
Daggerfall Unity on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
Daggerfall Unity on Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

Post Reply