ItemPropertyDecreaseAbility
Contents |
[edit] ItemPropertyDecreaseAbility(int, int)
Sets a decrease ability itemproperty.
itemproperty ItemPropertyDecreaseAbility( int nAbility, int nModifier );
[edit] Parameters
nAbility
nModifier
Amount to decrease by; 1 to 50 are valid.
[edit] Description
Sets item property Decrease ability score. You must specify the ability constant (IP_CONST_ABILITY_*), such as Charisma or Wisdom, and the modifier constant. The modifier must be a POSITIVE integer between 1 and 50, by which the ability score is reduced.
[edit] Remarks
The modifier limit is driven by iprp_neg10cost.2da and can be extended to higher values by editing this file. Keep in mind that minimum ability score of a creature is 3 and there is no way to go below no matter how high decreases character has.
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.
Same itemproperties on the same item doesn't stack, onlz highest will apply, so 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_ABILITY_* constant can be retrieved off this type of item property using GetItemPropertySubType. The modifier can be retrieved using GetItemPropertCostTableValue.
[edit] Version
1.61
[edit] Example
<nowiki>#include "x2_inc_itemprop" </nowiki>//The include is for the IPSafeAddItemProperty function //Makes the PC speaker's helmet cause stupidity :-( void main() { object oPC=GetPCSpeaker(); object oItem = GetItemInSlot(INVENTORY_SLOT_HEAD, oPC); if (!GetIsObjectValid(oItem)) return; itemproperty ipAdd = ItemPropertyDecreaseAbility(IP_CONST_ABILITY_INT, 5); IPSafeAddItemProperty(oItem, ipAdd); }
[edit] See Also
functions: | |
constants: |
author: Lilac Soul, editor: Peter Busby