GetItemPropertyDurationType(itemproperty)

From NWN Lexicon
Jump to navigationJump to search

Gets the duration type of an itemproperty.

int GetItemPropertyDurationType(
    itemproperty ip
);

Parameters

ip
Itemproperty to get the duration type of


Description

Will return the duration type of the item property.

Returns -1 on error, for instance if ip is not a valid itemproperty.


Remarks

Returns DURATION_TYPE_PERMANENT for permanent itemproperties, and DURATION_TYPE_TEMPORARY for temporary itemproperties.

Duration of the item property can affect if it is automatically removed - temporary ones applied from a creature who rests are then removed. Permanent ones last like any other usual toolset applied item property.


Effect Subtype overview:

Effect Subtype Duration Type Dispellable Removed by Resting if effect on self Removed by Resting if effect cast by self (on any object) Removed by Dying if effect on self
Magical Any ✓ ✓ ✓ ✓
Extraordinary Any ✖ ✓ ✖ ✓
Supernatural Temporary ✖ ✓ ✖ ✓
Supernatural Permanent ✖ ✖ ✖ ✓
Unyielding Any ✖ ✖ ✖ ✖
Item Properties Temporary ✖ ✖ ✓ ✖
Item Properties Permanent ✖ ✖ ✖ ✖


Example

//Source code for the IPRemoveAllItemProperties function in
//the x2_inc_itemprop include file

// ----------------------------------------------------------------------------
// Removes ALL item properties from oItem matching nItemPropertyDuration
// ----------------------------------------------------------------------------
void IPRemoveAllItemProperties(object oItem, int nItemPropertyDuration = DURATION_TYPE_TEMPORARY)
{
    itemproperty ip = GetFirstItemProperty(oItem);
    while (GetIsItemPropertyValid(ip))
    {
        if (GetItemPropertyDurationType(ip) == nItemPropertyDuration)
        {
            RemoveItemProperty(oItem, ip);
        }
        ip = GetNextItemProperty(oItem);
    }
}

See Also

functions: GetItemPropertyDurationRemaining(), GetItemPropertyDuration()



 author: Lilac Soul