Difference between revisions of "SellItem - ObjectReference"
Jump to navigation
Jump to search
imported>Plplecuyer |
imported>Qazaaq (Changed the item parameter note to be more clear about its mention of properties.) |
||
Line 3: | Line 3: | ||
'''Member of:''' [[ObjectReference Script]] | '''Member of:''' [[ObjectReference Script]] | ||
"Sells" X of the specified item from this reference's inventory | "Sells" X amount of the specified item from this reference's inventory. | ||
== Syntax == | == Syntax == | ||
Line 34: | Line 34: | ||
==Notes== | ==Notes== | ||
*''' | *The generic ''Item'' parameter accepts a form object, however you must provide a higher type of object that extends form. Most often a [[MiscItem]], or [[Weapon]], etc. | ||
*This function does not trigger [[OnSell - ObjectReference|OnSell()]] event. | |||
*'''Untested/verified:''' If you pass in a form list, it will remove AmountToSell of each item in the form list from the container. If there isn't AmountToSell of a particular item in the container, it will remove all of them. | *'''Untested/verified:''' If you pass in a form list, it will remove AmountToSell of each item in the form list from the container. If there isn't AmountToSell of a particular item in the container, it will remove all of them. | ||
Line 43: | Line 43: | ||
*[[GetItemCount - ObjectReference]] | *[[GetItemCount - ObjectReference]] | ||
*[[RemoveAllItems - ObjectReference]] | *[[RemoveAllItems - ObjectReference]] | ||
*[[OnSell - ObjectReference]] | *[[OnSell - ObjectReference]] |
Latest revision as of 17:33, 15 April 2017
Member of: ObjectReference Script
"Sells" X amount of the specified item from this reference's inventory.
Syntax[edit | edit source]
int Function SellItem(Form Item, int Value, int amountToSell = -1, bool silent = false, form paymentItem = none, \
objectReference PaymentContainer = None)
Parameters[edit | edit source]
- 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[edit | edit source]
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[edit | edit source]
; Sell up to 10 potatoes from the player's inventory for 2 caps each
Game.GetPlayer().SellItem(Potato, 2, 10)
Notes[edit | edit source]
- The generic Item parameter accepts a form object, however you must provide a higher type of object that extends form. Most often a MiscItem, or Weapon, etc.
- This function does not trigger OnSell() event.
- Untested/verified: If you pass in a form list, it will remove AmountToSell of each item in the form list from the container. If there isn't AmountToSell of a particular item in the container, it will remove all of them.