The function seems to return -1 on encounters with unlimited spawn. That are the ones I want to catch. This clue is not in the lexicon.
Setting it to 0 seems to prevent, that the encounter is activated again after the given time.
However, automatic reactivating an unlimited encounter after timeout obviously happens only once. If it is active again, you can set it to inactive and it will stay inactive (another clue wich should go to the lexicon).
The following script (triggered by an item with unique power) sets the “EncounterSpawnsMax” to 0 if it is -1, this should stop the unlimited respawn. The active flag isn’t touched, so the encounter is triggered at least once.
// warning: there is a small risk to create plotbreaking issues by deactivating encounters.
int nEvent = GetLocalInt(OBJECT_SELF, "X2_L_LAST_ITEM_EVENT");
if (nEvent != 0) return;
object oPC = GetItemActivator();
object a = GetArea(oPC);
SendMessageToPC (oPC, "Looking for encounters");
object o = GetFirstObjectInArea(a);
if (GetObjectType (o) == OBJECT_TYPE_ENCOUNTER)
SendMessageToPC (oPC, "Found " + GetName(o) + " " + IntToString(GetEncounterActive(o)));
i = GetEncounterSpawnsMax(o);
if (i == -1)
SendMessageToPC (oPC, "Deactivated " + GetName(o));
o = GetNextObjectInArea(a);