Disalbe all encounters in an area......i've found a function able to do this work.
My goal is to disable ALL the encounters present in an area when certain conditions occur.
void DisableEncountersInArea(object oArea)
{
object oEncounter = GetFirstInPersistentObject(oArea, OBJECT_TYPE_ENCOUNTER);
while (GetIsObjectValid(oEncounter))
{
SetEncounterActive(TRUE, oEncounter);
oEncounter = GetNextInPersistentObject(oArea, OBJECT_TYPE_ENCOUNTER);
}
}
//here my code:
void main()
{
if (GetIsPC(GetEnteringObject()))
{
object area = GetArea(OBJECT_SELF);
DisableEncountersInArea(area);
}
}
(Like Lexicon suggest, the encounter is set to single shoot)
i put that script on enter of a generic trigger ,but didn't work.
Then,i tried with OnEnter of an area,but also this attempt was a failure.
so I tried to change a bit:
void main()
{
object oPC = GetEnteringObject();
object area = GetArea(oPC);
DisableEncountersInArea(area);
}
but it does not work the same. The encounters were still disabled.
I know there are other methods to activate-disable encounters,but i was pretty sure that the function is correct .Where i'm wrong?





Retour en haut







