Jump to content

List of NPC's ID to array


F4llfield

Recommended Posts

Creation kit/Papyrus question

Hi,

I have a list of NPC ID's that I want to put in an array, and after access them one by one. What would be the best of doing that ?

 

Thanks for your time...

Link to comment
Share on other sites

Depends on how you have the list of FormIDs you'd like to add to an array then process. If the IDs are already in an array, this should work:

Scriptname testScript


Int[] Property InputFormIDs Auto Const

Int[] Property OutputFormIDs Auto Const



Function TestFunction()

	Int Index = InputFormIDs.Length -1
	While Index >= 0
		Int LoopFormID = InputFormIDs[Index]
		If LoopFormID > 0

			If OutputFormIDs.Find(LoopFormID) < 0
				OutputFormIDs.Add(LoopFormID)
			EndIf

			If OutputFormIDs.Find(LoopFormID) >= 0
				; ID now should be in OutputFormIDs now
              			; can be processed further if needed
			EndIf

		EndIf
		Index = Index - 1
	EndWhile

EndFunction

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...