Mod:Creation Kit/SellItem - ObjectReference

Member of: Mod:Creation Kit/ObjectReference Script

"Sells" X amount of the specified item from this reference's inventory.

Syntax
int Function SellItem(Form Item, int Value, int amountToSell = -1, bool silent = false, form paymentItem = none, \ objectReference PaymentContainer = None)

Parameters

 * Item: what item we want to sell.
 * Value: How much each Item is worth (in other words, payment will be: Items sold * Value)
 * amountToSell: How many references to remove. If < 0 means sell ALL of the specified Item in the container
 * Default: -1
 * Silent: If true, no message will be printed to the screen when removing Item and adding paymentItem (only meaningful when calling on the Player)
 * Default: false
 * paymentItem: what Item to give as payment. If None, means caps001.
 * Default: None.
 * PaymentContainer: what container to place payment in. If None, means the calling container.
 * Default: None.

Return Value
How many items were sold. If you specifiy amountToSell which is greater than the actual amount of items, the return value can be used to determine how many actually were sold.

Examples
Game.GetPlayer.SellItem(Potato, 2, 10)
 * Sell up to 10 potatoes from the player's inventory for 2 caps each