Item Use Cancel

honesyokan

New member
I want to make Ability that can cancel Attack(“Use” ability) and roll (Roll state).
So I made new “Use” ability that stops its ability when the state become Roll state.
But there is some problem like below
・it stops ability and animation propery , but doesn’t change position despite roll ability is set to use root motion.
Is there any better way to cancel Item Use ability?

スクリーンショット 2024-04-13 18.35.09.png
 
Does the roll ability start? My guess is that the roll ability is not actually starting. Within the inspector you should see an "(Active)" next to the roll ability.
 
Thanks for reply.
The Roll ability started, and the state became Roll.
But I found out the use ability is still active(it stays active and not finish until use is disabled)

Is there any sample or general way to cancel ability or override with another ability? If there is some reference, it’s very useful.
 
Yes, there is. You can override the ShouldBlockAbilityStart or the ShouldStopActiveAbility method. This will allow you to control when the ability should deactivate another ability. If you do a search within the codebase you'll find a good number examples of it's use.
 
Thank you for imformation. I didn't know that and it helps a lot.

And Finally I managed to do what I wanted to do!

But It turns out I didn't even need script.
All I need to know was the idea of how to use state system.
The state system is soooooo strong!

Thank you!
 
Top