Concurrent agent behaviors

Lavos

Member
Hi,

I am having some issues with my agents to handle concurrent Damage Visualization and (Weapon) Use.

Here are the behaviors that I am expecting :
- when my agent gets hit while performing a light attack, I want his attack (animation) to stop and be replaced by a damage visualization
- when my agent gets hit while performing a heavy attack, he should take damage but without stopping the attack (animation). There should be no hit animation.
- when my agent hit animation is being played, he should not be able to attack.

I am having a lot of trouble to achieve this. Right now, the result is pretty random.
I am a little confused because I am not sure how I should handle all this. Should I do it in the inspector (by configuring the agent's ability priorities or some other parameters), in the behavior designer or in the animator by playing with the transitions and conditions... Maybe a mix of everything. I really don't know because that kind of situation is very hard to debug and understand.
Could you please advise me?
 
Last edited:
One place to start would be to use the state system to disable any abilities that need disabling at the appropriate times. In your case, that would probably mean having a state preset that disables the light attack ability whilst being hit (if being hit is its own ability, you can simply give it its own state name and use that to enable this preset). Then as you expected there would need to be some appropriate transitions in your animator controller, e.g. an immediate exit transition out of the light attack into the damaged animation.

Also when developing/testing this, you may want to make use of the Animator Monitor component to log events/parameter changes, so you know exactly what's happening and what may need changing in the animator controller.
 
No, even the state system does not change anything. I have been struggling with this issue for weeks now. I am going to try to show you what is happening. The agent is the goblin and the animator and logs below correspond to his actions. He is only doing light attacks for now and my character is constantly attacking with a huge sword. I am expecting the goblin to be hit by every slash of my character. The agent should never be able to attack or his attack should be cancelled instantly. Instead the result is just completely random. Sometimes he gets hit and stop attacking. Sometimes he doesn't. I really don't know what to do. I have tried so many things. I suspect the Damage Visualization doesn't trigger as it should (see the animator : the AbilityIndex parameter is almost never set to 10) and that is causing the issue. This situation is super hard to debug because everything is too random and happening too fast. Do you have any idea?


Random-4-game.gif Random-4-logs.gif
Random-4-animator.gif
 
For this situation I would implement a new ability which responds to the OnObjectImpact event and then decides how to pass the impact event on. You'll need to subclass the DamageVisualization class so it does not respond to the OnObjectImpact event. This will give you complete control over when/how the agent reacts and it does not require any tree, animator, or state changes.
 
Thank you for your advice, Justin. I will try. :)
Regarding the DamageVisualization class, from my understanding, it does not respond to the OnObjectImpact by default. Did you mean the OnHealthDamage event?
 
Yeah, overriding DamageVisualization and ignoring the OnHealthDamage event does sound like a good idea.
 
No that does not work either. The OnHealthDamage event randomly doesn't get called.
After further investigation, I am starting to think that I have problems with my weapon's hit detection.
They seem to only happen when I use fast consecutive combo attacks. When I use single attacks without combos everything works fine.
Are there such known issues in the UCC with fast moving objects or with fast consecutive combo attacks? As there is no Rigidbody, I don't think I can use continuous collision detection, can I? I guess that wouldn't change much anyway...
 
Last edited:
This sounds related to the hitbox instead of the event not being sent.
Are there such known issues in the UCC with fast moving objects or with fast consecutive combo attacks? As there is no Rigidbody, I don't think I can use continuous collision detection, can I? I guess that wouldn't change much anyway...
In cases like this you should increase the size of your hitbox. With a high framerate the animations will be moving the hitbox quickly and it could pass through.
 
Top