void main()
{
    object oExiting = GetExitingObject();
    if ((!(GetLocalInt(OBJECT_SELF, "nTriggered"))) && (GetLocalInt(GetModule(), "nTookBeetleQuest") == 1))
    {
        if (GetIsPC(oExiting))
        {
            int nEncSpawned = GetLocalInt(GetModule(), "nBeetleEncountersSpawned");
            SetLocalInt(GetModule(), "nBeetleEncountersSpawned", nEncSpawned + 1);
            //DEBUG SendMessageToPC(GetFirstPC(), "Beetle Encounters spawned: " + IntToString(nEncSpawned + 1));
            SetLocalInt(OBJECT_SELF, "nTriggered", 1);
        }
    }
}
