Slot0ItemStateIndex sometimes does not reset when attacking an enemy

Lavos

Member
When my character attacks an enemy, the Slot0ItemStateIndex sometimes does not reset from 2 to 0 and my character gets stuck. The OnAnimatorItemUseComplete is called as usual though so I don't get it.

Slot0ItemStateIndex never reset 2.png
I never have this problem if I keep attacking without hitting anyone. Everything works fine including the combos.
Here are the logs just in case :

Slot0ItemStateIndex never reset.png

Log 5086 is the last log entry I get. As you can see OnAnimatorItemUseComplete is called but Slot0ItemStateIndex is not reset to 0...
Any idea?
 
If you are using the demo animator controller you'll need to adjust the states/transitions to fit your new structure. The demo animator requires a very specific setup and you'll need to make any corresponding adjustments with any melee weapon changes.

It is recommended that you start from scratch with a new animator just because the demo animator is extremely complicated. This page explains more: https://opsive.com/support/documentation/ultimate-character-controller/animation/animator/
 
I totally understand why you recommend this in your videos and that is why I have followed your advice. :)
If I understand you well, you are telling me to create my own transition to handle my particular case. You are right I can do this, but I am just surprised to end up in that situation where Slot0ItemStateIndex = 2, Slot0ItemSubstateIndex = 0 and Slot0ItemStateIndex is not reset even with the OnAnimatorItemUseComplete event called. If you are telling me that this behavior is normal and there is no obvious mistake in my configuration, I will move on with that. The fact is I am pretty new to the UCC so I am doing my best to understand how it works.
 
Good to hear on the animator :)

I would need to step through and debug this to be able to fully understand the situation but the state index doesn't reset until the ability has ended. This could explain why the event doesn't necessarily always reset that value. If you're able to reproduce it within the demo scene I will have a better idea.
 
I see so maybe the ability did not end for some reasons. I will try to reproduce it within the demo scene. Thank you again.
 
This is the issue I am running into. What's the correct way to reset the ItemState and ItemSubstateIndex? Even though I set them both to 0, the controller stops taking in the use input.
 
How/why are you setting them manually? As Justin said, the state index values reset when the ability ends.
 
How/why are you setting them manually? As Justin said, the state index values reset when the ability ends.
By having an animation event that calls an integration script to call methods in UltimateCharacterControllerLocomotion.

For me, the bug happens when I attack and move rapidly. Then when I stop moving the ItemStateIndex/ItemSubstateIndex return to 0, but the next time I press attack, the ItemStateIndex/ItemSubstateIndex change but the ItemStateIndexChanged flag does not get toggled so the animator doesn't enter the attacking state machine and the script gets stuck.
 
Have you enabled the log parameter changes toggle on the Animator Monitor? This will allow you to see exactly when the parameters are changed and can help with debugging. If the ItemSetIndex is changed then the trigger will also be set. You should not be setting it directly through the Animator.
 
Top