EffectACDecrease(int, int, int)

From NWN Lexicon
Jump to: navigation, search

Creates an AC decrease effect.

effect EffectACDecrease(
    int nValue,




Effect sets to remove the specified amount of bonus from an object. The type of AC removed is of nModifyType.

The target this effect is applied to must be a creature for it to work. This effect should not be applied instantly, only temporarily or permanently.

Placeables and Doors have no AC, and the attack rolls are only for getting a 1 (Natural Miss, somehow) and a 20 (Natural hit) or a Critical Hit.

Certain AC bonuses can help against certain attacks, and dodge bonuses always stack. Touch attacks are a good example of where, for example, Armor AC bonuses do not apply. It also helps because different items give different types of AC bonuses.

The limit of nValue is unknown.


Default value for nDamageType should only ever be used in this function prototype.

AC decreases do stack, and the type to decrease will, as it were, decrease the armor of that type until it is 0. All this means is that if you specify 10 penalty to Natural AC, yet they have only a amulet of +2 Natural AC, it still does a 10 AC penalty, and the +2 Natural AC doesn't apply to, say, touch attacks.

If the above comment is wrong, it will be best to use Dodge Bonus to accurately decrease by nValue, as Dodge is always a present value (in the form of Dexterity bonuses).

Effect functions are Constructors, which are special methods that help construct effect "objects". You can declare and link effects, and apply them using an ApplyEffectToObject() Command. Once applied, each effect can be got separately via. looping valid effects on the target (GetFirst/NextEffect()). See the Effect tutorial for more details.




// Apply a penalty of 5 Dodge AC to the target. This should just
// lower their AC by 5.
void main()
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;
    // Create the effect to apply
    effect eDodgePenalty = EffectACDecrease(5, AC_DODGE_BONUS);
    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);
    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object   
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDodgePenalty, oTarget);

See Also

functions:  EffectAttackIncrease
constants:  DAMAGE_TYPE_* Constants

 author: Jody Fletcher, editor: Jasperre, additional contributor(s): Jasperre