EffectAttackDecrease(int, int)

From NWN Lexicon
Jump to: navigation, search

Create an Attack Decrease effect.

int EffectAttackDecrease(
    int nPenalty,




Returns a new effect object that when applied to a creature, will decrease their attack bonus in their main hand, off hand or both hands by a certain amount.

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.

The limit of nValue is unknown.


Attack Decreases do stack, and so you can get negative to hits even if you have a normally positive base attack bonus.

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.




// Sample code for applying 5 attack penalty to a target
void main()
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;
    // Create the effect to apply
    effect eAttackDecrease = EffectAttackDecrease(5);
    // 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, eAttackDecrease, oTarget);

See Also

functions:  EffectModifyAttacks
constants:  ATTACK_BONUS_* Constants

 author: John Shuell, editor: Jasperre, additional contributor(s): Jasperre