// Random Shadow Teleport


void main()
{
  object oPC=GetEnteringObject();
  object oWP=GetWaypointByTag("SR_JUMP_"+IntToString(d6()));
  int nCount=GetLocalInt(oPC,"nShadowJump");
  int nMax=GetLocalInt(GetModule(),"nMaxShadowJumps");
  if (nMax==0) nMax=10;
  nMax=nMax-1;
  if (nCount>nMax)
  {
    nCount=0;
    oWP=GetWaypointByTag("SR_JUMP_6");
  }
  else
    nCount++;
  SetLocalInt(oPC,"nShadowJump",nCount);
  AssignCommand(oPC,ClearAllActions());
  AssignCommand(oPC,JumpToObject(oWP));
}