//This heartbeat spawns slimes in the sewers void Spawn() { int nWP = Random(16)+1; string sWP = "SEWERS_SP_"+IntToString(nWP); object oWP = GetWaypointByTag(sWP); object oObject = GetFirstObjectInShape(SHAPE_SPHERE, 10.0, GetLocation(oWP)); if (GetIsObjectValid(oObject)) return; //we don't want to spawn anything if there are creature very nearby - this is to prevent creature stacks and mobs spawning at PC's location string sTemplate = "anc_jelly"; object oCreature = CreateObject(OBJECT_TYPE_CREATURE, sTemplate, GetLocation(oWP), TRUE); SetLocalInt(oCreature, "SEWERMOB", TRUE); } void main() { object oObject = GetFirstObjectInArea(OBJECT_SELF); int nCounter = 0; int nBoss = FALSE; object oWP; object oCreature; while (GetIsObjectValid(oObject)) { if (GetLocalInt(oObject, "SEWERMOB") == TRUE) nCounter++; if (GetTag(oObject) == "anc_gelcube") nBoss = TRUE; oObject = GetNextObjectInArea(OBJECT_SELF); } if (nBoss == FALSE) //no cube, we should spawn it if no player is near its spawn { oWP = GetWaypointByTag("SEWERS_SP_GC"); oObject = GetFirstObjectInShape(SHAPE_SPHERE, 10.0, GetLocation(oWP)); if (!GetIsObjectValid(oObject)) oCreature = CreateObject(OBJECT_TYPE_CREATURE, "anc_gelcube", GetLocation(oWP), TRUE); } if (nCounter < 10) //we should spawn something new { int nWP = Random(16)+1; string sWP = "SEWERS_SP_"+IntToString(nWP); oWP = GetWaypointByTag(sWP); oObject = GetFirstObjectInShape(SHAPE_SPHERE, 10.0, GetLocation(oWP)); if (GetIsObjectValid(oObject)) return; //we don't want to spawn anything if there are creatures very nearby - this is to prevent creature stacks and mobs spawning at PC's location string sTemplate = "anc_jelly"; oCreature = CreateObject(OBJECT_TYPE_CREATURE, sTemplate, GetLocation(oWP), TRUE); SetLocalInt(oCreature, "SEWERMOB", TRUE); AssignCommand(oCreature, ClearAllActions()); AssignCommand(oCreature, ActionRandomWalk()); } }