Advertisement
ThoraldGM

Fallout 4: DCS_QuestScript (with DLC checks)

Oct 23rd, 2017
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.26 KB | None | 0 0
  1. Scriptname DCS_QuestScript extends Quest
  2. { It just works. }
  3.  
  4. ; Fallout 4 Papyrus script by ThoraldGM | http://thoraldgm.com | Updated 20171023
  5. ; Diamond City SWAT mod: https://www.nexusmods.com/fallout4/mods/10893/
  6.  
  7. ; SCRIPT SECTIONS:
  8. ; LINE 017: PROPERTIES
  9. ; LINE 043: ON QUEST INIT
  10. ; LINE 053: DCS SET APPROVED OUTFITS
  11. ; LINE 085: CHECK FOR AUTOMATRON DLC
  12. ; LINE 121: CHECK FOR FAR HARBOR DLC
  13. ; LINE 169: CHECK FOR NUKA-WORLD DLC
  14. ; LINE 270: ADD OUTFIT TO APPROVED LIST
  15.  
  16. ; ------------------------------------------------------------------------------------------------------------
  17. ; PROPERTIES
  18. ; ------------------------------------------------------------------------------------------------------------
  19.  
  20. GlobalVariable Property pDCS_Global_DevTracking Auto Mandatory ; Developer messages enabled?
  21. FormList Property pDCS_Flst_Outfits_GlobalsFactions Auto Mandatory ; Contains globals for player to select factions 0-22
  22.  
  23. FormList Property pDCS_Flst_Outfit_XautomatronX Auto Mandatory ; Empty Automatron formlist pending DLC check
  24. FormList Property pDCS_Flst_Outfit_XfarharborX Auto Mandatory ; Empty Far Harbor formlist pending DLC check
  25. FormList Property pDCS_Flst_Outfit_XnukaworldX Auto Mandatory ; Empty Nuka-World formlist pending DLC check
  26.  
  27. ; ************************************************************************************************************
  28. ; NUKAGIRL IS ARMOR, NOT OUTFIT. WILL REQUIRE SPECIAL HANDLING IN THE DLC CHECK. (ADDFORM TO LL IF DLC FOUND)
  29. ; ************************************************************************************************************
  30.  
  31. LeveledItem Property pDCS_LL_NukaGirl Auto Mandatory ; Empty NukaGirl leveled list pending DLC check
  32. Outfit Property pDCS_Outfit_NukaGirl Auto Mandatory ; Outfit contains the empty leveled list
  33.  
  34. ; ************************************************************************************************************
  35. ; THESE ARE MULTI-ARRAYS CREATED IN CK: FORMLISTS CONTAIN FORMLISTS, WHICH CONTAIN [GLOBALS | OUTFITS | EMPTY]
  36. ; ************************************************************************************************************
  37.  
  38. FormList Property pDCS_Flst_Outfits_GlobalsOutfits Auto Mandatory ; X: formlist of formlists, Y: formlist of globals
  39. FormList Property pDCS_Flst_Outfits Auto Const Mandatory ; X: formlist of formlists, Y: formlist of outfits
  40. FormList Property pDCS_Flst_Outfits_Allowed Auto ; Empty multi-array that will hold outfits selected by player
  41.  
  42. ; ------------------------------------------------------------------------------------------------------------
  43. ; EVENT: ON QUEST INIT
  44. ; ------------------------------------------------------------------------------------------------------------
  45.  
  46. Event OnQuestInit()
  47.  
  48. DCS_SetApprovedOutfits() ; Set up default outfits. Player has not used MCM yet.
  49.  
  50. EndEvent
  51.  
  52. ; ------------------------------------------------------------------------------------------------------------
  53. ; CUSTOM FUNCTION: DCS SET APPROVED OUTFITS
  54. ; ------------------------------------------------------------------------------------------------------------
  55.  
  56. Function DCS_SetApprovedOutfits()
  57.  
  58. ; ********************************************************************************************************
  59. ; PREPARE TO STOCK MULTI-ARRAY (DCS_Flst_Outfits_Allowed) WITH APPROVED OUTFITS (OUTFIT GLOBAL VARIABLE == 1)
  60. ; ********************************************************************************************************
  61.  
  62. FormList FactionList = pDCS_Flst_Outfits_GlobalsFactions ; Step 1: faction globals
  63. GlobalVariable FactionIndex
  64.  
  65. FormList NestedList ; Step 2: outfit globals
  66. GlobalVariable NestedIndex
  67.  
  68. FormList OutfitsList ; Step 3: actual outfits
  69. Outfit OutfitsIndex
  70.  
  71. FormList ApprovedList ; Step 4: approved outfits
  72.  
  73. Int x = 0 ; Outer loop range, set now
  74.  
  75. Int FactionSize = FactionList.GetSize() - 3 ; Subtract DLCs from FactionSize pending DLC checks
  76. Int FactionGlobalInt
  77.  
  78. Int y ; Inner loop range, set later (soon)
  79. Int NestedSize
  80. Int NestedGlobalInt
  81.  
  82. Int i ; Prepare to fix AddForm not stacking correctly!
  83.  
  84. ; ********************************************************************************************************
  85. ; CHECK IF PLAYER HAS AUTOMATRON DLC INSTALLED AND EXPAND FACTION/OUTFIT CHOICES
  86. ; ********************************************************************************************************
  87.  
  88. bool AutomatronInstalled = Game.IsPluginInstalled("DLCRobot.esm")
  89. Utility.Wait(0.1)
  90.  
  91. If AutomatronInstalled ; If Automatron DLC found,
  92.  
  93. FactionSize += 1 ; increment FactionSize by 1
  94.  
  95. ; And populate the Automatron outfit list
  96. Outfit[] AutomatronOutfits = new Outfit[7]
  97. AutomatronOutfits[0] = Game.GetFormFromFile(0x0100FEFF, "DLCRobot.esm") as Outfit ; DLC01Caravan_JacksonOutfit
  98. AutomatronOutfits[1] = Game.GetFormFromFile(0x0100FF05, "DLCRobot.esm") as Outfit ; DLC01Caravan_LizaOutfit
  99. AutomatronOutfits[2] = Game.GetFormFromFile(0x0100FF07, "DLCRobot.esm") as Outfit ; DLC01Caravan_ShadesOutfit
  100. AutomatronOutfits[3] = Game.GetFormFromFile(0x0100FF02, "DLCRobot.esm") as Outfit ; DLC01Caravan_ZoeOutfit
  101. AutomatronOutfits[4] = Game.GetFormFromFile(0x0100EBB8, "DLCRobot.esm") as Outfit ; DLC01MechanistOutfitArmor
  102. AutomatronOutfits[5] = Game.GetFormFromFile(0x0100EBB9, "DLCRobot.esm") as Outfit ; DLC01MechanistOutfitJumpsuit
  103. AutomatronOutfits[6] = Game.GetFormFromFile(0x0100863D, "DLCRobot.esm") as Outfit ; DLC01Outfit_BotRaider
  104.  
  105. Utility.Wait(0.1)
  106.  
  107. i = 6 ; IMPORTANT: AddForm adds every new element at index ZERO! So add forms BACKWARDS to match globals list!
  108.  
  109. While i >= 0
  110. pDCS_Flst_Outfit_XautomatronX.AddForm(AutomatronOutfits[i] as Form)
  111. i -= 1
  112. EndWhile
  113.  
  114. If pDCS_Global_DevTracking.GetValue() == 1
  115. Debug.Notification("DCS: Automatron handled.")
  116. EndIf
  117.  
  118. EndIf
  119.  
  120. ; ********************************************************************************************************
  121. ; CHECK IF PLAYER HAS FAR HARBOR DLC INSTALLED AND EXPAND FACTION/OUTFIT CHOICES
  122. ; ********************************************************************************************************
  123.  
  124. bool FarHarborInstalled = Game.IsPluginInstalled("DLCCoast.esm")
  125. Utility.Wait(0.1)
  126.  
  127. If FarHarborInstalled ; If Far Harbor DLC found,
  128.  
  129. FactionSize += 1 ; increment FactionSize by 1
  130.  
  131. ; And populate the Far Harbor outfit list
  132. Outfit[] FarHarborOutfits = new Outfit[19]
  133. FarHarborOutfits[0] = Game.GetFormFromFile(0x01020C4F, "DLCCoast.esm") as Outfit ; DLC03_Outfit_Trapper_Coast
  134. FarHarborOutfits[1] = Game.GetFormFromFile(0x01054313, "DLCCoast.esm") as Outfit ; DLC03_Outfit_Trapper_Coast_Boss
  135. FarHarborOutfits[2] = Game.GetFormFromFile(0x01020C50, "DLCCoast.esm") as Outfit ; DLC03_Outfit_Trapper_Woods
  136. FarHarborOutfits[3] = Game.GetFormFromFile(0x01054314, "DLCCoast.esm") as Outfit ; DLC03_Outfit_Trapper_Woods_Boss
  137. FarHarborOutfits[4] = Game.GetFormFromFile(0x01009154, "DLCCoast.esm") as Outfit ; DLC03_RainGear01_NoHat_Outfit
  138. FarHarborOutfits[5] = Game.GetFormFromFile(0x01009157, "DLCCoast.esm") as Outfit ; DLC03_RainGear01_Outfit
  139. FarHarborOutfits[6] = Game.GetFormFromFile(0x01009155, "DLCCoast.esm") as Outfit ; DLC03_RainGear02_NoHat_Outfit
  140. FarHarborOutfits[7] = Game.GetFormFromFile(0x01009158, "DLCCoast.esm") as Outfit ; DLC03_RainGear02_Outfit
  141. FarHarborOutfits[8] = Game.GetFormFromFile(0x01009156, "DLCCoast.esm") as Outfit ; DLC03_RainGear03_NoHat_Outfit
  142. FarHarborOutfits[9] = Game.GetFormFromFile(0x01009159, "DLCCoast.esm") as Outfit ; DLC03_RainGear03_Outfit
  143. FarHarborOutfits[10] = Game.GetFormFromFile(0x010576E3, "DLCCoast.esm") as Outfit ; DLC03_RainGear04_Outfit
  144. FarHarborOutfits[11] = Game.GetFormFromFile(0x010576E4, "DLCCoast.esm") as Outfit ; DLC03_RainGear05_Outfit
  145. FarHarborOutfits[12] = Game.GetFormFromFile(0x010576E2, "DLCCoast.esm") as Outfit ; DLC03_RainGear06_Outfit
  146. FarHarborOutfits[13] = Game.GetFormFromFile(0x0101A237, "DLCCoast.esm") as Outfit ; DLC03AllenLeeOutfit
  147. FarHarborOutfits[14] = Game.GetFormFromFile(0x01053FB3, "DLCCoast.esm") as Outfit ; DLC03BrooksOutfit
  148. FarHarborOutfits[15] = Game.GetFormFromFile(0x01057030, "DLCCoast.esm") as Outfit ; DLC03CoA_GrandZealotOutfit
  149. FarHarborOutfits[16] = Game.GetFormFromFile(0x0105698D, "DLCCoast.esm") as Outfit ; DLC03CoA_HighConfessorOutfit
  150. FarHarborOutfits[17] = Game.GetFormFromFile(0x01004484, "DLCCoast.esm") as Outfit ; DLC03CoAArchemistOutfit
  151. FarHarborOutfits[18] = Game.GetFormFromFile(0x01048ED9, "DLCCoast.esm") as Outfit ; DLC03OldLongfellowOutfit
  152.  
  153. Utility.Wait(0.1)
  154.  
  155. i = 18 ; IMPORTANT: AddForm adds every new element at index ZERO! So add forms BACKWARDS to match globals list!
  156.  
  157. While i >= 0
  158. pDCS_Flst_Outfit_XfarharborX.AddForm(FarHarborOutfits[i] as Form)
  159. i -= 1
  160. EndWhile
  161.  
  162. If pDCS_Global_DevTracking.GetValue() == 1
  163. Debug.Notification("DCS: Far Harbor handled.")
  164. EndIf
  165.  
  166. EndIf
  167.  
  168. ; ********************************************************************************************************
  169. ; CHECK IF PLAYER HAS NUKA-WORLD DLC INSTALLED AND EXPAND FACTION/OUTFIT CHOICES
  170. ; ********************************************************************************************************
  171.  
  172. bool NukaWorldInstalled = Game.IsPluginInstalled("DLCNukaWorld.esm")
  173. Utility.Wait(0.1)
  174.  
  175. If NukaWorldInstalled ; If Nuka-World DLC found,
  176.  
  177. FactionSize += 1 ; increment FactionSize by 1
  178.  
  179. ; Do special NukaGirl armor handling
  180. Outfit[] NukaWorldOutfits = new Outfit[35]
  181. Armor NukaGirlArmor = Game.GetFormFromFile(0x01029C0D, "DLCNukaWorld.esm") as Armor ; DLC04_Armor_NukaGirlOutfit (ARMOR!)
  182. Utility.Wait(0.1)
  183. pDCS_LL_NukaGirl.AddForm(NukaGirlArmor, 1, 1) ; Add armor to empty leveled list
  184. Utility.Wait(0.1)
  185. NukaWorldOutfits[0] = pDCS_Outfit_NukaGirl ; Assign outfit that contains list
  186.  
  187. ; And finish populating the Nuka-World outfit list
  188. NukaWorldOutfits[1] = Game.GetFormFromFile(0x0100CC91, "DLCNukaWorld.esm") as Outfit ; DLC04_DaraHubbellOutfit
  189. NukaWorldOutfits[2] = Game.GetFormFromFile(0x0104B4F0, "DLCNukaWorld.esm") as Outfit ; DLC04_DixieOutfit
  190. NukaWorldOutfits[3] = Game.GetFormFromFile(0x0100D87C, "DLCNukaWorld.esm") as Outfit ; DLC04_DRG_RickyBraxtonOutfit
  191. NukaWorldOutfits[4] = Game.GetFormFromFile(0x0100D87A, "DLCNukaWorld.esm") as Outfit ; DLC04_DRG_SamTellerOutfit
  192. NukaWorldOutfits[5] = Game.GetFormFromFile(0x0100D87D, "DLCNukaWorld.esm") as Outfit ; DLC04_DRG_TerryTanakaOutfit
  193. NukaWorldOutfits[6] = Game.GetFormFromFile(0x01031F4D, "DLCNukaWorld.esm") as Outfit ; DLC04_GageOutfit
  194. NukaWorldOutfits[7] = Game.GetFormFromFile(0x0102DF09, "DLCNukaWorld.esm") as Outfit ; DLC04_HubologistOutfit
  195. NukaWorldOutfits[8] = Game.GetFormFromFile(0x010417AE, "DLCNukaWorld.esm") as Outfit ; DLC04_KK_RachelOutfit
  196. NukaWorldOutfits[9] = Game.GetFormFromFile(0x01048578, "DLCNukaWorld.esm") as Outfit ; DLC04_LizzieWyathOutfit
  197. NukaWorldOutfits[10] = Game.GetFormFromFile(0x010145DB, "DLCNukaWorld.esm") as Outfit ; DLC04_LucyOutfit
  198. NukaWorldOutfits[11] = Game.GetFormFromFile(0x01048579, "DLCNukaWorld.esm") as Outfit ; DLC04_MagsBlackOutfit
  199. NukaWorldOutfits[12] = Game.GetFormFromFile(0x0104A6A0, "DLCNukaWorld.esm") as Outfit ; DLC04_MasonOutfit
  200. NukaWorldOutfits[13] = Game.GetFormFromFile(0x0104B4EF, "DLCNukaWorld.esm") as Outfit ; DLC04_NishaOutfit
  201. NukaWorldOutfits[14] = Game.GetFormFromFile(0x0101763C, "DLCNukaWorld.esm") as Outfit ; DLC04_OswaldOutfit
  202. NukaWorldOutfits[15] = Game.GetFormFromFile(0x01036662, "DLCNukaWorld.esm") as Outfit ; DLC04_Outfit_Raider_Disciples
  203. NukaWorldOutfits[16] = Game.GetFormFromFile(0x01036673, "DLCNukaWorld.esm") as Outfit ; DLC04_Outfit_Raider_Operator
  204. NukaWorldOutfits[17] = Game.GetFormFromFile(0x01036674, "DLCNukaWorld.esm") as Outfit ; DLC04_Outfit_Raider_Pack
  205. NukaWorldOutfits[18] = Game.GetFormFromFile(0x0104B4F1, "DLCNukaWorld.esm") as Outfit ; DLC04_SavoyOutfit
  206. NukaWorldOutfits[19] = Game.GetFormFromFile(0x01048577, "DLCNukaWorld.esm") as Outfit ; DLC04_WilliamBlackOutfit
  207. NukaWorldOutfits[20] = Game.GetFormFromFile(0x01044845, "DLCNukaWorld.esm") as Outfit ; DLC04ColaCarsCrowd_Outfit_Raider_Pack
  208. NukaWorldOutfits[21] = Game.GetFormFromFile(0x010504EE, "DLCNukaWorld.esm") as Outfit ; DLC04FritschOutfit
  209. NukaWorldOutfits[22] = Game.GetFormFromFile(0x010489A9, "DLCNukaWorld.esm") as Outfit ; DLC04MQ04_SinnerOutfit
  210. NukaWorldOutfits[23] = Game.GetFormFromFile(0x01042B4F, "DLCNukaWorld.esm") as Outfit ; DLC04POISC07_KaliDunmoreOutfit
  211. NukaWorldOutfits[24] = Game.GetFormFromFile(0x01042B4D, "DLCNukaWorld.esm") as Outfit ; DLC04POISC07_MoniqueDunmoreOutfit
  212. NukaWorldOutfits[25] = Game.GetFormFromFile(0x0100A511, "DLCNukaWorld.esm") as Outfit ; DLC04RaiderOverbossOutfit
  213. NukaWorldOutfits[26] = Game.GetFormFromFile(0x01051B7E, "DLCNukaWorld.esm") as Outfit ; DLC04RandomRadGorillaOutfit
  214. NukaWorldOutfits[27] = Game.GetFormFromFile(0x010260E5, "DLCNukaWorld.esm") as Outfit ; DLC04SafariCitoOutfit
  215. NukaWorldOutfits[28] = Game.GetFormFromFile(0x0103B9D1, "DLCNukaWorld.esm") as Outfit ; DLC04SafariDrMcDermotOutfit
  216. NukaWorldOutfits[29] = Game.GetFormFromFile(0x0101CD22, "DLCNukaWorld.esm") as Outfit ; DLC04ShankOutfit
  217. NukaWorldOutfits[30] = Game.GetFormFromFile(0x0104A3D2, "DLCNukaWorld.esm") as Outfit ; DLC04SierraOutfitGlassesOff
  218. NukaWorldOutfits[31] = Game.GetFormFromFile(0x0104A3D3, "DLCNukaWorld.esm") as Outfit ; DLC04SierraOutfitGlassesOn
  219. NukaWorldOutfits[32] = Game.GetFormFromFile(0x01026217, "DLCNukaWorld.esm") as Outfit ; DLC04TraderOutfit
  220. NukaWorldOutfits[33] = Game.GetFormFromFile(0x01038298, "DLCNukaWorld.esm") as Outfit ; DLC04TraderOutfitNoCollar
  221. NukaWorldOutfits[34] = Game.GetFormFromFile(0x010518C9, "DLCNukaWorld.esm") as Outfit ; DLC04TravelerOutfit
  222.  
  223. Utility.Wait(0.1)
  224.  
  225. i = 34 ; IMPORTANT: AddForm adds every new element at index ZERO! So add forms BACKWARDS to match globals list!
  226.  
  227. While i >= 0
  228. pDCS_Flst_Outfit_XnukaworldX.AddForm(NukaWorldOutfits[i] as Form)
  229. i -= 1
  230. EndWhile
  231.  
  232. If pDCS_Global_DevTracking.GetValue() == 1
  233. Debug.Notification("DCS: Nuka-World handled.")
  234. EndIf
  235.  
  236. EndIf
  237.  
  238. ; ********************************************************************************************************
  239. ; STOCK MULTI-ARRAY (DCS_Flst_Outfits_Allowed) WITH APPROVED OUTFITS (OUTFIT GLOBAL VARIABLE == 1)
  240. ; ********************************************************************************************************
  241.  
  242. While x < FactionSize ; Start with the outer loop
  243. FactionIndex = FactionList.GetAt(x) as GlobalVariable
  244. FactionGlobalInt = FactionIndex.GetValue() as Int
  245.  
  246. If FactionGlobalInt == 1 ; If player selected faction,
  247. NestedList = pDCS_Flst_Outfits_GlobalsOutfits.GetAt(x) as FormList ; grab the outfits globals list for this faction
  248. NestedSize = NestedList.GetSize() ; and determine how many items are on it
  249.  
  250. y = 0
  251.  
  252. While y < NestedSize ; Move to the inner loop
  253. NestedIndex = NestedList.GetAt(y) as GlobalVariable
  254. NestedGlobalInt = NestedIndex.GetValue() as Int
  255.  
  256. If NestedGlobalInt == 1 ; If player approved outfit,
  257. OutfitsList = pDCS_Flst_Outfits.GetAt(x) as FormList
  258. OutfitsIndex = OutfitsList.GetAt(y) as Outfit
  259.  
  260. ApprovedList = pDCS_Flst_Outfits_Allowed.GetAt(x) as FormList
  261.  
  262. ; ****************************************************************************************
  263. ; OK FOR ADDFORM TO STOCK BACKWARDS HERE, BECAUSE OUTFIT WILL BE SELECTED BY RANDOM ROLL
  264. ;
  265. ; (The outfit is selected in DCS_MonitorScript, which is attached to DCS_MonitorEffect.)
  266. ;
  267. ; (... And DCS_MonitorEffect is applied to non-companion Diamond City guards by cloak!)
  268. ; ****************************************************************************************
  269.  
  270. ApprovedList.AddForm(OutfitsIndex as Form) ; add outfit to the approved list
  271.  
  272. EndIf
  273.  
  274. y += 1 ; Move to the next inner loop index
  275.  
  276. EndWhile
  277.  
  278. EndIf
  279.  
  280. x += 1 ; Move to the next outer loop index
  281.  
  282. EndWhile
  283.  
  284. If pDCS_Global_DevTracking.GetValue() == 1
  285. Debug.Notification("DCS: Outfits stocked.")
  286. EndIf
  287.  
  288. EndFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement