IPSetWeaponEnhancementBonus(object, int, int)

Sets an enhancement bonus on a weapon.

void IPSetWeaponEnhancementBonus(
    object oWeapon,
    int nBonus,
    int bOnlyIfHigher = TRUE
);

Parameters

oWeapon

Weapon to set the bonus on.

nBonus

Bonus to add. 1 to 20 are valid.

bOnlyIfHigher

TRUE or FALSE. See description. (Default: TRUE)


Description

Shortcut function to set the enhancement bonus of a weapon to a certain bonus
Specifying bOnlyIfHigher as TRUE will prevent a bonus lower than the requested bonus from being applied. Valid values for nBonus are 1 to 20.



Remarks

A good alternative to IPSafeAddItemProperty or AddItemProperty when wanting to improve a PC's weapon.

If nBonus is not between 1 and 20, nothing happens.


Requirements

#include "x2_inc_itemprop"

Version

1.61

Example

#include "x2_inc_itemprop"

//Give the PC's weapon a +10 enhancement, unless it is already better than that
void main()
{
object oPC=GetPCSpeaker();
object oOnHand=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);

IPSetWeaponEnhancementBonus(oOnHand, 10);
}

See Also

functions: IPUpgradeWeaponEnhancementBonus | ItemPropertyEnhancementBonus
categories: Item Creation Functions | Item Properties Functions


 author: Lilac Soul