Item abilities "priority" - Cancel reload and equip other item

denisfrs

Member
Hi guys!

I'm trying to make my character be able to cancel a reload and equip another item.

The item abilities doesn't have a priority like the regular abilities, how i can do i what i want?

I also tried to create a "Reload" and "Equip Unequip" states to block each other, but the "Equip Unequip" state is not being activate.

How i'm supposed to make this work?

Thanks
 
This will require you to subclass the EquipUnequip ability and call TryStopAbility on the Reload ability. You can do this within AbilityStarted.
 
That makes sense. I tried to do that, but seems like something is blocking my ability to start while the character is reloading. The ability do work when there's no reloading going on.
Also, i unchecked the "Prevent Start Use Reload Ability" bool on all the "equip" abilities.

Am i missing something here?


C#:
using UnityEngine;
using Opsive.UltimateCharacterController.Character.Abilities.Items;

public class PriorityEquipUnequip : EquipUnequip
{
    protected override void AbilityStarted()
    {
        base.AbilityStarted();

        var reloadAbility = m_CharacterLocomotion.GetAbility<Reload>();
        if (reloadAbility.IsActive)
        {
            m_CharacterLocomotion.TryStopAbility(reloadAbility);
        }
    }
}
 
Last edited:
Whoa, I completely forgot about that property. I just tested it and you're right, things don't look like they are working as expected. I'll have this fixed in 3.0.12 (which I've held off on the Asset Store release because of some other issues).
 
Top