Mods not working in 0.10.24 builds

Discuss modding questions and implementation details.
Post Reply
User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Mods not working in 0.10.24 builds

Post by Ralzar »

Ah ok, I just removed the Torch Taker bit.

I honestly do not know if that is part of the same problem or not. I only became aware of RestoreSave being the culprit when I started looking into the problem with C&C.

Edit: I see you allready closed it :D

Feel free to make a more understandable version of the issue :D


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

Re: Mods not working in 0.10.24 builds

Post by Ralzar »

See, that was so much clearer. I really should have had some more coffee before attempting to write anything :D

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

Re: Mods not working in 0.10.24 builds

Post by Ralzar »

Apparently, this also breaks all clickable inventory items from my mod. So any food items you have are no longer usable. But if you go into a shop and buy new food items, they work.

Testing later today to confirm, but I saw a stream have that exact problem the other day.

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

Re: Mods not working in 0.10.24 builds

Post by Interkarma »

If you reproduce, could you attach a save that works in 0.10.23 but fails when loaded in 0.10.24?

There weren't any direct change to the areas you're experiencing problems with, not sure yet why your mods have been so adversely affected.

What we can do is work backwards through commits to find bifurcation point when mod breaks between releases, which should isolate the change/PR that makes the difference.

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

Re: Mods not working in 0.10.24 builds

Post by Ralzar »

Interkarma wrote: Tue Jul 07, 2020 6:48 am If you reproduce, could you attach a save that works in 0.10.23 but fails when loaded in 0.10.24?

There weren't any direct change to the areas you're experiencing problems with, not sure yet why your mods have been so adversely affected.

What we can do is work backwards through commits to find bifurcation point when mod breaks between releases, which should isolate the change/PR that makes the difference.
Bug confirmed.

If I load this save in 0.10.23 everything works fine. I've tested several times to make sure this bug is not present in 0.10.23.


If I load the save in 0.10.24 the items are not possible to use.

The save is done inside the shop, which lets you test one extra thing:
If you try to eat one of the items in my inventory. Nothing happens.
If you buy a food item from the shop, it is also not possible to eat.
If you load a save with food in inventory in 0.10.24, save, load in 0.10.23: the item is not possible to eat.
So loading food items from your inventory through a save corrupts them. Saving after that, saves the corrupt state.
The items in the shelves is also corrupted if you load a save inside the shop.

I compared savedata for a Salted Fish item:

Item before corruption:

Code: Select all

                {
                    "uid": 33687721,
                    "shortName": "Salted Fish",
                    "nativeMaterialValue": 0,
                    "dyeColor": "Chain",
                    "weightInKg": 1.5,
                    "drawOrder": 0,
                    "value1": 4,
                    "value2": 0,
                    "hits1": 98,
                    "hits2": 98,
                    "hits3": 0,
                    "stackCount": 1,
                    "enchantmentPoints": 0,
                    "message": 0,
                    "legacyMagic": null,
                    "customMagic": null,
                    "playerTextureArchive": 0,
                    "playerTextureRecord": 0,
                    "worldTextureArchive": 211,
                    "worldTextureRecord": 10,
                    "itemGroup": "UselessItems2",
                    "groupIndex": 536,
                    "currentVariant": 0,
                    "isQuestItem": false,
                    "questUID": 0,
                    "questItemSymbol": null,
                    "trappedSoulType": "None",
                    "className": "ClimatesCalories.ItemSaltedFish",
                    "poisonType": "None",
                    "potionRecipe": 0,
                    "repairData": null,
                    "timeForItemToDisappear": 0,
                    "timeHealthLeechLastUsed": 0,
                    "$version": "v1"
                }

Item after corruption:

Code: Select all

                {
                    "uid": 33687721,
                    "shortName": "Salted Fish",
                    "nativeMaterialValue": 0,
                    "dyeColor": "Chain",
                    "weightInKg": 1.5,
                    "drawOrder": 0,
                    "value1": 4,
                    "value2": 0,
                    "hits1": 98,
                    "hits2": 98,
                    "hits3": 0,
                    "stackCount": 1,
                    "enchantmentPoints": 0,
                    "message": 0,
                    "legacyMagic": null,
                    "customMagic": null,
                    "playerTextureArchive": 0,
                    "playerTextureRecord": 0,
                    "worldTextureArchive": 211,
                    "worldTextureRecord": 10,
                    "itemGroup": "UselessItems2",
                    "groupIndex": 536,
                    "currentVariant": 0,
                    "isQuestItem": false,
                    "questUID": 0,
                    "questItemSymbol": null,
                    "trappedSoulType": "None",
                    "className": null,
                    "poisonType": "None",
                    "potionRecipe": 0,
                    "repairData": null,
                    "timeForItemToDisappear": 0,
                    "timeHealthLeechLastUsed": 0,
                    "$version": "v1"
                }

The difference being that the line

"className": "ClimatesCalories.ItemSaltedFish",

becomes

"className": null,


Edit: Did a bit more testing and found items in shop shelves are also corrupted, which is at least consistent.

SAVE11.zip
(529.87 KiB) Downloaded 113 times

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

Re: Mods not working in 0.10.24 builds

Post by Ralzar »

Small addition:

RP&Rs bed resting and my Fireplace resting still works. Only sprite-based RegisterCustomActivation gets broken.

This works fine:

PlayerActivate.RegisterCustomActivation(mod, 41606, Camping.RestOrPackTent);


This has the bug:

PlayerActivate.RegisterCustomActivation(mod, 210, 1, Camping.RestOrPackFire);

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

Re: Mods not working in 0.10.24 builds

Post by Ralzar »

And to add to the confusion:

Camping Equipment and Rations items still work.

So this works:

DaggerfallUnity.Instance.ItemHelper.RegisterItemUseHandler(templateIndex_CampEquip, Camping.UseCampEquip);
DaggerfallUnity.Instance.ItemHelper.RegisterCustomItem(templateIndex_CampEquip, ItemGroups.UselessItems2);


While this does not:

itemHelper.RegisterCustomItem(ItemApple.templateIndex, ItemGroups.UselessItems2, typeof(ItemApple));

ItemApple: https://github.com/Ralzar81/Climates-Ca ... od.cs#L131

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

Re: Mods not working in 0.10.24 builds

Post by Interkarma »

Ralzar wrote: Tue Jul 07, 2020 9:37 am The difference being that the line

"className": "ClimatesCalories.ItemSaltedFish",

becomes

"className": null,
I'm able to reproduce this using only 0.10.23 and current mod version on Nexus. Whatever this problem is, it's not caused by 0.10.24. Here's the process followed.
  1. Buy salted fish and save.
  2. Confirm "className": "ClimatesCalories.ItemSaltedFish" is present in save data.
  3. Close and reopen game.
  4. Load save from step 2, then save game into a new slot.
  5. Confirm "className": "ClimatesCalories.ItemSaltedFish" is not present in new save data.
I've attached two saves, both made with 0.10.23. The first save was created after first buying salted fish. The second was created after restarting game and resaving first save again. You can confirm the game version was 0.10.23 for both by looking at SaveInfo.txt. I can eat fish after loading first save, but cannot after loading second save. This is all in 0.10.23.

It looks like "className" isn't being properly serialized when saving a second time. My guess would be an issue with struct data being cloned somewhere along the line. Try stepping through in editor to see where this is being lost in the exchange between core and and mod.

This might be a better question for Hazelnut as the developer of the custom item system. And TheLacus is most involved with custom activations. I'm sorry I'm not being much help at all. The best I can do is bounce ideas around a bit. :)
Attachments
saves.zip
(710.84 KiB) Downloaded 101 times

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

Re: Mods not working in 0.10.24 builds

Post by Ralzar »

Hm... I think we're not testing in the same version if that's the case. I just re-tested in 0.10.23 and I can not make the bug happen unless I use a save I made in 0.10.24.


Do the following:

1: Load a save in 0.10.23
2: Fast Travel to a new city (so new items get generated)
3: Enter general store, buy food. Save.
4: Restart game and load save.
5: The food will still work.

Post Reply