AddItemProperty(int, itemproperty, object, float)
Add an itemproperty to an item
void AddItemProperty( int nDurationType, itemproperty ipProperty, object oItem, float fDuration = 0.0f );
Parameters
nDurationType
ipProperty
Itemproperty to add.
oItem
Item to add the property to.
fDuration
Duration (if added temporarily). (Default: 0.0f)
Description
Adds an item property to the specified item.
Only temporary and permanent duration types are allowed.
Remarks
The itemproperty must first be created using one of the many ItemProperty functions. In this respect, it works much like effects, which must first be created, then applied.
It will often be a good idea to remove similar itemproperties from the item first. There's a command in the "x2_inc_itemprop" include file called IPSafeAddItemProperty which will do that for you.
Version
1.61
Example
//Have the NPC upgrade the PC speaker's helmet to a //HELMET OF UNDEAD TURNING void main() { object oPC=GetPCSpeaker(); object oHelmet=GetItemInSlot(INVENTORY_SLOT_HEAD, oPC); if (!GetIsObjectValid(oHelmet)) return; itemproperty ipAddFeat=ItemPropertyBonusFeat(FEAT_TURN_UNDEAD); AddItemProperty(DURATION_TYPE_PERMANENT, ipAddFeat, oHelmet); }
See Also
functions: | IPSafeAddItemProperty |
categories: | Item Creation Functions |
constants: | DURATION_TYPE_* Constants |
author: Lilac Soul, editor: Charles Feduke