Background for Fallout 4
Member of the MiscObject script
voidfunctionSetMiscComponents(MiscObject:MiscComponent[]components)Native

Description

Wiki Description

Sets the Component Data for this MiscItem using an array of MiscComponent structures.


Caveats


Parameters

MiscObject:MiscComponent[]components

CK Wiki Description

An array of MiscComponent structures.


Examples

; Replace the component data of a MiscItem
MiscObject AlarmClock
MiscObject CatBowl

MiscObject:MiscComponent[] components = AlarmClock.GetMiscComponents()
CatBowl.SetMiscComponents(components)
Debug.Trace("A 'CatBowl' will use the same components as an 'AlarmClock' now.")
Scriptname Example extends ScriptObject
import MiscObject

MiscObject Property CatBowl Auto Const Mandatory

Group Components
    Component Property c_Aluminum Auto Const Mandatory
    Component Property c_Gold Auto Const Mandatory
EndGroup

Event OnInit()
    {Changes the 'CatBowl' component data with two aluminum and one gold.}
    MiscComponent[] components = new MiscComponent[0]

    MiscComponent aluminum = new MiscComponent
    aluminum.Object = c_Aluminum
    aluminum.Count = 2
    components.Add(aluminum)

    MiscComponent gold = new MiscComponent
    gold.Object = c_Gold
    gold.Count = 1
    components.Add(gold)

    CatBowl.SetMiscComponents(components)
    Debug.Trace(CatBowl+" has changed its component data.")

    int index = 0
    While (index < components.Length)
        Debug.Trace("("+index+" of "+components.Length+") There is "+components[index].Count+" of the '"+components[index].Object+"' component")
        index += 1
    EndWhile
EndEvent

Auto-Generated Example

MiscObject:MiscComponent[] myMiscObject_MiscComponentArray__components

myMiscObject__toCallFunctionOn.SetMiscComponents(myMiscObject_MiscComponentArray__components)

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.