Editing
DropObject - ObjectReference
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
[[Category:Scripting]] [[Category:Papyrus]] [[Category:Latent Functions]] '''Member of:''' [[ObjectReference Script]] Drops the specified object from this object's inventory. == Syntax == <syntaxhighlight lang="papyrus"> ObjectReference Function DropObject(Form akObject, int aiCount = 1) native </syntaxhighlight> == Parameters == *akObject: The object to drop from the inventory. *aiCount: How many to drop **'''Default''': 1 == Return Value == The object that was dropped. == Examples == <syntaxhighlight lang="papyrus"> ; Drops one chest from the player's inventory, and unlocks it Game.GetPlayer().DropObject(ChestProperty).Lock(false) </syntaxhighlight> <br/> <syntaxhighlight lang="papyrus"> ; Drops one hundred arrows from the player's inventory Game.GetPlayer().DropObject(ArrowProperty, 100) </syntaxhighlight> == 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. == See Also == *[[ObjectReference Script]]
Summary:
Please note that all contributions to the CreationKit Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see
CreationKit:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Landing page
Tutorials
Game Systems
Editor Reference
Scripting Reference
Recent changes
Help
Tools
What links here
Related changes
Special pages
Page information
Page values