Difference between revisions of "MiscComponent Struct - MiscObject"
Jump to navigation
Jump to search
MiscComponent Struct - MiscObject (edit)
Revision as of 14:27, 2 December 2018
, 14:27, 2 December 2018Added details and code examples.
imported>Qazaaq m (minor see also link) |
imported>Qazaaq (Added details and code examples.) |
||
Line 1: | Line 1: | ||
'''F4SE Member of:''' [[MiscObject Script]] | '''F4SE Member of:''' [[MiscObject Script]] | ||
{{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. | |||
== Syntax == | == Syntax == | ||
Line 14: | Line 13: | ||
== Members == | == Members == | ||
*Object: | *Object: The [[Component]] to use. | ||
*Count: | *Count: The quantity of this component. | ||
== Examples == | == Examples == | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
; | ; 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") | |||
</source> | |||
<source lang="papyrus"> | |||
Scriptname Example extends ScriptObject | |||
import MiscObject | |||
MiscComponent[] Components | |||
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} | |||
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 = 1 | |||
Components.Add(plastic) | |||
MiscComponent steel = new MiscComponent | |||
steel.Object = c_Steel | |||
steel.Count = 1 | |||
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 | |||
</source> | </source> | ||
== See Also == | == See Also == | ||
*[[MiscItem]] | *[[MiscItem]] | ||
*[[Component]] | |||