Quick Ammo Switcher

by Banderi

Allows one to quickly load and unload different ammo types without having to fiddle with inventory items.

Tweaks
a month ago
1.1 - 2.0
407
Combat Storage

b Item quality bug

a month ago
(updated a month ago)

Good afternoon! Love the idea here, makes combat so much easier!
I was messing around with quality modules and found that if I have multiple qualities of a particular ammo type, it seems to:
1. Not include ammo above standard quality in the auto-switch cycle
2. Add "free" standard ammo equal to the amount of higher quality.
3. If I have uncommon or higher quality items equipped and try the auto-switch key, the game crashes back to the menu.

e.g. I have 10 explosive cannon shell, 50 standard uranium cannon shell (equipped), 9 uncommon uranium cannon shell, and 1 rare uranium cannon shell.
First auto-switch (bug #1): it will never equip the uncommon/rare uranium cannon shells.
Auto-switch two (works): equips explosive cannon shell.
Auto-switch three (bug #2): equips SIXTY standard uranium cannon shell ("free" shells seemingly equal to the number of higher quality, so if I only have two uncommon shells, then it would be 52. these persist, so can be glitched for infinite ammo)

For bug #3, here is the error text:

The mod Quick Ammo Switcher (1.1.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event QuickAmmoSwitch::switch_ammo_next (ID 255)
__QuickAmmoSwitch__/control.lua:117: Arguments count error for 'spill_item_stack': Expected 1 argument but 2 were given
stack traceback:
    [C]: in function 'spill_item_stack'
    __QuickAmmoSwitch__/control.lua:117: in function 'moveItems'
    __QuickAmmoSwitch__/control.lua:281: in function 'swapAmmo'
    __QuickAmmoSwitch__/control.lua:301: in function <__QuickAmmoSwitch__/control.lua:300>

Let me know if screenshots or other mod lists, etc would be helpful!

a month ago

Ah, thank you kindly for the reports! I very haphazardly updated this to 2.0 but it's super buggy still, especially with the new quality mechanics.
Will fix these ASAP!

a month ago

Thanks for the update, seems to have solved the crash issues! I notice a couple interesting behaviors now though, which maybe are working as designed?

First is that the ammo doesn't cycle/wrap, so if I have explosive and piercing shells, I must press "next" to get to piercing and "previous" to get back to explosive. "Next" with piercing equipped will not wrap back to explosive. This is rather inconvenient, imo.
Secondly, if I have multiple qualities of the same ammo in my inventory, it will only ever equip the highest rarity (legendary -> epic -> etc). I don't mind this necessarily, but wanted to verify it was intended!

a month ago

Yes! I confirm those are as expected - I wanted to add more user options for quality selection, but the code turned out to be an enormous spaghetti mess, since the API is very lackluster and there's lots and lots of edge cases with looping over slots and stacks.

Looping back through the ammo types on the other hand might be an easy fix, I'll see about it!

New response