ItemPropertyArcaneSpellFailure(int)
Sets an itemproperty which modifies an arcane spell failure factor.
Parameters
- nModLevel
- The level of Arcane Spell Failure to apply - can be a IP_CONST_ARCANE_SPELL_FAILURE_* constant or line ID from iprp_arcspell.2da
Description
Creates an item property which can be applied to an item to change the effect on arcane spell casting that item has; the default modifier can range from a 50% decrease to a 50% increase in failure, in 5% steps. Parameters come from the IP_CONST_ARCANE_SPELL_FAILURE_* group.
Remarks
The itemproperty commands are special constructors - they construct an itemproperty "object" which can then be applied to an item using the AddItemProperty command, much like effects need to be first constructed, then applied with ApplyEffectToObject.
It will often be a good idea to remove similar item properties from the item first. There's a command in the "x2_inc_itemprop" include file called IPSafeAddItemProperty which will do that for you. Check IPSafeAddItemProperty for current bug report.
The IP_CONST_ARCANE_SPELL_FAILURE_* value can be retrieved off this type of item property using GetItemPropertyCostTableValue.
To use ItemPropertyCustom it would be: ItemPropertyCustom(ITEM_PROPERTY_ARCANE_SPELL_FAILURE, -1, IP_CONST_ARCANE_SPELL_FAILURE_*);
Example
//The include is for the IPSafeAddItemProperty function
//Makes the activating PC's armor less prone to cause arcane spell failure
void main()
{
object oPC = GetItemActivator();
if (!GetIsPC(oPC)) return; // stop if not a PC
object oItem = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
if (!GetIsObjectValid(oItem)) return; // stop if not armor/clothing
int nModLevel = IP_CONST_ARCANE_SPELL_FAILURE_MINUS_25_PERCENT;
itemproperty ipAdd = ItemPropertyArcaneSpellFailure(nModLevel);
IPSafeAddItemProperty(oItem, ipAdd);
}
See Also
functions: | |
constants: |
author: Lilac Soul, editor: Peter Busby