Constantly on and toggle-able item

ipleomax

New member
Hello all.

I have a certain pickup item, let's call it "Magic Filter". After I pick it up, it adds to the "Filters" category of the Character's item sets.
It does not have any Third Person or First Person visible object.

What I want now is the ability to keep the magic filter constantly on or off (with a button) while being able to use other weapons/grenades simultaneously.

I've tried but for some reason I can't get it to be "active" along with other weapons/grenades. Even though its a completely different category.
 
Last edited:
In this situation you'll want to create a new slot that your magic item always occupies. You can add a new slot by adding the ItemSlot component. From here you can add a new EquipUnequip ability which will allow you to toggle it off or on. In the demo scene there are three EquipUnequip abilities to go along with the three different categories in the Item Set Manager.
 
Did as you said, another thing I forgot to do earlier was "set slot id to 2" in the Item component. Now the Toggle feature works as intended. Thanks! :D

However, I'm faced with a different issue now:

When I'm firing a weapon or reloading, I cannot Equip/Unequip the Magic Filter. It only lets me toggle after the firing or when reload is complete.
 
The Use ability is likely blocking the Equip/Unequip ability from starting. To make future update merging easier you should subclass the Use ability and then override the ShouldStopActiveAbility/ShouldBlockAbilityStart methods.
 
By subclass do you mean create MyUse by inheriting ItemAbility (and not Use) plus override ShouldStopActiveAbility/ShouldBlockAbilityStart?

Because the part of that's not letting me Equip/Unequip is located at ItemSetAbilityBase's CanStartAbility function.
I see its hardcoded to return true if Use or Reload is active.

I can't seem to override it by simply inheriting Use or Reload item abilities.

On the other hand, by creating completely new MyUse and MyReload I can get around the check in ItemSetAbilityBase.
 
Looks like you're right, I'll add that to my list to look at (not sure if I'll be able to get it in the next update, 2.2.1).
 
Top