Hey, when my enemy character dies or takes damage, I’m playing a random death or hit montage.
however, that generates all kinds of weirdness, like if it’s crouching and it takes a hit, the anim bp will revert back to the crouch down state (even though I don’t have a path from crouching to crouch down, just the other way around). and when the character dies, after playing the death montage, it will go back to idle instead of just laying on the ground.
so what’s the proper way to do this? should I add this somehow in the animation blueprint? or can I stop the animation blueprint altogether when playing these montages?
Make a custom function to fire the montages.
Allow that custom function to toggle on/off whaveter abp variables you need to toggle off.
For the crouched issue, you simplly toggle crouched off, then play the montage.
The character won’t return to a crouched state (or more appropriately in your scenario it never left that state) afterwards.
Additionally, for death you really want all ABP states to transition to a death state whith a one directional transition, so that it is not possible to hack out of your death state.
Takes a bit of linking work, but saves you from future issues.
Right, I did exactly that, but it didn’t really work.
set a function upon death to do it all: stop ai controller brain component logic, clear focus, disable collisions, stop active movement, and clear all variables from my animbp. I even tried to set it to use an empty animation blueprint. nothing works, and the death animation always ends up like this, or a variation of this.
I even tried to enable ragdoll physics after playing the death montage, but for some reason this is also not working.
One of the things you are doing has an onvalid animation.
When it goes back to A or T pose its usually that.
Check your log. Any time the montage or animation fails that way there is a soft error (warning) associated with it.
If you are not, you should be using the copy pose node in the ABP for the death state.
If you are, then maybe something with that node is wrong.
Though you can, and hack wise it is a lot better… if you are switching ABP on the fly you have to make double sure you are loading/unloading correctly.
There’s a forum topic where we users explain how that’s supposed to be done in relation to ladder climing. Take examples from that.
If you arent stitching ABP on the fly, then definitely add a dedicated state machine for death and make sure it has the right animation for the correct skeleton.
It was going back to T pose specifically cuz I set a bool in my animBP to stop doing anything upon death, in an attempt to fix it going back to the default anim state when ending the death animation.
So I deleted this bool check and went back to my original problem, and which I fixed by simply setting blend out blend time in my montage to 0, and coding the character to pause animations after a delay set to the same time as the montage length, minus a very small value (say -0,01) so it wouldn’t pause animations just as it went back to the default state.
I think the main problem is that I didn’t know about this pause anims bool. If I knew i would probably have figured out the blend out time thing before