void main()
{

object oPC = GetEnteringObject();
object oTarget;
object oEnemy;
object oWP;
location lWP;

int i;

if (!GetIsPC(oPC)) return;

int nMonsterRoll = d6();
int nDestination = d10();

if (nMonsterRoll >= 2)
 {
 oTarget=GetFirstFactionMember(oPC, FALSE);
 while (GetIsObjectValid(oTarget))
  {
  AssignCommand(oTarget, ClearAllActions());
  AssignCommand(oTarget, ActionJumpToLocation(GetLocation(GetWaypointByTag("WP_KeepInverness"))));
  oTarget=GetNextFactionMember(oPC, FALSE);
  }
 }

else
 {
//Encounter #1
 if (nDestination == 1)
  {
  oWP = GetWaypointByTag("WP_WildArea2_1");
  lWP = GetLocation(oWP);
  if (GetAreaFromLocation(lWP)==OBJECT_INVALID) return;
  for (i = 1; i < (d4()+1); i++)
   {
   oEnemy = CreateObject(OBJECT_TYPE_CREATURE, "nw_wight", lWP, FALSE);
   }
  oTarget=GetFirstFactionMember(oPC, FALSE);
  while (GetIsObjectValid(oTarget))
     {
     AssignCommand(oTarget, ClearAllActions());
     AssignCommand(oTarget, ActionJumpToLocation(lWP));
     oTarget=GetNextFactionMember(oPC, FALSE);
     }
  }
//Encounter #2
 else if (nDestination == 2)
  {
  oWP = GetWaypointByTag("WP_WildArea2_2");
  lWP = GetLocation(oWP);
  if (GetAreaFromLocation(lWP)==OBJECT_INVALID) return;
  for (i = 1; i < (d3()+1); i++)
   {
   oEnemy = CreateObject(OBJECT_TYPE_CREATURE, "nw_werecat", lWP, FALSE);
   }
  oTarget=GetFirstFactionMember(oPC, FALSE);
  while (GetIsObjectValid(oTarget))
     {
     AssignCommand(oTarget, ClearAllActions());
     AssignCommand(oTarget, ActionJumpToLocation(lWP));
     oTarget=GetNextFactionMember(oPC, FALSE);
     }
  }
//Encounter #3
 else if (nDestination == 3)
  {
  oWP = GetWaypointByTag("WP_WildArea2_3");
  lWP = GetLocation(oWP);
  if (GetAreaFromLocation(lWP)==OBJECT_INVALID) return;
  for (i = 1; i < (d4()+2); i++)
   {
   oEnemy = CreateObject(OBJECT_TYPE_CREATURE, "nw_btlbomb", lWP, FALSE);
   }
  oTarget=GetFirstFactionMember(oPC, FALSE);
  while (GetIsObjectValid(oTarget))
     {
     AssignCommand(oTarget, ClearAllActions());
     AssignCommand(oTarget, ActionJumpToLocation(lWP));
     oTarget=GetNextFactionMember(oPC, FALSE);
     }
  }
//Encounter #4
 else if (nDestination == 4)
  {
  oWP = GetWaypointByTag("WP_WildArea2_4");
  lWP = GetLocation(oWP);
  if (GetAreaFromLocation(lWP)==OBJECT_INVALID) return;
  for (i = 1; i < (d3()+1); i++)
   {
   oEnemy = CreateObject(OBJECT_TYPE_CREATURE, "doppleganger0", lWP, FALSE);
   }
  oTarget=GetFirstFactionMember(oPC, FALSE);
  while (GetIsObjectValid(oTarget))
     {
     AssignCommand(oTarget, ClearAllActions());
     AssignCommand(oTarget, ActionJumpToLocation(lWP));
     oTarget=GetNextFactionMember(oPC, FALSE);
     }
  }
//Encounter #5
 else if (nDestination == 5)
  {
  oWP = GetWaypointByTag("WP_WildArea2_5");
  lWP = GetLocation(oWP);
  if (GetAreaFromLocation(lWP)==OBJECT_INVALID) return;
  for (i = 1; i < (d4()+1); i++)
   {
   oEnemy = CreateObject(OBJECT_TYPE_CREATURE, "giantlizard", lWP, FALSE);
   }
  oTarget=GetFirstFactionMember(oPC, FALSE);
  while (GetIsObjectValid(oTarget))
     {
     AssignCommand(oTarget, ClearAllActions());
     AssignCommand(oTarget, ActionJumpToLocation(lWP));
     oTarget=GetNextFactionMember(oPC, FALSE);
     }
  }
//Encounter #6
 else if (nDestination == 6)
  {
  oWP = GetWaypointByTag("WP_WildArea2_6");
  lWP = GetLocation(oWP);
  if (GetAreaFromLocation(lWP)==OBJECT_INVALID) return;
  for (i = 1; i < (d3()+1); i++)
   {
   oEnemy = CreateObject(OBJECT_TYPE_CREATURE, "giantviper", lWP, FALSE);
   }
  oTarget=GetFirstFactionMember(oPC, FALSE);
  while (GetIsObjectValid(oTarget))
     {
     AssignCommand(oTarget, ClearAllActions());
     AssignCommand(oTarget, ActionJumpToLocation(lWP));
     oTarget=GetNextFactionMember(oPC, FALSE);
     }
  }
//Encounter #7
 else if (nDestination == 7)
  {
  oWP = GetWaypointByTag("WP_WildArea2_7");
  lWP = GetLocation(oWP);
  if (GetAreaFromLocation(lWP)==OBJECT_INVALID) return;
  for (i = 1; i < (d3()+1); i++)
   {
   oEnemy = CreateObject(OBJECT_TYPE_CREATURE, "nw_bearbrwn", lWP, FALSE);
   }
  oTarget=GetFirstFactionMember(oPC, FALSE);
  while (GetIsObjectValid(oTarget))
     {
     AssignCommand(oTarget, ClearAllActions());
     AssignCommand(oTarget, ActionJumpToLocation(lWP));
     oTarget=GetNextFactionMember(oPC, FALSE);
     }
  }
//Encounter #8
 else if (nDestination == 8)
  {
  oWP = GetWaypointByTag("WP_WildArea2_8");
  lWP = GetLocation(oWP);
  if (GetAreaFromLocation(lWP)==OBJECT_INVALID) return;
  for (i = 1; i < (d8()+1); i++)
   {
   oEnemy = CreateObject(OBJECT_TYPE_CREATURE, "giantant", lWP, FALSE);
   }
  oTarget=GetFirstFactionMember(oPC, FALSE);
  while (GetIsObjectValid(oTarget))
     {
     AssignCommand(oTarget, ClearAllActions());
     AssignCommand(oTarget, ActionJumpToLocation(lWP));
     oTarget=GetNextFactionMember(oPC, FALSE);
     }
  }
//Encounter #9
 else if (nDestination == 9)
  {
  oWP = GetWaypointByTag("WP_WildArea2_9");
  lWP = GetLocation(oWP);
  if (GetAreaFromLocation(lWP)==OBJECT_INVALID) return;
  oEnemy = CreateObject(OBJECT_TYPE_CREATURE, "giantstone", lWP, FALSE);
  oTarget=GetFirstFactionMember(oPC, FALSE);
  while (GetIsObjectValid(oTarget))
     {
     AssignCommand(oTarget, ClearAllActions());
     AssignCommand(oTarget, ActionJumpToLocation(lWP));
     oTarget=GetNextFactionMember(oPC, FALSE);
     }
  }
//Encounter #10
 else if (nDestination == 10)
  {
  oWP = GetWaypointByTag("WP_WildArea2_10");
  lWP = GetLocation(oWP);
  if (GetAreaFromLocation(lWP)==OBJECT_INVALID) return;
  for (i = 1; i < 5; i++)
  oEnemy = CreateObject(OBJECT_TYPE_CREATURE, "horneddevil", lWP, FALSE);
  oTarget=GetFirstFactionMember(oPC, FALSE);
  while (GetIsObjectValid(oTarget))
     {
     AssignCommand(oTarget, ClearAllActions());
     AssignCommand(oTarget, ActionJumpToLocation(lWP));
     oTarget=GetNextFactionMember(oPC, FALSE);
     }
  }
//End "if" conditions
 }
//End Script
}

