Regarding swapping to melee: It doesn't seem like this is working as intended. If you put e.g. a standard biker zombie and an NPC with a pistol about twenty feet apart in a closed room, the NPC won't get a shot off. They might be starting their pistol attack animation, but when the zombie is about ten feet away or so, they
run up to the zombie and melee attack.
Another related issue I just noticed today: if the weapon's range is long enough, then when the NPC tries to go to that distance to attack a zombie, the NPC will end up being out of range of even noticing the zombie. It will then stop attacking, and wander around. At least that's what it looked like to me, when I was testing in a closed room. (It's also possible that the NPCs were constantly trying to run away from the zombie instead of attack it, and its animations make it appear as if it's just wandering around.)
Regarding the delay in attacking: I probably wasn't clear, but it's five seconds
between attacks - not five seconds before they
start attacking. So: attack/five seconds/attack/five seconds/attack...
So even if the zombie is temporarily stunned/halted by the first ranged attack, by the time the second attack comes around, the zombie is already on them and the NPC will do nothing but melee from then on out.
There are several possible fixes, all of which are IMHO better than what exists now:
- Change the distance at which the NPC switches to melee, to something much shorter than what is there now
- Only switch to melee once the enemy actually hits them
- Never switch to melee - always used the ranged weapon no matter what the distance (which is what most players do)
- Try to run away after the first melee hit, don't continue attacking
There might be other/better fixes that I can't think of.
Also, point taken about bandit NPCs being overpowered with respect to the player if some of these changes are made. But as it stands right now, NPCs are vastly
underpowered with respect to zombies. Take a zombie biker and an NPC with an SMG, put them in the Thunderdome,and it's the zombie that will walk out. (EDIT: OK, that's an exaggeration... the NPC will win maybe half the time.)