Random roaming monsters

What It Does
Random mosnterspawns in the area that has the script(and only in that area). This is a modification of a script i found here...this lets you set different monsterspawns for different areas.

The Script, part 1
//Area on Enter void main { int gotime=0; }

The Script, part 2
//Area on Heartbeat void RandomMonster(object oTarget) {   object oTarget = GetFirstPC; object oArea = GetArea(oTarget); if (oArea == OBJECT_SELF) {               if (d6==6) {               int iDirection=d4; float fX; float fY; switch(iDirection) {                   case 1: fX=0.0; fY=15.0; break; case 2: fX=15.0; fY=0.0; break; case 3: fX=0.0; fY=-15.0; break; case 4: fX=-15.0; fY=0.0; break; }               vector vStart = GetPosition(GetFirstPC); vector vOffset = Vector(fX,fY); vector vEndvector=vStart+vOffset; location lEnd=Location(GetArea(GetFirstPC),vEndvector,GetFacing(GetFirstPC)); int iEncRoll = d6; int iEncNumber; int iEncCount = 1; switch(iEncRoll) {                  case 1: iEncNumber=d8; while (iEncCount<=iEncNumber) {                       CreateObject(OBJECT_TYPE_CREATURE,"random_zombie",lEnd); iEncCount++; };                      break; case 2: iEncNumber=d6; while (iEncCount<=iEncNumber) {                       CreateObject(OBJECT_TYPE_CREATURE,"random_orc",lEnd); iEncCount++; };                      break; case 3: iEncNumber=1; while (iEncCount<=iEncNumber) {                       CreateObject(OBJECT_TYPE_CREATURE,"random_spider",lEnd); iEncCount++; };                      break; case 4: iEncNumber=d12; while (iEncCount<=iEncNumber) {                       CreateObject(OBJECT_TYPE_CREATURE,"random_stirge",lEnd); iEncCount++; };                      break; case 5: iEncNumber=d2; while (iEncCount<=iEncNumber) {                       CreateObject(OBJECT_TYPE_CREATURE,"random_bugbear",lEnd); iEncCount++; };                      break; case 6: iEncNumber=d4; while (iEncCount<=iEncNumber) {                       CreateObject(OBJECT_TYPE_CREATURE,"random_bandit",lEnd); iEncCount++; };                      break; }              } } } void main {   object oTarget = GetFirstPC; int monstertime=GetLocalInt(OBJECT_SELF, "gotime") ; if (monstertime < 100) {   //SendMessageToPC(oTarget, "Nothing yet"); //SendMessageToPC(oTarget,IntToString(monstertime) ); monstertime++; SetLocalInt(OBJECT_SELF, "gotime", monstertime); }   else if (monstertime >99) {   //SendMessageToPC(oTarget, "Here they come"); //SendMessageToPC(oTarget,IntToString(monstertime) ); RandomMonster(oTarget); monstertime=0; SetLocalInt(OBJECT_SELF, "gotime", monstertime); } }