GetItemPropertyType
From NWN Lexicon
Jump to navigationJump to search
GetItemPropertyType(itemproperty)
Returns the type of itemproperty a property is.
Parameters
ip
Itemproperty to get the type of.
Description
Will return the item property type.
Remarks
Returns ITEM_PROPERTY_* .
Returns -1 on error, including if ip is not a valid itemproperty.
Can be used to remove itemproperties of a certain type from an item.
Version
1.61
Example
//Remove true seeing from the entering PC's headgear
void main()
{
//Entering object
object oPC=GetEnteringObject();
//Only PCs
if (!GetIsPC(oPC)) return;
//That PC's helmet
object oItem=GetItemInSlot(INVENTORY_SLOT_HEAD, oPC);
//Stop script if the PC had no helmet on
if (!GetIsObjectValid(oItem)) return;
//Get the first itemproperty on the helmet
itemproperty ipLoop=GetFirstItemProperty(oItem);
//Loop for as long as the ipLoop variable is valid
while (GetIsItemPropertyValid(ipLoop))
{
//If ipLoop is a true seeing property, remove it
if (GetItemPropertyType(ipLoop)==ITEM_PROPERTY_TRUE_SEEING)
RemoveItemProperty(oItem, ipLoop);
//Next itemproperty on the list...
ipLoop=GetNextItemProperty(oItem);
}
SendMessageToPC(oPC, IntToString(GetItemPropertyType(ipLoop)));
}
void main()
{
//Entering object
object oPC=GetEnteringObject();
//Only PCs
if (!GetIsPC(oPC)) return;
//That PC's helmet
object oItem=GetItemInSlot(INVENTORY_SLOT_HEAD, oPC);
//Stop script if the PC had no helmet on
if (!GetIsObjectValid(oItem)) return;
//Get the first itemproperty on the helmet
itemproperty ipLoop=GetFirstItemProperty(oItem);
//Loop for as long as the ipLoop variable is valid
while (GetIsItemPropertyValid(ipLoop))
{
//If ipLoop is a true seeing property, remove it
if (GetItemPropertyType(ipLoop)==ITEM_PROPERTY_TRUE_SEEING)
RemoveItemProperty(oItem, ipLoop);
//Next itemproperty on the list...
ipLoop=GetNextItemProperty(oItem);
}
SendMessageToPC(oPC, IntToString(GetItemPropertyType(ipLoop)));
}
See Also
functions: |
author: Lilac Soul