RandyKnapp / ValheimMods

179 stars 137 forks source link

If you run the non-modded version you lose everything that was on the slots #3

Closed facugra closed 3 years ago

tonypoly commented 3 years ago

Same here

RandyKnapp commented 3 years ago

I'll leave this open for now, and experiment with ways to do this, but it's probably impossible.

sweetgiorni commented 3 years ago

Yeah I imagine this could get tricky to solve. At the very least you could try to empty the mod slots into the player's normal inventory during the OnDestroy() method of your BaseUnityPlugin. Then serialize what was moved and write it to a file. During the next load, read the file and move things from the player's inventory back to the mod slots. It doesn't handle the case where the player doesn't have any inventory space, but it's better than nothing...

epicmeatwad commented 3 years ago

Damn yeah, I just lost my Swamp Key and my troll armor set.

xiaoxiao921 commented 3 years ago

https://github.com/Valheim-Modding/ValheimLib/blob/master/ValheimLib/ODB/SaveCustomData.cs

RandyKnapp commented 3 years ago

Thanks, I'll take a look

Razinell commented 3 years ago

I enabled and then disabled this mod. All my upgraded armor and a troll piece were gone. That really sucks. If you also lose your armor when you die, then this mod is a no-go. Shouldn't even be available for people to use.

Update: I confirmed that I do not lose my equipment on death. Only if disable/remove the mod after having items in the extra slots. I did notice that in the config there is a warning about this problem, but there is no warning on the main mod description page, which is weird.

kajov commented 3 years ago

@Razinell When you die you don't loose the armor and items equipped to the quick slots. If your inventory was not full enough and can fit 8 items that are equipped, they will be present in the death tombstone. If your inventory is full and there is no space the equipment will drop on the floor around the tombstone.

In the end you only loose all items equipped when you de-activate the mod or f.e. load your character which was using the mod on Vanilla version of the game.

derSchotte commented 3 years ago

Hi Randy,

What about playerprefs.save?

https://docs.unity3d.com/ScriptReference/PlayerPrefs.Save.html

Is this possibly something you can use for your mod to save the slots to a file?

RandyKnapp commented 3 years ago

Player prefs is not an appropriate place to store save data, as per the unity docs. I'm working on a new version, just be patient everyone, please.

Artaak commented 3 years ago

do not install the mod equipementandquickslot with the auto update of a mod launcher or you will lose everything in your slots https://valheim.thunderstore.io/package/RandyKnapp/EquipmentAndQuickSlots/2.0.1/

RandyKnapp commented 3 years ago

There's a big warning right on the page: !! READ ME FIRST BEFORE UPGRADING !!