SetItemCharges(object, int)

Sets the number of charges left on a given item.

void SetItemCharges(
    object oItem,
    int nCharges
);

Parameters

oItem

Item to set the number of charges on.

nCharges

Number of charges to set (0 to destroy).


Description

Sets the number of charges left on a given item. If nCharges is less than 0, the number of charges will be set to 0 (and the item is destroyed). If a value greater than the maximum number of charges that an item of its type can hold is passed, then the number of charges will be set to the item's maximum. If the number of charges ever reaches 0, the item is automatically destroyed.



Remarks

This function also works on items that don’t normally have charges. You can give such an item 10 charges, and that will show up in its info screen when examining it. Setting item charges to 0 also destroys items that don’t normally have charges.

If oItem isn’t a valid item, nothing happens.


Version

1.30

See Also

categories: Action on Object Functions | Inventory Functions


 author: Charles Feduke, editor: Lilac Soul