Download

Player Character Cannot Move Once Engaged in Melee Combat

I have been working on melee combat in a third person game that I have been working on. The enemy AI randomly walks around on the navigation path until the Player Character is within a certain radius of him and then he attacks with 1 of 6 attacks depending on the distance from the Player Character (3 randomly chosen ranged attacks, 3 randomly chosen melee attacks). The enemy AI always moves towards the PLayer Character once he is spotted and when in close for melee attacks, for some reason the Player Character can no longer move. He can still perform some actions but NO movement and most attacks cannot occur. Any ideas what could be going on? Possibly something with collision?

Thanks.

So I ended up moving on and then stumbled upon how this was happening to anyone who may have a similar issue. In order for the Player Character to successfully move or attack, the condition for the Boolean variable “Is Attacking?” is checked to prevent the initiation of movement (gliding) or another attack while the Player Character is currently undergoing animation for the current attack. The problem listed above occurred when the Player Character was attacked in the middle of an attack montage. At the beginning of the attack montage, the Boolean value “Is Attacking?” is set to TRUE and then once the animation Montage is COMPLETED, the variable is set to FALSE. However, when the Player Character is attacked from the enemy AI in the middle of the Attack Montage, the Attack Montage does not COMPLETE and is instead interrupted by animation representing a “Hit Impact”. Therefore, the “Is Attacking?” variable stays set as TRUE and never gets reset to FALSE and therefore will not allow the Player Character to move or attack.

Thanks, you may run into this if the scripting is anything similar to mine so definitely try to wrap your head around this if it helps!