void main() { object oPC=GetEnteringObject(); if ((!GetIsPC(oPC))&&(!GetIsPC(GetMaster(oPC)))) { return; } int nCurrentMinute = (GetCalendarYear()-1)*12*28*24 + (GetCalendarMonth()-1)*28*24 + (GetCalendarDay()-1)*24 + GetTimeHour(); int nLastSpawnMinute = GetLocalInt(OBJECT_SELF,"LAST_SPAWN_MINUTE"); // spawn delay is in real time minutes for some reason int nSpawnDelay = 0; if (nCurrentMinute > (nLastSpawnMinute + nSpawnDelay)) { SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",0); } //return if time has not passed yet if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0) { //SendMessageToAllDMs("Timer not yet done "+IntToString(nLastSpawnMinute)+" "+IntToString(nCurrentMinute)); return; } string sCounter; int nIdx; object oMob; int nMobsexist=0; string sMob="sMob"; string sCheckstring; int nRandom; string sMobtype; int nMobnumber; // every trigger has a spawnpoint which is its own tag plus _SP object oSpawnpoint=GetWaypointByTag(GetTag(OBJECT_SELF)+"_SP"); location lLoc=GetLocation(oSpawnpoint); int nNumber=GetLocalInt(OBJECT_SELF,"nNumber"); // nNumber is the number of mobs spawned last time; // if this is not the first time we have done it, check if any of our mobs are there if (nNumber>0) { // start counting through the mobs for (nIdx=1; nIdx<=nNumber; nIdx++) { sCheckstring=sMob+IntToString(nIdx); // cycle through the local objects if (GetIsObjectValid(GetLocalObject(OBJECT_SELF,sCheckstring))) { // if one is valid, set nMobsexist to 1 nMobsexist=1; } } // if any of the old mobs still exist, return if (nMobsexist==1) { // reset the counter, as players have entered the area while mobs are still present, and return SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1); SetLocalInt(OBJECT_SELF,"LAST_SPAWN_MINUTE",nCurrentMinute); //SendMessageToAllDMs("I have a mob already"); return; } } // a player has entered, no existing mobs exist and the timer is not yet complete. Therefore, make mobs. // choose what type of mob to create nRandom=Random(6); switch (nRandom) { case 0: sMobtype="jw_jaghi"; nMobnumber=2; break; case 1: sMobtype="jw_nightmare"; nMobnumber=1; break; case 2: sMobtype="jw_rat_shamble"; nMobnumber=3; break; case 3: sMobtype="jw_crawl_claw"; nMobnumber=2; break; case 4: sMobtype="jw_jaghi"; nMobnumber=1; break; case 5: sMobtype="jw_rat_shamble"; nMobnumber=3; break; } /// set the number of mobs we are making SetLocalInt(OBJECT_SELF,"nNumber",nMobnumber); //SendMessageToAllDMs("Making my mobs now"); // start making the mobs for (nIdx=1; nIdx<=nMobnumber; nIdx++) { // create the mob oMob=CreateObject(OBJECT_TYPE_CREATURE,sMobtype,lLoc,FALSE); // make the mob act like an encounter creature SetLocalInt(oMob,"norw",2); // make the mob our new local object sCheckstring=sMob+IntToString(nIdx); SetLocalObject(OBJECT_SELF,sCheckstring,oMob); } //set the time SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1); SetLocalInt(OBJECT_SELF,"LAST_SPAWN_MINUTE",nCurrentMinute); // that is it }