Background for Skyrim SE
Member of the ObjectReference script
ObjectReferencefunctionDropObject(FormakObject, intaiCount=1)Native

Description

Wiki Description

Drops the specified object from this object's inventory.

Documentation Comment

Drops the specified object from this object's inventory


Caveats

CK Wiki - Notes

  • If a number greater than 1 is used for aiCount, the objects dropped will be stacked. In order to drop individual items, DropObject must be called for each instance of the item.
  • If akObject is equipped, the game will first search for unequipped items in inventory to drop. Only when there are no more unequipped items will it drop the equipped items.
  • If akObject is a permanently-persistent reference, DropObject will not return a Form ID value for the ObjectReference, even though it still physically drops the object from the inventory. If you need to run further ObjectReference Functions onto the dropped object, you will need to refer to that object's reference ID directly.
  • If akObject is an ObjectReference, even one which was just received by i.e. OnItemAdded(), DropObject() will fail with an error in the script log: "cannot be dropped, it has no 3d." You can instead use itemRef.MoveTo(containerRef) to pull a specific reference out of inventory, but note that if itemRef is a weapon and containerRef is an actor (such as the player), the actor may be wounded unless you give MoveTo() a sufficient offset.

Parameters

FormakObject

CK Wiki Description

The object to drop from the inventory.

intaiCount=1

CK Wiki Description

How many to drop

  • Default:1

Examples

; Drops one chest from the player's inventory, and unlocks it
Game.GetPlayer().DropObject(ChestProperty).Lock(false)
; Drops one hundred arrows from the player's inventory
Game.GetPlayer().DropObject(ArrowProperty, 100)

Auto-Generated Example

Form myForm__akObject
int myInt__aiCount

ObjectReference returnedValue = myObjectReference__toCallFunctionOn.DropObject(myForm__akObject, myInt__aiCount)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.