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

Description

Wiki Description

Gets the Component Data for this MiscItem as an array of MiscComponent structures.


Caveats

CK Wiki - Notes

  • Do not use these functions on Constructible Object as they will not work. Papyrus defines ConstructibleObject as extends MiscObject when this is not remotely true internally and F4SE does not support this kind of conversion in code so these are separate functions.

Examples

; Count how many different types of components are used
MiscObject DeskFanOffice01

int count = DeskFanOffice01.GetMiscComponents().Length
If (count == 1)
    Debug.Trace(DeskFanOffice01 + " has one type of component.")
ElseIf (count > 1)
    Debug.Trace(DeskFanOffice01 + " has "+count+" types of component.")
Else
    Debug.Trace(DeskFanOffice01 + " has no components.")
EndIf
Scriptname Example extends ScriptObject
import MiscObject

MiscObject Property DeskFanOffice01 Auto Const Mandatory

Event OnInit()
    {For each miscellaneous component}
    MiscComponent[] components = DeskFanOffice01.GetMiscComponents()
    If (components)
        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
    Else
        Debug.Trace(DeskFanOffice01+" has no components.")
    EndIf
EndEvent

Auto-Generated Example

MiscObject:MiscComponent[] returnedValue = myMiscObject__toCallFunctionOn.GetMiscComponents()

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.