Thayan, most of these encounters are spawning creatures with no OnSpawn script. OnSpawn is a good way to go generally, though I was hoping in this case avoid adding OnSpawns to all the encounter creatures and then to tailor the buffing to the encounter difficulty, as returned by
GetEncounterDifficulty()
.
Lightfoot8, setting a "buffed" local on each spawn was my plan to avoid rebuffs. By "OnAreaEnter event", do you mean use the
area's OnEnter
event or the
OnEnter
event for the
encounter? I was assuming using the encounter's
OnEnter
event to trigger my script to find the encounter creatures, then buff and
SetLocalInt
them as buffed in case they're still around the next time an encounter is triggered.
But, I am still not clear how to avoid something like the following
void main()
{
object oPC = GetEnteringObject();
int NumPCs = CountPCsInArea(oPC); // counts area faction members
int GameDiff = GetGameDifficulty();
// THIS cycles through every object in the area!
object oCreature = GetFirstObjectInArea();
while (GetIsObjectValid(oCreature))
{
if ( ( GetIsEncounterCreature(oCreature) ) && (GetLocalInt(oCreature,"encounter_buffed")==0) )
{
// buff appropriate for creature type, party size,
// difficulty, etc., then set local
BuffCreature(oCreature,NumPCs,GameDiff);
}
oCreature = GetNextObjectInArea();
}
}
I'm new to this, so I'm probably missing your suggestion, but I still see looping over every object in the area whenever an encounter is triggered.
[EDIT] Sorry for the sloppy post. I don't know how to do a decent code post on these boards.
Modifié par MrZork, 19 mai 2011 - 10:05 .