Dreadnought9999
New member
So I'm trying to develop an AI that has 6 weapons for a first-person-shooter, and I'm getting very confused with how the Use and EquipUnequip work when trying to start them from a script. Specifically the player is either not animating or not completing the animation for shooting, as of now, I can see I'm not receiving any of the callbacks for OnAnimatorItemUse and OnAnimatorItemUseComplete, I am receiving the OnCharacterItemAbilityActive callback which prints whether the ability is active or not, I always get a true and false message instantly.
In regards to Animation I'm using the UFPSDemo animator controller for the AI character, which I've also done with my player character and that works fine, along with that I've set each of the 6 weapons to have the AssaultRifle animator controller that came with UFPS for both player and AI. I should mention I am not using the Nolan character model, but a separate model, in case its Avatar might be causing problems.
I am suspecting my problem lies in not having a clear understanding of the pipeline that follows when TryStartAbility is called, and the Animator parameters "Slot0ItemID", "Slot0ItemStateIndex", "Slot0ItemStateIndexChange" and "Slot0ItemSubstateIndex" and how exactly those are set and trigger the aim and fire animations in the Assault Rifle sub state machine on the Arms layer of UFPSDemo.
Since my character gets constantly stuck in the Aim animation this is for both when the Aim ability is set to either manual or automatic (I've tried using automatic for keeping the AI in the right position). So the shoot animation never plays and I believe never sends the callbacks to ShootableWeapon. In regards to the EquipUnequip, either it won't animate and just change weapon or the Use ability blocks it completely.
Here are my ability settings
For code I've just been calling this for shooting
For equipping I've just been testing with
equip.StartEquipUnequip((int)index)); //Where index is an enum for Weapons
Can anyone tell me if I'm missing something in how I'm executing this, or other possible components that could be causing the issue? Since my player and AI are using the same character model and animation controllers, and the Player works fine.
Thanks in advance.
In regards to Animation I'm using the UFPSDemo animator controller for the AI character, which I've also done with my player character and that works fine, along with that I've set each of the 6 weapons to have the AssaultRifle animator controller that came with UFPS for both player and AI. I should mention I am not using the Nolan character model, but a separate model, in case its Avatar might be causing problems.
I am suspecting my problem lies in not having a clear understanding of the pipeline that follows when TryStartAbility is called, and the Animator parameters "Slot0ItemID", "Slot0ItemStateIndex", "Slot0ItemStateIndexChange" and "Slot0ItemSubstateIndex" and how exactly those are set and trigger the aim and fire animations in the Assault Rifle sub state machine on the Arms layer of UFPSDemo.
Since my character gets constantly stuck in the Aim animation this is for both when the Aim ability is set to either manual or automatic (I've tried using automatic for keeping the AI in the right position). So the shoot animation never plays and I believe never sends the callbacks to ShootableWeapon. In regards to the EquipUnequip, either it won't animate and just change weapon or the Use ability blocks it completely.
Here are my ability settings
For code I've just been calling this for shooting
For equipping I've just been testing with
equip.StartEquipUnequip((int)index)); //Where index is an enum for Weapons
Can anyone tell me if I'm missing something in how I'm executing this, or other possible components that could be causing the issue? Since my player and AI are using the same character model and animation controllers, and the Player works fine.
Thanks in advance.