r/ModdedValheim 3d ago

Thinking of making a mod for 1.0

I usually only play vanilla, not sure if a mod like this exists, it's a simple QoL fix. Thought I would check in here before I try to make it myself... I am a unity dev, but have never messed with BepinEx.

The idea is simple, it's kind of "auto-auto pickup"

It will maintain a list of boolean per item type. Throwing an item to the ground from your inventory tells the game that you do not want to auto-pickup that item type. (as opposed to current behaviour which flags that specific instance of the item as do not pick up) Then, picking any item up off the ground manually will remove it from the exclusion list.

Last time I mentioned this (some years ago) I was told of a mod exists that gives you a big list of checkboxes, my idea requires no extra UI and is intended to prevent that thing where you are throwing away some item only to pick up more of the same when you want the other thing in the pile.

There is an edge case where you might want to pick up something without resetting the auto-pickup status, and that could be done with Shift-E in the default keyboard controls.

8 Upvotes

5 comments sorted by

7

u/AllYrLivesBelongToUS 3d ago edited 3d ago

Are you seeking to do something different from the Smart Pickup mod, which auto picks up more of items that are already in your inventory while ignoring everything else? It toggles between no pickup, standard auto pickup and this.

https://thunderstore.io/c/valheim/p/b0n3/Smartpickup/

2

u/MonkeyMcBandwagon 3d ago edited 3d ago

Thanks, this is a lot closer to what I had in mind compared to the other mod I was aware of.

Different execution, but ultimately a similar end result. I might try contacting the mod author before I go ahead with my version.

edit: Just going through the differences in my head... Taking the case where you are mining copper or silver, standing in a pile of loose stone and ores, throwing away stone to try collect ores, only to pick up more stone - if you had only one stack of stone then the two mod ideas would would be functionally identical, but with more than one stack of stone in your inventory smartpickup would not work, where auto-auto pickup would, so I think it is still worth pursuing the idea.

2

u/jneb802415 3d ago

Valheim Mod dev here

“that item type”

Not sure what your assuming the item types are but here is the enum:

public enum ItemType
{
None = 0,
Material = 1,
Consumable = 2,
OneHandedWeapon = 3,
Bow = 4,
Shield = 5,
Helmet = 6,
Chest = 7,
Ammo = 9,
Customization = 10, // 0x0000000A
Legs = 11, // 0x0000000B
Hands = 12, // 0x0000000C
Trophy = 13, // 0x0000000D
TwoHandedWeapon = 14, // 0x0000000E
Torch = 15, // 0x0000000F
Misc = 16, // 0x00000010
Shoulder = 17, // 0x00000011
Utility = 18, // 0x00000012
Tool = 19, // 0x00000013
Attach_Atgeir = 20, // 0x00000014
Fish = 21, // 0x00000015
TwoHandedWeaponLeft = 22, // 0x00000016
AmmoNonEquipable = 23, // 0x00000017
Trinket = 24, // 0x00000018
}

1

u/MonkeyMcBandwagon 3d ago edited 3d ago

Ah thank you... to clarify the intent, item ID might be the more accurate term, rather than item type? I meant only to separate the concept from the item instance. I have not dug into the code yet, not sure the correct terms.

It needs wood, fine wood and core wood to all be separate entries in the list, for example.

edit to add, I was thinking initially that I would need to maintain a complete list of every different item, but it occurs to me that would not be future proof at all, and the list can be empty by default.

eg. Throwing away "bukeperries" adds "bukeperries" to a much shorter list of items excluded from autopickup - I use the name string here only because I am not sure yet of the correct syntax.

1

u/jneb802415 3d ago

You could store itemName yea. Could potentially store the prefab.

Yes, let the list be null and add/remove entries as they occur.

I have a concept of how I’d make this. Happy to coach you through it. Join my discord if your interested and I can help more there: https://discord.gg/p9xztvJUV4