IPUpgradeWeaponEnhancementBonus

From NWN Lexicon



Contents

[edit] IPUpgradeWeaponEnhancementBonus(object, int)

Upgrades a weapon's enhancement bonus.

void IPUpgradeWeaponEnhancementBonus(
    object oWeapon,
    int nUpgradeBy
);

[edit] Parameters

oWeapon

Weapon to upgrade.

nUpgradeBy

Upgrade weapon's enhancement bonus by this much.


[edit] Description

Shortcut function to upgrade the enhancement bonus of a weapon by the number specified in nUpgradeBy. If the resulting new enhancement bonus would be out of bounds (>+20), it will be set to +20.



[edit] Remarks

You can also use this function to degrade a weapon's enhancement bonus by providing a negative number as nUpgradeBy. If the enhancement bonus would then be set to lower than 1, it is set to 1 instead.

Only melee weapons can have enhancement bonuses - neither ranged weapons nor ammunition can hold such an itemproperty.


[edit] Requirements

#include " x2_inc_itemprop "

[edit] Version

1.62

[edit] Example

<nowiki>#include "x2_inc_itemprop"
</nowiki>
//Give the PC's weapon an additional +13 enhancement
 
void main()
{
object oPC=GetPCSpeaker();
object oOnHand=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
 
IPUpgradeWeaponEnhancementBonus(oOnHand, 3);
}

[edit] See Also

functions: 

ItemPropertyEnhancementBonus



 author: Lilac Soul, additional contributor(s): hbunny
 

Personal tools
Categories