2d collision! want player and npc no collide, player and npc collide with terrain.

I want the NPC and player to pass through each other without colliding.
At the same time I want the NPC and player to touch the ground and other monsters.

Take a look here: Layer-Based Collision Detection