How to control NPC?

I don't know if there's any example project available to learn, but I have no idea of how to control NPCs. I can spawn them, but it seems that two AI bots do the same in game that is when one shoots another does the same and when one is killed the other is killed too. I have the following code:

Code (CSharp):

if (this.photonView != null && !this.photonView.isMine){
this.enabled = false;
return;
}

in all of the NPC scripts (Awake or Start funcion), but it doesn't work somehow.

Answers