#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();
// ...insert code here...
// Get the distance, and check it
if(GetDistanceBetween(oPC, oPartyMember) <= 10.0)
// We alway use the SAME object for the GetFirst/Next faction
// member calls - always define it first. Here it is the first PC.
// 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)
// Do something to party member
// This is the Object to apply the effect to.
object oTarget = oPartyMember;
// 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);
// Apply the visual effect to the target;
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPartyMember);
// Apply the effect to the object
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);
}
}