EffectModifyAttacks(int)

From NWN Lexicon
Jump to: navigation, search

Create a Modify Attacks effect that modifies the amount of attacks a creature can perform.

effect EffectModifyAttacks(
    int nAttacks
);

Parameters

nAttacks
The number of effects to add to the target. Maximum is 5, even with the effect stacked.

Description

Returns a new effect object that when applied to a target will add attacks.

Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nAttacks > 5, however it can be negative (to remove attacks).

As the limit to nAttacks is 5, it is wise to think that multiple effects will limit bonus attacks to 5, even if 2 EffectModifyAttacks(3); are applied to the same creature.

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.

If you want to actually set the amount of attacks on a creature, use SetBaseAttackBonus(). It isn't an effect, it is almost permanent. The use of RestoreBaseAttackBonus() will not remove this effect or alter it.


Remarks

An extra attack doesn't change spell casting times (as EffectHaste does).

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.

Effect Breakdown

The extra attacks are not listed on the character sheet and an effect icon doesn't appear.

This effect is very powerful and seem to create an entirely new base attack bonus progression starting from the current highest attack the creature has which is not used correctly in the spell Divine Power at all.

From some testing this appears to happen in NWN:EE. Let's assume a creature with a current attack bonus of +34, and 3 attacks (so +34, +29 and +24). NWN divides the rounds into three "flurries", so "flurry 1, flurry 2, flurry 3" although the order of attacks in the combat log for each flurry may be mixed up and not highest to lowest.

  • No bonus attacks = Attacks: 34, 29, 24
  • EffectModifyAttacks(1) = Attacks: 34/29, 24, 34 - So is 34/29/24 and 34
  • EffectModifyAttacks(2) = Attacks: 34/29, 24/34, 29 - So is 34/29/24 and 34/29
  • EffectModifyAttacks(3) = Attacks: 29/34, 34/24, 24/29 - So is 34/29/24 and 34/29/24
  • EffectModifyAttacks(4) = Attacks: 24/29/34, 29/34, 24/19 - So is 32/29/24 and 34/29/24/19
  • EffectModifyAttacks(5) = Attacks: 24/29/34, 24/29/34, 19/14 - So is a total run of 34/29/24 and 34/29/24/19/14

So yeah it's pretty broken!

This will affect the default spells Tensers Transformation (adds 2 attacks) and Divine Power (adds a variable number of attacks).

Note you can also reduce the number of extra attacks, and even the amount of normal attacks, using negatives in the parameter. For instance with 2 attacks you'd go down to 1 attack if EffectModifyAttacks(-1) is applied to you as the sole effect. The minimum number of attacks per round is 1. This could be useful to do a sort-EffectSlow effect. You can have any amount of negative attacks, eg: EffectModifyAttacks(-10) is valid, and it will simply alter the number of bonus attacks when these effects are applied and removed.

Note there is a bug around this (of course there is!) where if you apply say +5 increases, then apply a decrease, it will decrease it from the maximum 5 not from the total. EG:

  • EffectModifyAttacks(5)
  • EffectModifyAttacks(5)
  • EffectModifyAttacks(-5)

The total will be 0 bonus attacks, not (10 - 5) = 5 bonus attacks. Removing a bonus attack effect will recalculate it properly (so applying a one that adds 0, then removing it, will recalculate properly).

The additional attacks are distinct from the bonus ones applied via. FEAT_FLURRY_OF_BLOWS or FEAT_RAPID_SHOT, and the bonus attack from EffectHaste, which apply to the tail end of your normal attacks.

Unlike many other effects no effect icon appears for this effect (possibly since there is no positive and negative version?).

nIndex Parameter Value Description and Notes
GetEffectInteger
0 nAttacks The amount of attacks to add or remove. Positive adds them, negative removes them. The maximum positive amount is 5 in any one effect.

Known Bugs

The effect returns EFFECT_TYPE_INVALIDEFFECT when you use GetEffectType.

Using a negative value works fine, except if you're already set to use more than the maximum bonus attacks, as per the above example.

Version

1.62

Example

// Sample code for applying 2 extra attacks to a target
 
void main()
{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;
 
    // Create the effect to apply
    effect eAttacks = EffectModifyAttacks(2);
 
    // 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_IMPROVE_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, eAttacks, oTarget);
}

See Also

functions:  SetBaseAttackBonus
constants:  EFFECT_TYPE_* Constants


 author: John Shuell, editors: Jasperre, Mistress, additional contributor: Jasperre