SNPCs that can tell when they're getting shot at

I’m able to make an SNPC that can react to an attack whey they get hit, but not when they should “hear” the attack. They can’t tell when bullets whiz by them, in other words.

How would I fix that? :effort:

Make a hitbox that’s slightly larger, but the extra space doesn’t actually do any damage?

NPC.HasCondition
Conditions

This should be what you’re looking for.


COND_HEAR_DANGER			= 50
COND_HEAR_THUMPER			= 51
COND_HEAR_BUGBAIT			= 52
COND_HEAR_COMBAT			= 53
COND_HEAR_WORLD				= 54
COND_HEAR_PLAYER			= 55
COND_HEAR_BULLET_IMPACT			= 56
COND_HEAR_PHYSICS_DANGER		= 57
COND_HEAR_MOVE_AWAY			= 58
COND_NO_HEAR_DANGER			= 60


I’ve tried conditions, but the ones I want never seem to get set. I even tried OnCondition (undocumented, a function you define that takes a single integer representing a new condition) and that didn’t get those conditions either.

Like AlfieSR said, Make a hitbox that’s slightly larger, but the extra space doesn’t actually do any damage.

NPC’s know when they get shot, so make this larger hitbox, but when it gets hit, no damage is delt, no gibs/blood are created, ect.

Wouldn’t a hitbox stop the bullet?

make the hitbox “noclip” if you will but when a bullet comes near… well the npc “hears” it…

There is surely something you can do in Lua to make bullets go through it :dance: