Project Zomboid

Project Zomboid

[B42/B41] Bandits NPC (v2)
[BUG] (solved?) Bandits start melee attack before previous attack has finished
When a bandit engages the player from the zero distance, they perform a shove which knocks the player away or down. They do not wait for the shove animation to complete before starting their next attack. Typically this will be a stomp or melee ground attack.

You can see this in the video; the bandit knocks the player down and performs a stomp immediately.

To recreate, simply walk up to a hostile bandit.

This behaviour seems wrong for a few reasons - the player has no visual feedback that they have been shoved, the bandit's ground attack will typically miss as the player is knocked back out of range, and it just looks janky. Presumably it is also causing additional exertion to the bandit.

One (inefficient?) solution is to add an actionstatename check after ZombieActions.Shove.onStart and ZombieActions.Hit.onStart to cancel the new attack:

'
ZombieActions.Shove.onStart = function(bandit, task)

if bandit:getActionStateName() == "bumped" then return true end
'
Last edited by 9kgsofrice; 5 Feb @ 3:03pm