Mod:Creation Kit/GetObjectComponentCount - MiscObject

Member of: Mod:Creation Kit/MiscObject Script

Gets the quantity of the given Mod:Creation Kit/Component from the Mod:Creation Kit/MiscItem Component Data.

Syntax
int Function GetObjectComponentCount(Component akComponent) native

Parameters

 * akComponent - The Mod:Creation Kit/Component that should be counted.

Return Value
The quantity of the given Mod:Creation Kit/Component.

Examples
MiscObject DeskFanOffice01 Component c_Screws
 * Count the miscellaneous components

int count = DeskFanOffice01.GetObjectComponentCount(c_Screws) Debug.Trace("The '"+DeskFanOffice01+"' item has "+count+" of the "+c_Screws+" component.")

Scriptname Example extends ScriptObject

MiscObject Property DeskFanOffice01 Auto Const Mandatory Component Property c_Screws Auto Const Mandatory

Event OnInit {Count the miscellaneous components} int count = DeskFanOffice01.GetObjectComponentCount(c_Screws) If (count > 0) Debug.Trace("The '"+DeskFanOffice01+"' item has "+count+" of the "+c_Screws+" component.") Else Debug.Trace("The '"+DeskFanOffice01+"' item does not use the "+c_Screws+" component.") EndIf EndEvent