- Found in:
- SKSE
Description
Wiki Description
Returns the Nth form within a container relative to the total number acquired with ObjectReference.GetNumItems(). (This function requires SKSE)
Caveats
CK Wiki - 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, ObjectReference.GetNumItems() will return '2' and not '11', so passing '3' as the Index argument of GetNthForm in such a case would return NONE.
Parameters
intindex
Examples
Form kForm = MQ101AlduinREF.GetNthForm(0)Actor Property PlayerREF Auto
Event SomeEvent()
ReweighIngredientsIn(PlayerREF, 0.1)
EndEvent
Function ReweighIngredientsIn(ObjectReference akContainer, Float afWeight) Global
Int iFormIndex = akContainer.GetNumItems()
While iFormIndex > 0
iFormIndex -= 1
Form kForm = akContainer.GetNthForm(iFormIndex)
If kForm.GetType() == 30 ; Ingredient
kForm.SetWeight(afWeight)
EndIf
EndWhile
EndFunctionAuto-Generated Example
int myInt__index
Form returnedValue = myObjectReference__toCallFunctionOn.GetNthForm(myInt__index)