First I used the OnEnter script of the AreaOfEffect, then I tried GetFirst/Next Object in Shape.
But the fact is that the AreaOfEffects (I meant to use it like an aura, such as Aura of courage) scripts are not running very well, the Area does not seem to move with my characters at all (as it should since it’s applied via EffectAreaofEffect), also, heartbeats are not running at atll, I know because the first part of the heartbeat area script was to send a message that the heartbeat was running and I never saw it once.
The way I applied the effect was (and it worked as the aura icon appeared):
if (GetHasSpellEffect(FX_ENCFIX, oPC) == TRUE)
{
RemoveEffectsFromSpell(oPC, FX_ENCFIX);
FloatingTextStringOnCreature("*Encounter fix turned OFF*", oPC, FALSE);
}
else
{
effect eFX = EffectAreaOfEffect(AOE_PER_CUSTOM_AOE, "", "enc_fix_apply");
eFX = SupernaturalEffect(eFX);
eFX = SetEffectSpellId(eFX, FX_ENCFIX);
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eFX, oPC));
FloatingTextStringOnCreature("*Encounter fix turned ON*", oPC, FALSE);
}
then, the script I tried on Heartbeat was:
void main()
{
object oPC = GetFirstPC();
SendMessageToPC(oPC, "Heartbeat running");
location lAREA = GetLocation(OBJECT_SELF);
object oENC = GetFirstObjectInShape(SHAPE_SPHERE, 2.0, lAREA, FALSE);
while (oENC != OBJECT_INVALID)
{
SendMessageToPC(oPC, GetName(oENC));
oENC = GetNextObjectInShape(SHAPE_SPHERE, 2.0, lAREA, FALSE);
}
}
The second code was just to test the heartbeat script (if it was working at all), it was not meant to fix encounters yet. It didn’t even detect the PC with the aura itself.