EquipUnequip

Szymon Z.

Member
Hello,

I followed the documentation but i have problem with equip/unequip ability.
As i understand this one should me allow to:
- Equip item if it not equipped yet
- Unequip item if item set is equipped.

And while first part is working fine, unequipped not working as expected. By debugging i found that, the method is called correctly but calling StartEquipUnequip, but in this place:
1629287228201.png

it's always returning "false" so method just return.

Am i missing something important ?
 
How are you calling StartEquipUnequip? This page has an example of how to do that: https://opsive.com/support/document...lities/item-abilities/item-set/equip-unequip/

If IsActive is true when calling StartEquipUnequip, then for some reason the ability is still active when it's called. Do you see it marked as "Active" in your character's Item Abilities list at that time? Are you using any custom animations for equip/unequip that you haven't setup the correct animation events for?
 
1629711422080.png

it's how i call that. And in debug mode when i set breakpoint and i go into this method (StartEquipUnequip), i can see that in method StartEquipUnequip, IsActive is always false and method is just returning.
 
Ah I see the confusion now - the EquipUnequip ability is used to equip a specific ItemSetIndex, and in the process unequip the current item (if there is one). Calling StartEquipUnequip(0), whilst the character has that item (with ItemSteIndex 0) already equipped, will do nothing. You instead would need to call StartEquipUnequip with the ItemSetIndex of a different item, or -1. The ToggleEquip ability has an example of this - when unequipping, it calls ItemSetManager.GetDefaultItemSetIndex to get the ItemSetIndex of the default item set for that category (i.e. the Body itemset in the demo). Or you can just call StartEquipUnequip(-1) to always unequip.

Most use cases should be able to use ToggleEquip though.
 
Top