ItemPropertyACBonusVsDmgType(int, int)

Sets an "armor class bonus against damage type" itemproperty.

itemproperty ItemPropertyACBonusVsDmgType(
    int nDamageType,
    int nACBonus
);

Parameters

nDamageType

IP_CONST_DAMAGETYPE_*

nACBonus

AC bonus to add; 1 to 20 are valid


Description

Sets item property AC bonus vs. damage type (ie. piercing). You need to specify the damage type constant (IP_CONST_DAMAGETYPE_*) and the AC bonus.

Only the first 3 damage types may be used here: BLUDGEONING, PIERCING or SLASHING. The AC bonus should be an integer between 1 and 20.

The type of AC bonus depends on the type of the item. Thanks to Nailog for providing this information:

Items that gain a Deflection bonus: Creature Skins, staves, rings, melee weapons, helmets, cloaks, belts, gloves, and ranged weapons that use ammunition.

Items that gain an Armor bonus: Armors and bracers.

Items that gain a Natural Armor bonus: Amulets.

Items that gain a Shield bonus: Shields.

Items that gain a Dodge bonus: Boots.



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 itemproperties 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_DAMAGETYPE_* constant can be retrieved off this type of item property using GetItemPropertySubType. The bonus can be retrieved using GetItemPropertCostTableValue.


Version

1.62

Example

//#include "x2_inc_itemprop"
//The include is for the IPSafeAddItemProperty function

//Gives the PC speaker's armor a +15 AC bonus against slashing damage
void main()
{
object oPC=GetPCSpeaker();
object oItem=GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
if (!GetIsObjectValid(oItem)) return;

itemproperty ipAdd=ItemPropertyACBonusVsDmgType(IP_CONST_DAMAGETYPE_SLASHING, 15);

//IPSafeAddItemProperty(oItem, ipAdd); //This is preferred; needs the #include
AddItemProperty(DURATION_TYPE_PERMANENT, ipAdd, oItem); //Alternate example
}

See Also

functions: AddItemProperty | IPSafeAddItemProperty
categories: Item Creation Functions
constants: IP_CONST_DAMAGETYPE_* Constants


 author: Lilac Soul, editor: Peter Busby, additional contributor(s): Nailog