Difference between revisions of "MiscComponent Struct - MiscObject"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Qazaaq
(Added details and code examples.)
imported>Qazaaq
(Slight change to description.)
Line 2: Line 2:
{{Template:Papyrus:RequiredF4SE|version=0.4.2}}
{{Template:Papyrus:RequiredF4SE|version=0.4.2}}


Represents the ''Component Data'' of a [[MiscItem]]. This includes a [[Component]] and a number designating the quantity.
A structure that holds information about the ''[[Template:Editor:Property:Component Data|Component Data]]'' of a [[MiscItem]]. This includes a [[Component]] and a number designating the quantity.


== Syntax ==
== Syntax ==
Line 29: Line 29:
Scriptname Example extends ScriptObject
Scriptname Example extends ScriptObject
import MiscObject
import MiscObject
MiscComponent[] Components


Group Components
Group Components
Line 40: Line 38:
Event OnInit()
Event OnInit()
     {An array of miscellaneous components}
     {An array of miscellaneous components}
     Components = new MiscComponent[0]
     MiscComponent[] components = new MiscComponent[0]


     MiscComponent leather = new MiscComponent
     MiscComponent leather = new MiscComponent
     leather.Object = c_Leather
     leather.Object = c_Leather
     leather.Count = 1
     leather.Count = 1
     Components.Add(leather)
     components.Add(leather)


     MiscComponent plastic = new MiscComponent
     MiscComponent plastic = new MiscComponent
     plastic.Object = c_Plastic
     plastic.Object = c_Plastic
     plastic.Count = 1
     plastic.Count = 2
     Components.Add(plastic)
     components.Add(plastic)


     MiscComponent steel = new MiscComponent
     MiscComponent steel = new MiscComponent
     steel.Object = c_Steel
     steel.Object = c_Steel
     steel.Count = 1
     steel.Count = 3
     Components.Add(steel)
     components.Add(steel)


     int index = 0
     int index = 0
     While (index < Components.Length)
     While (index < components.Length)
         Debug.Trace("("+index+" of "+Components.Length+") There is "+Components[index].Count+" of the '"+Components[index].Object+"' component")
         Debug.Trace("("+index+" of "+components.Length+") There is "+components[index].Count+" of the '"+components[index].Object+"' component")
         index += 1
         index += 1
     EndWhile
     EndWhile
Line 68: Line 66:
*[[MiscItem]]
*[[MiscItem]]
*[[Component]]
*[[Component]]
*[[GetMiscComponents - MiscObject]]
*[[SetMiscComponents - MiscObject]]





Revision as of 17:11, 2 December 2018

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

A structure that holds information about the Component Data of a MiscItem. This includes a Component and a number designating the quantity.

Syntax

Struct MiscComponent
    Component Object
    int Count
EndStruct

Members

  • Object: The Component to use.
  • Count: The quantity of this component.

Examples

; Trace miscellaneous 'c_Gold' component
MiscObject:MiscComponent gold = new MiscObject:MiscComponent
gold.Object = c_Gold
gold.Count = 100
Debug.Trace("There is "+gold.Count+" of the '"+gold.Object+"' component")


Scriptname Example extends ScriptObject
import MiscObject

Group Components
    Component Property c_Leather Auto Const Mandatory
    Component Property c_Plastic Auto Const Mandatory
    Component Property c_Steel Auto Const Mandatory
EndGroup

Event OnInit()
    {An array of miscellaneous components}
    MiscComponent[] components = new MiscComponent[0]

    MiscComponent leather = new MiscComponent
    leather.Object = c_Leather
    leather.Count = 1
    components.Add(leather)

    MiscComponent plastic = new MiscComponent
    plastic.Object = c_Plastic
    plastic.Count = 2
    components.Add(plastic)

    MiscComponent steel = new MiscComponent
    steel.Object = c_Steel
    steel.Count = 3
    components.Add(steel)

    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

See Also