Background for Fallout 4
Member of the ObjectReference script
intfunctionSellItem(FormItem, intValue, intamountToSell=-1, boolsilent=false, FormpaymentItem=NONE, ObjectReferencePaymentContainer=NONE)

[DEV SERVER] Loading description...


Caveats

CK Wiki - 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() 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.

Parameters

FormItem

CK Wiki Description

what item we want to sell.

intValue

CK Wiki Description

How much each Item is worth (in other words, payment will be:Items sold * Value)

intamountToSell=-1

CK Wiki Description

How many references to remove. If < 0 means sell ALL of the specified Item in the container

boolsilent=false

CK Wiki Description

If true, no message will be printed to the screen when removing Item and adding paymentItem (only meaningful when calling on the Player)

FormpaymentItem=NONE

CK Wiki Description

what Item to give as payment. If None, means caps001.

ObjectReferencePaymentContainer=NONE

CK Wiki Description

what container to place payment in. If None, means the calling container.


Examples

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

Auto-Generated Example

Form myForm__Item
int myInt__Value
int myInt__amountToSell
bool myBool__silent
Form myForm__paymentItem
ObjectReference myObjectReference__PaymentContainer

int returnedValue = myObjectReference__toCallFunctionOn.SellItem(myForm__Item, myInt__Value, myInt__amountToSell, myBool__silent, myForm__paymentItem, myObjectReference__PaymentContainer)

Related Pages


Additional References

View this function’s page on the Fallout 4 Creation Kit Wiki

Some data provided by the Fallout 4 Creation Kit Wiki. Licensed under the Creative Commons Attribution-Share Alike 4.0 license.