Difference between revisions of "AddForm - LeveledItem"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>JustinOther
imported>Ladyonthemoon
 
(12 intermediate revisions by 4 users not shown)
Line 22: Line 22:
; Add 2 axes to the list at level 5
; Add 2 axes to the list at level 5
CoolItems.AddForm(Axe, 5, 2)
CoolItems.AddForm(Axe, 5, 2)
; Add 1 leveled list to the list at level 5
CoolItemsLeveledList.AddForm(OtherCoolItemsLeveledList, 5, 1)
</source>
</source>


== 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().
* In previous versions of Skyrim, this function did not work correctly. As of Skyrim 1.9.32.0.8, it works as described above.
<source lang="papyrus">Bool Function GetGameLoaded(LeveledItem akLeveledItem = None, Form apItem = None, ObjectReference akContainer = None)
* Users may experience merchants that do not sell items added to LeveledItems used by that merchant using this function. This is usually because the player has spoken to the merchant in the recent past (within the last 48 hours); LeveledItem lists are evaluated when the player views that merchant's merchandise, and the items added to the LeveledItem list will not be available until the merchant resets their merchandise again. The items added to the LeveledItem list by this function should become available after the player waits 48 hours in-game. Another way of forcing the merchant to update their merchandise is to quicksave, then attack them, and quick load. This should make them reset their merchandise when you talk to them again.
        akContainer.AddItem(akLeveledItem, 1, True)
* A leveled list can only have up to 255 entries, including both CK-defined entries and entries added by Papyrus.
        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</source>
== See Also ==
== See Also ==
*[[LeveledItem Script]]
*[[LeveledItem Script]]
*[[Revert - LeveledItem]]
*[[Revert - LeveledItem]]

Latest revision as of 12:07, 11 April 2018

Member of: LeveledItem Script

Adds the given form to the leveled list.

Syntax[edit | edit source]

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

Parameters[edit | edit source]

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

Return Value[edit | edit source]

None.

Examples[edit | edit source]

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


; Add 1 leveled list to the list at level 5
CoolItemsLeveledList.AddForm(OtherCoolItemsLeveledList, 5, 1)

Notes[edit | edit source]

  • In previous versions of Skyrim, this function did not work correctly. As of Skyrim 1.9.32.0.8, it works as described above.
  • Users may experience merchants that do not sell items added to LeveledItems used by that merchant using this function. This is usually because the player has spoken to the merchant in the recent past (within the last 48 hours); LeveledItem lists are evaluated when the player views that merchant's merchandise, and the items added to the LeveledItem list will not be available until the merchant resets their merchandise again. The items added to the LeveledItem list by this function should become available after the player waits 48 hours in-game. Another way of forcing the merchant to update their merchandise is to quicksave, then attack them, and quick load. This should make them reset their merchandise when you talk to them again.
  • A leveled list can only have up to 255 entries, including both CK-defined entries and entries added by Papyrus.

See Also[edit | edit source]