Difference between revisions of "AttachMod - ObjectReference"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Google12
m (Added a Notes section)
imported>Qazaaq
m (category)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Mod Functions]]
[[Category:Inventory-safe Papyrus Functions]]
'''Member of:''' [[ObjectReference Script]]
'''Member of:''' [[ObjectReference Script]]


Attaches a mod to this object.
Attaches a mod to this object.


== Syntax ==
== Syntax ==
Line 28: Line 22:


== Notes ==
== Notes ==
Changing an item's mods causes it to be silently unequipped and re-equipped.   
Changing an armor item's mods causes it to be silently unequipped and re-equipped.   


== See Also ==
== See Also ==
Line 34: Line 28:
*[[RemoveMod - ObjectReference]]
*[[RemoveMod - ObjectReference]]
*[[RemoveAllMods - ObjectReference]]
*[[RemoveAllMods - ObjectReference]]
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Mod Functions]]
[[Category:Inventory-safe Papyrus Functions]]

Latest revision as of 02:16, 2 November 2017

Member of: ObjectReference Script

Attaches a mod to this object.

Syntax[edit | edit source]

Function AttachMod(ObjectMod akMod, int aiAttachIndex = 1) native

Parameters[edit | edit source]

  • akMod: the base form of a mod that we wish to add & attach to this reference
  • aiAttachIndex: OPTIONAL: the attach index to put akMod onto. For example, a robot that can take an arm mod in three different places can have this specified to specify which spot the arm mod should go to. Defaults to 1. Has no relevance and can safely be ignored for mods that can only go in one spot.

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 reference.

Examples[edit | edit source]

; Attach a "RobotArmMod" onto the second slot it can go onto
myRobot.AttachMod(RobotArmMod, 2)

Notes[edit | edit source]

Changing an armor item's mods causes it to be silently unequipped and re-equipped.

See Also[edit | edit source]