Difference between revisions of "GetMiscComponents - MiscObject"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Qazaaq
(Extended the papyrus example. Thanks @JigsJosh for getting it started.)
imported>Qazaaq
(Added notes.)
Line 1: Line 1:
{{Template:Incomplete Article}}
'''F4SE Member of:''' [[MiscObject Script]]
'''F4SE Member of:''' [[MiscObject Script]]
{{Template:Papyrus:RequiredF4SE|version=0.4.2}}
{{Template:Papyrus:RequiredF4SE|version=0.4.2}}
Line 37: Line 36:
EndIf
EndIf
</source>
</source>
== Notes ==
*Do not use these functions on ConstructibleObject they will not work. Papyrus defines Constructible 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.


== See Also ==
== See Also ==

Revision as of 13:02, 25 November 2018

F4SE Member of: MiscObject Script
Requires F4SE version 0.4.2 or higher.

Gets an array of MiscComponent for this MiscItem.

Syntax

MiscComponent[] Function GetMiscComponents() Native

Parameters

  • None

Return Value

An array of MiscComponent structures.

Examples

; Count miscellaneous components
int count = Item.GetMiscComponents().Length
Debug.Trace(Item + " has " + count + " components.")


{For each miscellaneous component}
MiscObject:MiscComponent[] components = Item.GetMiscComponents()
If (components)
    int index = 0
    While (index < components.Length)
        Debug.Trace(Item + " uses " + components[index].Count + " of the " + components[index].Object + " component.")
        index += 1
    EndWhile
Else
    Debug.Trace(Item + " has no components.")
EndIf

Notes

  • Do not use these functions on ConstructibleObject they will not work. Papyrus defines Constructible 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.

See Also