EffectInvisibility(int)

From NWN Lexicon
Jump to: navigation, search

Create an Invisibility effect.

effect EffectInvisibility(
    int nInvisibilityType
);

Parameters

nInvisibilityType
One of the INVISIBILITY_TYPE_* constants defining the type of invisibility to use.

Description

Returns a new effect object that, when applied to a target, causes them to become invisible in one of three possible levels defined in the INVISIBILITY_TYPE_* constants group.

Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nInvisibilityType is invalid.

Normal invisibility is broken once the creature attacks or casts a hostile spell.

Darkness invisibility should only be applied when a creature is in a Darkness area-of-effect, and doesn't run out. Improved Invisibility (as par the 3E rules, but BioWare changed the spell to provide extra concealment), will not run out either, and acts as if always invisible.

Invisibility means anyone who cannot see through it (True Seeing and See Invisibility effects see though it) must hear you to attack you or know your location. Those who do attack an invisible person get a full 50% miss chance. If the invisible person attacks somebody, they get an automatic sneak-attack (if they have the feat) and +2 to their roll, because the target doesn't know about them (unless they are being attacked by that somebody).

Remarks

I am unsure if the different types of invisibility you can put in, Improve Invisibility or Normal, does actually return the different effects EFFECT_TYPE_IMPROVEDINVISIBILITY and EFFECT_TYPE_INVISIBILITY, or just EFFECT_TYPE_INVISIBILITY.

The mechanics are internal, however, and work pretty well (even hearing them if you get close enough or have enough listen skill). However, default monster AI isn't good enough to listen, and so invisibility for the most part is as good as Etherealness if the people do not have EffectSeeInvisible() or EffectTrueSeeing() applied to them or their hide.

Any normal invisibility is lost when attacking. Any effect linked to the invisibility effect using EffectLinkEffects() will be removed as well. This is the same behavior as if RemoveEffect() was used to remove invisibility.

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.

Version

1.62

Example

// Sample code for applying invisibility to a target
 
void main()
{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;
 
    // Create the effect to apply
    effect eInvisibility = EffectInvisibility(INVISIBILITY_TYPE_NORMAL);
 
    // Create the visual portion of the effect. This is instantly
    // applied and not dependent on whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_AC_BONUS);
 
    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
 
    // Apply the effect to the object   
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eInvisibility, oTarget);
}

See Also

constants:  INVISIBILITY_TYPE_* Constants


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