From NWN Lexicon
Jump to: navigation, search

Create a Temporary Hitpoints effect that raises the Hitpoints of the target.

effect EffectTemporaryHitpoints(
    int nHitPoints


A positive integer


Returns a new effect object that when applied to a target will temporarily increase their total Hit Points allowable.

Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nHitPoints < 0.

The limit of nHitPoints is unknown however the limit for Hit Points in general is 32,767. Going over this wraps around to -32,767 so be careful using ridiculous numbers (eg; to make a boss temporarily invincible unless the effect is dispelled).

This effect should not be applied instantly, only temporarily or permanently.

This effect can be applied only on a creatures.


Temporary hit points are un-healable "extra" hit points that will be removed first, before actual damage is done to the target. If the target is already damaged, then the temporary hit points seem to partially heal them - of course, they will get removed as the effect normally would.

They definetly do stack, and was one of the first spell-fixes to spells like Vampiric touch. Should the effect be dispelled/removed, and it take you under your current hit points, then you should die.

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.

Removing this effect is not instant and current hit points of a target remains the same. To workaround this, a delay is needed to check current hit points again or apply the effect to the target again since applying this effect is instant and current hit points will change in the same fashion.

Known bugs

If the creator of this effect is not a creature, OBJECT_INVALID is set as a creator instead.




// Sample code for applying 5 temporary hit points to a target
void main()
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;
    // Create the effect to apply
    effect eHP = EffectTemporaryHitpoints(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_HOLY_AID);
    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object   
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eHP, oTarget);

See Also


EFFECT_TYPE_* Constants

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