Advertisement
ThoraldGM

Fallout 4: Multi-arrays of faction outfits

Oct 18th, 2017
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1.  
  2. ; Multi-array Papyrus code by ThoraldGM 20171018. For Diamond City SWAT 2.0 Overhaul, a Fallout 4 mod.
  3. ; Player selects factions and outfits in MCM mod menu, then code updates with choices. Untested, uncompiled fragment.
  4.  
  5. FormList Property pDCS_Flst_Outfits_GlobalsFactions Auto Mandatory ; Contains globals for player to select factions 0-22
  6.  
  7. ; ************************************************************************************************************
  8. ; THESE ARE MULTI-ARRAYS CREATED IN CK: FORMLISTS CONTAIN FORMLISTS, WHICH CONTAIN [GLOBALS | OUTFITS | EMPTY]
  9. ; ************************************************************************************************************
  10.  
  11. FormList Property pDCS_Flst_Outfits_GlobalsOutfits Auto Mandatory ; X: formlist of formlists, Y: formlist of globals
  12. FormList Property pDCS_Flst_Outfits Auto Mandatory Constant ; X: formlist of formlists, Y: formlist of outfits
  13. FormList Property pDCS_Flst_Outfits_Allowed ; Empty multi-array that will hold outfits selected by player
  14.  
  15. ; ************************************************************************************************************
  16. ; STOCK THE EMPTY MULTI-ARRAY WITH PLAYER SELECTED OUTFITS
  17. ; ************************************************************************************************************
  18.  
  19. FormList FactionList = pDCS_Flst_Outfits_GlobalsFactions ; Step 1: faction globals
  20. GlobalVariable FactionIndex
  21.  
  22. FormList NestedList ; Step 2: outfit globals
  23. GlobalVariable NestedIndex
  24.  
  25. FormList OutfitsList ; Step 3: actual outfits
  26. Outfit OutfitsIndex
  27.  
  28. FormList ApprovedList ; Step 4: approved outfits
  29.  
  30. Int x = 0 ; Outer loop range, set now
  31. Int FactionSize = FactionList.GetSize()
  32. Int FactionGlobalInt
  33.  
  34. Int y ; Inner loop range, set later (soon)
  35. Int NestedSize
  36. Int NestedGlobalInt
  37.  
  38. While x < FactionSize ; Start with the outer loop
  39. FactionIndex = FactionList.GetAt(x) as GlobalVariable
  40. FactionGlobalInt = FactionIndex.GetValue() as Int
  41.  
  42. If FactionGlobalInt == 1 ; If player selected faction,
  43. NestedList = pDCS_Flst_Outfits_GlobalsOutfits.GetAt(x) as FormList ; grab the outfits globals list for this faction
  44. NestedSize = NestedList.GetSize() ; and determine how many items are on it
  45.  
  46. y = 0
  47.  
  48. While y < NestedSize ; Move to the inner loop
  49. NestedIndex = NestedList.GetAt(y) as GlobalVariable
  50. NestedGlobalInt = NestedIndex.GetValue() as Int
  51.  
  52. If NestedGlobalInt == 1 ; If player approved outfit,
  53. OutfitsList = pDCS_Flst_Outfits.GetAt(x) as FormList
  54. OutfitsIndex = OutfitsList.GetAt(y) as Outfit
  55.  
  56. ApprovedList = pDCS_Flst_Outfits_Allowed.GetAt(x) as FormList
  57.  
  58. ApprovedList.AddForm(OutfitsIndex as Form) ; add outfit to the approved list
  59.  
  60. EndIf
  61.  
  62. y += 1 ; Move to the next inner loop index
  63.  
  64. EndWhile
  65.  
  66. EndIf
  67.  
  68. x += 1 ; Move to the next outer loop index
  69.  
  70. EndWhile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement