I have this script temporarily set up on a switch. Two NPCs are in range of the it, one has the feat Fearless, the other does not. I pulled the MySavingThrow function out of a dragon fear script, and from the comments say it should:
// Returns: 0 if the saving throw roll failed
// Returns: 1 if the saving throw roll succeeded
// Returns: 2 if the target was immune to the save type specified
Shouldn't the Fearless feat cause it to return 2? Right now when I run it, both NPCs are able to be affected by the fear if they fail the will save. Thanks for any advise anyone has.
'>
---------------------------------
#include "X0_I0_SPELLS"
#include "x2_inc_spellhook"
void main()
{
object oUser = GetLastUsedBy();
effect eFear = EffectFrightened();
effect eMind = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_FEAR);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
effect eLink = EffectLinkEffects(eFear, eMind);
eLink = EffectLinkEffects(eLink, eDur);
float fDelay;
int nclass = GetLevelByclass(class_TYPE_FIGHTER, oUser);
int nCharisma = GetAbilityModifier(ABILITY_CHARISMA, oUser);
int nDC = 10 + nclass + nCharisma;
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, GetLocation(oUser));
while (GetIsObjectValid(oTarget)) {
if (oTarget == oUser) {
} else {
fDelay = GetRandomDelay();
if (!MySavingThrow(SAVING_THROW_WILL, oTarget, nDC, SAVING_THROW_TYPE_FEAR, oUser, fDelay)) {
fDelay = GetRandomDelay();
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, 10.0));
}
}
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, GetLocation(oUser));
}
}