void main() { int nCounter=GetLocalInt(OBJECT_SELF,"nCounter"); vector Vec; string sString; location lLocation; int nCount=3; int nIdx; string sMob="sMob"; string sCheckstring; object oMob; if (nCounter==1) // count 1 { for (nIdx=1;nIdx<=nCount;nIdx++) { if (d2()==1) { sString="jw_elf_ghost"; } else { sString="jw_elf_ghostf"; } Vec=Vector(IntToFloat(Random(40))-20.0,IntToFloat(Random(40))-20.0,IntToFloat(Random(10))-10.0); lLocation=Location(GetArea(OBJECT_SELF),GetPosition(OBJECT_SELF)-Vec,1.0); oMob=CreateObject(OBJECT_TYPE_CREATURE,sString,lLocation); sCheckstring=sMob+IntToString(nIdx); SetLocalObject(OBJECT_SELF,sCheckstring,oMob); } } // end count 1 else if (nCounter==2) // count 2 { for (nIdx=1;nIdx<=nCount;nIdx++) { sCheckstring=sMob+IntToString(nIdx); oMob=GetLocalObject(OBJECT_SELF,sCheckstring); if (GetIsObjectValid(oMob)) { SetPlotFlag(oMob,FALSE); DestroyObject(oMob); } } } // end count 2 nCounter=nCounter+1; if (nCounter>3) { nCounter=0; } SetLocalInt(OBJECT_SELF,"nCounter",nCounter); }