Author: Huntsman29
Author Website: n/a
Script Name: Street Fight
Description: Will cause two NPCs to fight as soon as they see a PC approach.
Instructions on Use:
  1. Create 2 NPCs and call them "BILL" and "BOB".  Name their tag with the same names.
  2. Create a new faction with the faction editor called "BILL".  Set it with all settings as neutral.
  3. Set both Bill and Bob to the faction of "BILL" that you have just created.
  4. Alter BILL's "OnSpawn" script by un-commenting the "OnPerceive" section.  Save under your own custom name.
  5. Input Script 1 below into Bill's OnUserDefined script.
  6. Alter Bob's OnSpawn script in the same manner as Bill's (uncomment the OnPerceive section).  Alternately you could select the same script for Bob's OnSpawn as you used for Bill's by selecting it from the drop-down menu.
  7. Input Script 2 below into Bob's OnUserDefined script.

Script 1 (OnUserDefined):

//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*    Street Fight script
        2 NPC's or more duke it out.
*/

//:://////////////////////////////////////////////
//:: Created By: Mike Paddon/Enfamous
//:: Created On: 15th July 2002
//:://////////////////////////////////////////////
void main()
{
int nUser = GetUserDefinedEventNumber();
if(nUser == 1002) //OnPerception
{
object oSeen = GetFirstPC();
object oNPC = GetObjectByTag("BOB");
// If it isn't a PC that the commoner sees, it won't do anything.
while(oSeen != OBJECT_INVALID)
{
if (GetObjectSeen(oSeen,OBJECT_SELF))
{
// Once he sees the commoner he will attack NPC tagged before
ActionSpeakString("Ye has bin shagging me wife, DIE!");
ActionDoCommand (AdjustReputation(oNPC, OBJECT_SELF, -50));
ActionDoCommand (ActionAttack (oNPC));
break;
}
oSeen = GetNextPC();
}
}
}

Script 2 (OnUserDefined):

#include "NW_I0_GENERIC"
void main()
{
int nUser = GetUserDefinedEventNumber();
if(nUser == 1002) //OnPerception
{
    object oSeen = GetLastPerceived();
   // If it isn’t a PC that the commoner sees, it won’t do anything.
   if (GetIsPC(oSeen))
     {
        // Once he sees the PC he will speak the string
       ActionSpeakString("Yeah so what! Bring it on loser!");
   }
}
}