Unequipping an item immediately and equipping another with an animation at the same time

Cheo

Active member
Hello, I'd like to use the EquipUnequip ability to make a character change his current weapon for a specific one, however the tricky part is that I'd like the original weapon to be instantly unequipped but not the other one, which the character should equip with an animation. Here's a video to better illustrate this :


The issue here is that there is a quick flicker on the weapon UI as I first call the EquipUnequip ability to immediately equip item set 0 which is empty, before equipping the initial weapon with the immediate parameter set to false. This may sound like a nitpick but I'd really like to be able to do this cleanly without having to equip this empty item set, but the Equip Unequip ability gave me a headache when I started looking at it ! I hope this can be achieved, thanks in advance.
 
The SlotItemMonitor will update when the OnAbilityUnequipItemComplete event is sent and also when the OnAbilityWillEquipItem event is sent. When you are switching the weapon are you using a timer with a duration of 0 for all of the events? This should trigger the callbacks immediately. If you are calling StartEquipUnequip you may also be able to set the immediateEquipUnequip parameter to true.
 
To be clearer, here's what I'm basically doing at the moment in my takedown ability :

C#:
            m_CharacterLocomotion.GetItemAbility<EquipUnequip>().StartEquipUnequip(0, true, true);

            m_CharacterLocomotion.GetItemAbility<EquipUnequip>().StartEquipUnequip(startItemSetIndex, true, ReequipWeaponInstantly);

I'm not sure I totally understand what you're reffering to with the events and the timer, I'm just using the StartEquipUnequip function that simply. I wish there could be two bools for this function, one for making the unequipping immediate and another for making the equipping immediate. I don't have any example in mind right now but I'm pretty sure there are some shooter games that have some immediate unequipping and animated equipping when you're cycling through your inventory.

Could you please try this on your side, see if you can get this immediate unequipping and animated equipping working out of the box without this flicker, and in any case consider adding this parameter ? Thanks.
 
It looks like the problem is from calling StartEquipUnequip(0) before calling it on startItemSetIndex. I just tried to reproduce this and when I only called a single StartEquipUnequip it worked correctly without the UI first switching to the default item.
 
Top