From NWN Lexicon
Jump to: navigation, search
Nwnee logo.jpg Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.
Returns the remaining duration of the effect in seconds.
int GetEffectDurationRemaining(
    effect eEffect


The effect object to get the remaining duration of.


Returns the remaining duration of the effect in seconds. Returns 0 if the duration type of the effect is not DURATION_TYPE_TEMPORARY.


You can compare this to GetEffectDuration to see how long the effect was instantiated as, thus make a comparison that is for instance half over.

While not advisable, you run a check constantly (eg; in a heartbeat) that could use this to say a spell is ending soon.


This function was added in 1.74.8149 of NWN:EE.

This function was updated in 1.85.8193.30 of NWN:EE. Game/VM: Fixed Get*DurationRemaining returning the wrong value due to time overflow.


// Look and see if SPELL_STONESKIN is past half it's remaining time on OBJECT_SELF
void main()
    int nEffectDuration, nEffectDurationRemaining, nSpellID;
    object oCreator;
    // Report on all effects
    effect eEffect = GetFirstEffect(OBJECT_SELF);    
        // Stoneskin lasts 1 hour/level
        if(GetEffectSpellId(eEffect) == SPELL_STONESKIN)
            nEffectDuration = GetEffectDuration(eEffect);
            nEffectDurationRemaining = GetEffectDurationRemaining(eEffect);
            if(nEffectDurationRemaining < nEffectDuration / 2)
                SpeakString("Stoneskin is at least half depleted in duration");
        // Get next effect
        eEffect = GetNextEffect(OBJECT_SELF);

See Also

functions: GetEffectDuration(), GetEffectDurationType(), GetEffectCasterLevel()