Making villager NPC

I want to make a villager NPC. I know how to make him talk to the palyer.

But IDk how to avoid getting pushed by any mob or palyer. and how to make him invulerable to damage [like it get hurt and turns red and dsiplay particles] . If we do No ai then it stops rotating or facing player.

Continue to help post