Difference between revisions of "SetMiscComponents - MiscObject"
Jump to navigation
Jump to search
imported>Qazaaq (added f4se member) |
imported>Qazaaq (added wiki link) |
||
(One intermediate revision by the same user not shown) | |||
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}} | ||
Sets the ''[[Template:Editor:Property:Component Data|Component Data]]'' for this [[MiscItem]] using an array of [[MiscComponent Struct - MiscObject|MiscComponent]] structures. | |||
== Syntax == | == Syntax == | ||
Line 11: | Line 10: | ||
== Parameters == | == Parameters == | ||
*akComponents: | *akComponents: An array of [[MiscComponent Struct - MiscObject|MiscComponent]] structures. | ||
== Return Value == | == Return Value == | ||
Line 18: | Line 17: | ||
== Examples == | == Examples == | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
; | ; Replace the component data of a MiscItem | ||
MiscObject AlarmClock | |||
MiscObject CatBowl | |||
MiscObject:MiscComponent[] components = AlarmClock.GetMiscComponents() | |||
CatBowl.SetMiscComponents(components) | |||
Debug.Trace("A 'CatBowl' will use the same components as an 'AlarmClock' now.") | |||
</source> | |||
<source lang="papyrus"> | |||
Scriptname Example extends ScriptObject | |||
import MiscObject | |||
MiscObject Property CatBowl Auto Const Mandatory | |||
Group Components | |||
Component Property c_Aluminum Auto Const Mandatory | |||
Component Property c_Gold Auto Const Mandatory | |||
EndGroup | |||
Event OnInit() | |||
{Changes the 'CatBowl' component data with two aluminum and one gold.} | |||
MiscComponent[] components = new MiscComponent[0] | |||
MiscComponent aluminum = new MiscComponent | |||
aluminum.Object = c_Aluminum | |||
aluminum.Count = 2 | |||
components.Add(aluminum) | |||
MiscComponent gold = new MiscComponent | |||
gold.Object = c_Gold | |||
gold.Count = 1 | |||
components.Add(gold) | |||
CatBowl.SetMiscComponents(components) | |||
Debug.Trace(CatBowl+" has changed its component data.") | |||
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 == | ||
*[[MiscObject | *[[MiscItem]] | ||
*[[Component]] | |||
*[[MiscComponent Struct - MiscObject]] | |||
*[[GetMiscComponents - MiscObject]] | |||
[[Category: Scripting]] | [[Category:Scripting]] | ||
[[Category: Papyrus]] | [[Category:Papyrus]] | ||
[[Category: F4SE]] | [[Category:F4SE]] |
Latest revision as of 19:14, 2 December 2018
F4SE Member of: MiscObject Script
Requires F4SE version 0.4.2 or higher.
Sets the Component Data for this MiscItem using an array of MiscComponent structures.
Syntax[edit | edit source]
Function SetMiscComponents(MiscComponent[] akComponents) Native
Parameters[edit | edit source]
- akComponents: An array of MiscComponent structures.
Return Value[edit | edit source]
- None
Examples[edit | edit source]
; Replace the component data of a MiscItem
MiscObject AlarmClock
MiscObject CatBowl
MiscObject:MiscComponent[] components = AlarmClock.GetMiscComponents()
CatBowl.SetMiscComponents(components)
Debug.Trace("A 'CatBowl' will use the same components as an 'AlarmClock' now.")
Scriptname Example extends ScriptObject
import MiscObject
MiscObject Property CatBowl Auto Const Mandatory
Group Components
Component Property c_Aluminum Auto Const Mandatory
Component Property c_Gold Auto Const Mandatory
EndGroup
Event OnInit()
{Changes the 'CatBowl' component data with two aluminum and one gold.}
MiscComponent[] components = new MiscComponent[0]
MiscComponent aluminum = new MiscComponent
aluminum.Object = c_Aluminum
aluminum.Count = 2
components.Add(aluminum)
MiscComponent gold = new MiscComponent
gold.Object = c_Gold
gold.Count = 1
components.Add(gold)
CatBowl.SetMiscComponents(components)
Debug.Trace(CatBowl+" has changed its component data.")
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