#include "x2_inc_switches"
void main()
{
int nEvent = GetUserDefinedItemEventNumber();
if(nEvent != X2_ITEM_EVENT_ACTIVATE) return;
object oPC = GetItemActivator();
object oItem = GetItemActivated();
object oTarget = GetItemActivatedTarget();
// Create the effect to apply
effect eSaveInc = EffectSavingThrowIncrease(SAVING_THROW_TYPE_ALL, 1);
// Create the visual portion of the effect. This is instantly
// applied and not persistant with wether or not we have the
// above effect.
effect eVis = EffectVisualEffect(VFX_IMP_HEAD_HOLY);
// Get the first PC party member
object oPartyMember = GetFirstFactionMember(oPC, TRUE);
// We stop when there are no more valid PC's in the party.
while(GetIsObjectValid(oPartyMember) == TRUE)
{
// Get the distance, and check it
if(GetDistanceBetween(oPC, oPartyMember) <= 10.0)
{
// Apply the visual effect to the target and the save increase
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPartyMember);
ApplyEffectToObject(ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSaveInc, oPartyMember, TurnsToSeconds(3));
}
// Get the next PC member of oPC's faction.
// If we put anything but oPC into this, it may be a totally
// unreliable loop!
oPartyMember = GetNextFactionMember(oPC, TRUE);
}
}