imported>JustinOther |
imported>JustinOther |
Line 1: |
Line 1: |
| [[Category:Scripting]]
| | {{afd}} |
| [[Category:Papyrus]]
| |
| [[Category:SKSE]]
| |
| '''SKSE Member of:''' [[ObjectReference Script]]
| |
| | |
| Returns the N'th form within a container relative to the total number acquired with [[GetNumItems - ObjectReference|GetNumItems]]. (This function requires SKSE)
| |
| | |
| == Syntax ==
| |
| <source lang="papyrus">
| |
| Form Function GetNthForm(Int Index) Native
| |
| </source>
| |
| | |
| == Return Value ==
| |
| Returns the N'th form in the calling container.
| |
| | |
| == Notes ==
| |
| * The Index of a form in the container is relative to the number of form types regardless of the count of any particular form. If a container has only ten gold and a torch, [[GetNumItems - ObjectReference|GetNumItems]] will return '2' and not '11', so passing '3' as the Index argument of GetNthForm in such a case would return NONE.
| |
| | |
| == Examples ==
| |
| * Check a single container.
| |
| <source lang="papyrus">Form kForm = MQ101AlduinREF.GetNthForm(0)</source>
| |
| * Set the weights of all ingredients in player's inventory to 0.1.
| |
| <source lang="papyrus">Actor Property PlayerREF Auto
| |
| | |
| Event SomeEvent()
| |
| ReweighIngredientsIn(PlayerREF, 0.1)
| |
| EndEvent
| |
| | |
| Function ReweighIngredientsIn(ObjectReference akContainer, Float fWeight) Global
| |
| Int iFormIndex = akContainer.GetNumItems()
| |
| While iFormIndex > 0
| |
| iFormIndex -= 1
| |
| Form kForm = akContainer.GetNthForm(iFormIndex)
| |
| If kForm.GetType() == 30 ; Ingredient
| |
| kForm.SetWeight(fWeight)
| |
| EndIf
| |
| EndWhile
| |
| EndFunction</source>
| |
| | |
| == See Also ==
| |
| *[[ObjectReference Script]]
| |
| *[[GetNumItems - ObjectReference|GetNumItems]]
| |