cecell

Papyrus Lose Some Weight

Apr 4th, 2021
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.46 KB | None | 0 0
  1. Scriptname LSW_PlayerAliasScript2730324652 extends ReferenceAlias
  2.  
  3. import Debug
  4.  
  5. Actor PlayerREF
  6. bool isHunterbornLoaded
  7. formlist HBRawMeat
  8.  
  9. Event OnInit()
  10. PlayerREF = Game.GetPlayer()
  11. isHunterbornLoaded = isHBLoaded()
  12. EndEvent
  13.  
  14. ; Runs when player loads a save game
  15. Event OnPlayerLoadGame()
  16. if isHunterbornLoaded
  17. ;debug.messagebox("Populating the formlist")
  18. HBRawMeat = popFormList()
  19. ;debug.Messagebox("HB is loaded! " + HBRawMeat.GetSize() + " <--?" + Game.GetFormFromFile(0x01479E, "Hunterborn.esp").GetName())
  20. EndIf
  21. Float fPlayerCarryWeight = PlayerREF.GetBaseActorValue("CarryWeight")
  22. PlayerREF.SetActorValue("carryweight", 50000.0)
  23. ReweighIngredientsIn(PlayerREF, isHunterbornLoaded, HBRawMeat)
  24. PlayerREF.SetActorValue("carryweight", fPlayerCarryWeight)
  25. EndEvent
  26.  
  27.  
  28.  
  29. ; Changes the weight of certain items to 0.0 as they are added to the player's inventory
  30. Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akFormReference, ObjectReference akSourceContainer)
  31. If akBaseItem
  32. int itemType = akBaseItem.GetType()
  33. If (itemType == 27 || itemType == 30 || itemType == 32 || itemType == 42 || itemType == 52)
  34. akBaseItem.SetWeight(0.0)
  35. ElseIf itemType == 46
  36. If (isHunterbornLoaded)
  37. If HBRawMeat.hasForm(akBaseItem)
  38. return
  39. EndIf
  40. EndIf
  41. akBaseItem.SetWeight(0.0)
  42. EndIf
  43. EndIf
  44. EndEvent
  45.  
  46.  
  47.  
  48. ; Changes the weight of certain items in a player's inventory to 0.0
  49. Function ReweighIngredientsIn(ObjectReference akContainer, bool isHBLoaded, formlist RawMeatFL) global
  50. Int iFormIndex = akContainer.GetNumItems()
  51. Int itemType
  52. Form kForm
  53. Int arrayFind
  54. If iFormIndex <= 0
  55. return
  56. EndIf
  57. Debug.Notification("Lose Some Weight Starting...")
  58. While iFormIndex > 0
  59. kForm = akContainer.GetNthForm(iFormIndex)
  60. itemType = kForm.GetType()
  61. iFormIndex -= 1
  62. If (itemType == 27 || itemType == 30 || itemType == 32 || itemType == 42 || itemType == 52)
  63. kForm.SetWeight(0)
  64. ElseIf itemType == 46
  65. If (isHBLoaded)
  66. If RawMeatFL.hasForm(kForm)
  67. return
  68. EndIf
  69. EndIf
  70. kForm.SetWeight(0.0)
  71. EndIf
  72. EndWhile
  73. Debug.Notification("Lose Some Weight Finished")
  74. EndFunction
  75.  
  76.  
  77. ; Checks if Hunterborn is loaded or not and if so then populates the array with the specific Hunterborn
  78. ; forms to skip and not change weight to 0.0
  79. bool Function isHBLoaded() global
  80. if Game.GetFormFromFile(0x01479E, "Hunterborn.esp")
  81. return true
  82. Else
  83. return false
  84. EndIf
  85. EndFunction
  86.  
  87.  
  88.  
  89. FormList Function popFormList() global
  90. Formlist RawMeat
  91. RawMeat = Game.GetFormFromFile(0x065C99, "Skyrim.esm") as FormList ; FoodBeef Raw Beef
  92. RawMeat.addForm(Game.GetFormFromFile(0x065C9A, "Skyrim.esm")) ; FoodGoatMeat Raw Leg of Goat
  93. RawMeat.addForm(Game.GetFormFromFile(0x065C9B, "Skyrim.esm")) ; FoodHorkerMeat Raw Horker Meat
  94. RawMeat.addForm(Game.GetFormFromFile(0x065C9C, "Skyrim.esm")) ; FoodHorseMeat Raw Horse Meat
  95. RawMeat.addForm(Game.GetFormFromFile(0x065C9D, "Skyrim.esm")) ; FoodPheasant Raw Pheasant Breast
  96. RawMeat.addForm(Game.GetFormFromFile(0x0669A2, "Skyrim.esm")) ; FoodSalmon Raw Venison
  97. RawMeat.addForm(Game.GetFormFromFile(0x0EDB2E, "Skyrim.esm")) ; FoodDogmeat Raw Dog Meat
  98. RawMeat.addForm(Game.GetFormFromFile(0x0F2011, "Skyrim.esm")) ; FoodChicken Raw Chicken Breast
  99. RawMeat.addForm(Game.GetFormFromFile(0x10211A, "Skyrim.esm")) ; DA03FoodMammothMeat Raw Mammoth Snout
  100. RawMeat.addForm(Game.GetFormFromFile(0x003540, "Hearthfires.esm")) ; BYOHFoodMudcrabLegs Raw Mudcrab Legs - Hearthfires.esm
  101. RawMeat.addForm(Game.GetFormFromFile(0x03BD14, "Dragonborn.esm")) ; DLC2FoodBoarMeat Raw Boar Meat - Dragonborn.esm
  102. RawMeat.addForm(Game.GetFormFromFile(0x014795, "Hunterborn.esp")) ; _DS_Food_Raw_Bear Raw Bear Meat
  103. RawMeat.addForm(Game.GetFormFromFile(0x014796, "Hunterborn.esp")) ; _DS_Food_Raw_Skeever Raw Skeever Meat
  104. RawMeat.addForm(Game.GetFormFromFile(0x014798, "Hunterborn.esp")) ; _DS_Food_Raw_Fox Raw Fox Meat
  105. RawMeat.addForm(Game.GetFormFromFile(0x01479A, "Hunterborn.esp")) ; _DS_Food_Raw_Goat Raw Goat Meat
  106. RawMeat.addForm(Game.GetFormFromFile(0x01479C, "Hunterborn.esp")) ; _DS_Food_Raw_Wolf Raw Wolf Meat
  107. RawMeat.addForm(Game.GetFormFromFile(0x01479E, "Hunterborn.esp")) ; _DS_Food_Raw_Mammoth Raw Mammoth Meat
  108. RawMeat.addForm(Game.GetFormFromFile(0x0147A0, "Hunterborn.esp")) ; _DS_Food_Raw_Sabrecat Raw Sabre Cat Meat
  109. RawMeat.addForm(Game.GetFormFromFile(0x0147A2, "Hunterborn.esp")) ; _DS_Food_Raw_Hare Raw Rabbit Meat
  110. RawMeat.addForm(Game.GetFormFromFile(0x014D21, "Hunterborn.esp")) ; _DS_Food_Raw_Elk Venison (Elk)
  111. RawMeat.addForm(Game.GetFormFromFile(0x014D22, "Hunterborn.esp")) ; _DS_Food_Raw_Mudcrab Raw Mudcrab Meat
  112. RawMeat.addForm(Game.GetFormFromFile(0x014D24, "Hunterborn.esp")) ; _DS_Food_Raw_Slaughterfish Raw Slaughterfish Meat
  113. RawMeat.addForm(Game.GetFormFromFile(0x027783, "Hunterborn.esp")) ; _DS_Food_Raw_Chaurus Raw Chaurus Meat
  114. RawMeat.addForm(Game.GetFormFromFile(0x029846, "Hunterborn.esp")) ; _DS_Food_Raw_Spider Raw Spider Meat
  115. RawMeat.addForm(Game.GetFormFromFile(0x029847, "Hunterborn.esp")) ; _DS_Food_Raw_Troll Raw Troll Meat
  116. RawMeat.addForm(Game.GetFormFromFile(0x029849, "Hunterborn.esp")) ; _DS_Food_Raw_Dragon Raw Dragon Meat
  117. debug.Messagebox("RawMeat Size: " + RawMeat.GetSize() + " <--?" + Game.GetFormFromFile(0x01479E, "Hunterborn.esp").GetName())
  118. return RawMeat
  119. EndFunction
Advertisement
Add Comment
Please, Sign In to add comment