Win_x64_0.7.91: Map parchments in character inventory; unable to "use" [RESOLVED]

Locked
User avatar
SlainByWoodborne
Posts: 67
Joined: Fri Apr 12, 2019 4:24 am

Win_x64_0.7.91: Map parchments in character inventory; unable to "use" [RESOLVED]

Post by SlainByWoodborne »

Description:
Using the attached save, in the "Inventory" navigate to the "Clothing & Misc" tab. On the "Clothing & Misc" tab, verify three parchments labeled as "Map". I don't know how long ago I mistook these for potion recipes but neither "Use" nor "Equip" nor transferring from cart to character nor character to cart seems to add a location to my map. I'm surprised these even made it into my inventory considering a dialogue is always (except for these three) displayed whenever looting a map parchment.
Attachments
Items_not_stacking_SAVE32.7z
(201.12 KiB) Downloaded 90 times

User avatar
Jay_H
Posts: 4072
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Win_x64_0.7.91: Map parchments in character inventory; unable to "use"

Post by Jay_H »

It's curious that they're in the inventory. Maps are supposed to disappear once they enter your possession. Do you remember how you got them?

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

Re: Win_x64_0.7.91: Map parchments in character inventory; unable to "use"

Post by Interkarma »

Jay's correct, this shouldn't happen anymore. Based on the other bug report with old-style "magic item" ruby placeholders, is this by chance a character loaded from an older build of Daggerfall Unity? Some of these transitional items might persist if character existed prior to certain features being implemented.

User avatar
SlainByWoodborne
Posts: 67
Joined: Fri Apr 12, 2019 4:24 am

Re: Win_x64_0.7.91: Map parchments in character inventory; unable to "use"

Post by SlainByWoodborne »

For reference, in this thread as well, this is my first version of DFU and the character was created this past weekend (on Saturday 20190413).

I looted them from the wardrobe on the second floor of a shop where an additional shelf is sometimes placed; along the wall the room and hallway share. I do not recall the shop type aside from either a general store or pawnshop layout.

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

Re: Win_x64_0.7.91: Map parchments in character inventory; unable to "use"

Post by Interkarma »

Thank you for the extra info. :)

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

Re: Win_x64_0.7.91: Map parchments in character inventory; unable to "use"

Post by Hazelnut »

You should be able to use maps, even though for the most part they are 'used' when you pick them up and never get added as an inventory item.

Unless removed recently, this is the code that handles using map items. Are you sure it's a map from looking at your savefile?

Code: Select all

            else if (item.IsOfTemplate(ItemGroups.MiscItems, (int)MiscItems.Map) && collection != null)
            {   // Handle map items
                RecordLocationFromMap(item);
                collection.RemoveItem(item);
                Refresh(false);
            }

EDIT:
I took a look at the savefile and the items you have are using a different enum. Seems we have 2 entries for maps in the DFU enums, MiscItems.Map and Maps.Map and this code is only handling one of them. Interkarma, can you recall why there are two entries in the enums here? They both map to the same integer 287 and entry in item templates but the latter isn't used anywhere in the codebase, but maybe is what's used by some quests.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Win_x64_0.7.91: Map parchments in character inventory; unable to "use"

Post by Interkarma »

Hazelnut wrote: Thu Apr 18, 2019 3:14 pm Interkarma, can you recall why there are two entries in the enums here? They both map to the same integer 287 and entry in item templates but the latter isn't used anywhere in the codebase, but maybe is what's used by some quests.
Thanks for taking a look. :)

Item enums link up with Daggerfall's internal (internal as in hardcoded into FAL.EXE) group/index pairs. Maps.Map is equivalent to pair 11.0 in classic. MiscItems.Map is 27.8. They both point to item template index 287. In this setup, Daggerfall can use the same item template for different purposes. For example, the "dead body" item can be either a QuestItem (26.5) or a MiscItem (27.5) but they both reference same item template index 281. We build on this group/index>template mapping format as part of supporting classic data across various systems (save import, quests, loot containers, magic items, etc.). A lot of the gorier work is abstracted out by helpers under the hood.

In the case of Maps.Map, it isn't being anywhere in our code directly. But it can be generated from a quest that uses the "map" group/index pair in Quests-Items.txt table:

Code: Select all

map, 11, -1 // The -1 here means "random", but there's only a single item in this group anyway so it's the same as 11.0
The more familiar item pair is:

Code: Select all

random_map, 27, 8
There a few ways we could fix this one:
  1. In your code snippet above, just add || item.IsOfTemplate(ItemGroups.Maps, (int)Maps.Map). This would be my preference as it also adds support for using extant items generated by quests of 11.0 type.
  2. Change the "map" 11,-1 pair to 27, 8 so the group/index pairs are the same. This won't support extant items, but all newly created maps will have the expected group/index pair.
  3. Change all the quests to use "random_map" instead of "map". I think this one would be a pain when the other fixes are just one-liners.

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

Re: Win_x64_0.7.91: Map parchments in character inventory; unable to "use"

Post by Hazelnut »

I think just adding both map variants to the use conditional (option 1) is the best solution to this.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Win_x64_0.7.91: Map parchments in character inventory; unable to "use"

Post by Hazelnut »

Have submitted a PR for this, so now you will be able to read those maps SlainByWoodborne. Note that if you read them on the ship in the middle of the ocean there are no valid discoverable locations in the region (ocean) so you won't get any new locations from reading.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

Locked