void SetAreaSpawning(object oArea, int bSpawning) // pass true or false to bSpawning
{
object oEnc = GetFirstObjectInArea(oArea);
while(oEnc != OBJECT_INVALID)
{
if(GetObjectType(oEnc) == OBJECT_TYPE_ENCOUNTER) SetEncounterActive(bSpawning, oEnc);
oEnc = GetNextObjectInArea(oArea);
}
}
The function is generic, thus it could be called from anywhere provided that the correct parameters are passed, and it also assumes that the check to see if user is a DM is performed in the client code.
Note: If your triggers follow a tagging convention you could alternatively retrieve them with GetObjectByTag() for better efficiency(i.e. ENC_ + <Area tag> for instance).
Kato
Modifié par Kato_Yang, 13 septembre 2012 - 03:29 .