Offhand placeholders don't get unequipped

Summary: When you have a higher ilevel 1h weapon than the 2h weapon your footman is currently using, they will switch to the 1h but still have an offhand placeholder equipped, such that they’re unable to equip a shield or anything else in their offhand.

Steps to reproduce:

  1. Make a footman, level up them up to level 6 just to be safe.
  2. Provide a low ilevel 2h weapon and watch them equip it.
  3. Provide a high ilevel 1h weapon (modded, because the base game doesn’t have high enough ilevel 1h weapons) and shield. Watch them equip the weapon but not the shield.
  4. Check the equipment component of the footman to see that they still have their offhand placeholder equipped.

Expected Results: When the 2h weapon is unequipped, its additional equipment should also be unequipped.

Actual Results: It’s not.

Notes: Looking at line 179 of equipment_component.lua, it seems like once a new item is equipped in a slot and the old item that was in that slot is unequipped, all the “additional equipment” from that old item is being told to equip, rather than unequip. Should be a simple fix to change that I imagine (testing with just that change seems to have fixed it).
Edit: So it should change from this:
local old_item = self:equip_item(unequip_uri, false)
to this:
local old_item = self:unequip_item(unequip_uri)

Version Number and Mods in use: latest, messing around in ACE

1 Like

yeah i ran into this problem a few weeks ago too, did not expect the fix for this would be as easy as a line change somewhere @Relyss / @max99x he supplies a potential fix too! :smiley:
(for refference @paulthegreat i also use the addition equip stuff to add sword sheaths and things to hearthlings, so this getting fixed would be a really good one :smiley: (so you dont get hearthlings running around with sword sheaths even though now they are using an axe)

Yeah, I already filed this bug when @Wouter_Sikkema reported it.

I think we’ll want all additional equipment to be non-upgradeable? Since it’s an extra piece that gets created when we equip the main piece, making several hearthlings to equip and unequip it will create extra iconics of that additional equipment for free. This is something that modders would need to take into account when creating their equipment pieces.

It would also help to destroy them on unequip, since unequip is called on promotion/demotion, incapacitation, etc too and we check on drop if the item should be destroyed or dropped.

I don’t know when will this get fixed but I’ll ask Linda again since it should be an easy fix like @paulthegreat suggested. :thinking:

Thanks for reporting!

1 Like

As long as people define those items as having an ilevel <= 0 or no_drop == true, they should be getting destroyed on unequip (the _drop_item(item) function gets called, and it checks whether the entity “should drop”, and otherwise it destroys it). I think that at worst, this just requires modders to duplicate any items they want to treat as additional_equipment and set different ilevels or no_drop for them (which, with mixins, is fairly trivial for a handful of items, but can be a pain if you’re trying to allow any arbitrary item to be used in that way), though as you say it could certainly be made simpler by better integrating that into the equipping/unequipping process.

It wasn’t so straightforward to fix it, since there were some edge cases related to incapacitation, but it should be fixed in the next build. Also make sure to include “destroy_on_drop”: true besides the negative ilevel from now on.