Difference between revisions of "AttachModToInventoryItem - ObjectReference"
Jump to navigation
Jump to search
imported>Plplecuyer |
imported>Homecom m (→Syntax: The function's return type was not included in the syntax section. Corrected that.) |
||
Line 8: | Line 8: | ||
== Syntax == | == Syntax == | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
Function AttachModToInventoryItem(Form akItem, ObjectMod akMod) native | bool Function AttachModToInventoryItem(Form akItem, ObjectMod akMod) native | ||
</source> | </source> | ||
Latest revision as of 20:22, 13 June 2018
Member of: ObjectReference Script
Attach a mod to an item in this object's inventory.
Syntax[edit | edit source]
bool Function AttachModToInventoryItem(Form akItem, ObjectMod akMod) native
Parameters[edit | edit source]
- akItem: a base form of the item we want to modify
- akMod: a base form of the mod we want to add/attach to akItem
Return Value[edit | edit source]
True if it successfully attached the mod, false otherwise. Note that this is only going to check that the mod found an attach point to attach to; it will not check what type of mod it is or if it replaced another mod already on the item.
Examples[edit | edit source]
; attach a new arm armor mod to Bob's power armor
BobRef.AttachModToInventoryItem(PowerArmorObject, PowerArmorRightArmMod)
Notes[edit | edit source]
- This doesn't do much error checking, so if you try to attach a mod to an item that already has the mod, it may silently fail
- Currently there is a bug if you do this to an actor in combat; they will end up having no weapons drawn and won't attempt to draw any unless forced to do so.
- Currently this function causes the object to reload its entire 3d if they had the item equipped that you modified. This might look strange if the player is watching.
- This function currently won't work if the object it is called on has more than one of the item you request to modify.