Aim ability only on specific weapons

Hiiyan90

New member
Hello!

I wondering if it's possible to only have the aim function available on specific weapons. I might be very wrong but I feel like this used to be an option in the melee weapon component or something some time ago.

My main reason is I have some weapons I would like to have the lock on ability when aimed and some I would like to not use the aim function at all. Or option B, with certain items, still have the aim function but not allow it to lock on. I swear I did this once before several updates ago but I can not seem to track down anything I would have to do it so maybe I imagined it in my prototype.

Thanks very much.
 
Yes, you can use the state system to enable/disable the aim ability based on the current item set.
 
Sorry for the late response. I have been fiddling around with it for a while and took a break after no success. I finally realized it's because I'm using the inventory item set manager with UIS integration so there are no state options visible. Can I use both at the same time to trigger it or where so I access the states for the item sets if using UIS?

Thanks.
 
What if you cannot use the state system as you are using an UMA character? How could you go about restricting Aim to only aimable weapons in code?
 
In the next update I plan on adding the ability to add states at runtime so it'll be a lot easier. In the meantime you'll need to modify the aim ability's CanStartAbility to only return true when you want the character to be able to aim.
 
Thanks, I'm digging into that at the moment.

I'm trying to subclass the aim ability and to achieve this, but the AimAbility is added by default when UseItems is checked. If I uncheck that then, a whole bunch of stuff isn't added. So I had to modify that CharacterBuilder class to achieve this.

In a future version could you also add an option "Add Standard Item Abilities" and also an array of item abilities to add.

What I've done to achieve this (incase anyone else ever needs this)
  1. Added "bool m_AddStandardItems" to UMACharacterBuilder
  2. CharacterBuilder.BuildCharacterComponents() method I added a parameter "addStandardItems"
    1. In this method where it checks "addItems" to add the default items, I changed that if to also check for "addStandardItems"
  3. I updated UMAAbilityBuilder to check if the type is a subclass of ItemAbility
    C#:
    if (abilityType.IsSubclassOf(typeof(ItemAbility)))
        AbilityBuilder.AddItemAbility(characterLocomotion, abilityType);
    else
        AbilityBuilder.AddAbility(characterLocomotion, abilityType);

    Might be neater to have a separate list for ItemAbilties, but this works just as well.
 
Top