Difference between revisions of "AddForm - LeveledItem"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>JustinOther
imported>JustinOther
Line 25: Line 25:


== Notes ==
== Notes ==
*Currently (v1.5.26.0), forms added to leveled items in this manner will not persist in save games, unlike [[AddForm - FormList]]. This can be demonstrated or even exploited with the below code, allowing a jury rigged GetGameLoaded().
*Currently (v1.5.26.0), forms added to leveled items in this manner will not persist in save games, unlike [[AddForm - FormList]]. This can be demonstrated or even exploited with the below, a jury rigged GetGameLoaded() function.
<source lang="papyrus">Bool Function GetGameLoaded(LeveledItem akLeveledItem = None, Form apItem = None, ObjectReference akContainer = None)
<source lang="papyrus">Bool Function GetGameLoaded(LeveledItem akLeveledItem = None, Form apItem = None, ObjectReference akContainer = None)
         akContainer.AddItem(akLeveledItem, 1, True)
         akContainer.AddItem(akLeveledItem, 1, True)
Line 36: Line 36:
         EndIf
         EndIf
EndFunction</source>
EndFunction</source>
== See Also ==
== See Also ==
*[[LeveledItem Script]]
*[[LeveledItem Script]]
*[[Revert - LeveledItem]]
*[[Revert - LeveledItem]]

Revision as of 03:19, 4 April 2012

Member of: LeveledItem Script

Adds the given form to the leveled list.

Syntax

Function AddForm(Form apForm, int auiLevel, int auiCount) native

Parameters

  • apForm: Form to add to the leveled list
  • auiLevel: Level to add form under
  • auiCount: Number of items to add

Return Value

None.

Examples

; Add 2 axes to the list at level 5
CoolItems.AddForm(Axe, 5, 2)

Notes

  • Currently (v1.5.26.0), forms added to leveled items in this manner will not persist in save games, unlike AddForm - FormList. This can be demonstrated or even exploited with the below, a jury rigged GetGameLoaded() function.
Bool Function GetGameLoaded(LeveledItem akLeveledItem = None, Form apItem = None, ObjectReference akContainer = None)
        akContainer.AddItem(akLeveledItem, 1, True)
        If akContainer.GetItemCount(apItem)
                akContainer.RemoveItem(apItem, akContainer.GetItemCount(apItem), True)
                Return False
        Else ; Will only return 'True' once per save load
                akLeveledItem.AddForm(apItem, 1, 1)
                Return True
        EndIf
EndFunction

See Also