Scriptname LSW_PlayerAliasScript2730324652 extends ReferenceAlias
import Debug
Actor PlayerREF
bool isHunterbornLoaded
formlist HBRawMeat
Event OnInit()
PlayerREF = Game.GetPlayer()
isHunterbornLoaded = isHBLoaded()
EndEvent
; Runs when player loads a save game
Event OnPlayerLoadGame()
if isHunterbornLoaded
;debug.messagebox("Populating the formlist")
HBRawMeat = popFormList()
;debug.Messagebox("HB is loaded! " + HBRawMeat.GetSize() + " <--?" + Game.GetFormFromFile(0x01479E, "Hunterborn.esp").GetName())
EndIf
Float fPlayerCarryWeight = PlayerREF.GetBaseActorValue("CarryWeight")
PlayerREF.SetActorValue("carryweight", 50000.0)
ReweighIngredientsIn(PlayerREF, isHunterbornLoaded, HBRawMeat)
PlayerREF.SetActorValue("carryweight", fPlayerCarryWeight)
EndEvent
; Changes the weight of certain items to 0.0 as they are added to the player's inventory
Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akFormReference, ObjectReference akSourceContainer)
If akBaseItem
int itemType = akBaseItem.GetType()
If (itemType == 27 || itemType == 30 || itemType == 32 || itemType == 42 || itemType == 52)
akBaseItem.SetWeight(0.0)
ElseIf itemType == 46
If (isHunterbornLoaded)
If HBRawMeat.hasForm(akBaseItem)
return
EndIf
EndIf
akBaseItem.SetWeight(0.0)
EndIf
EndIf
EndEvent
; Changes the weight of certain items in a player's inventory to 0.0
Function ReweighIngredientsIn(ObjectReference akContainer, bool isHBLoaded, formlist RawMeatFL) global
Int iFormIndex = akContainer.GetNumItems()
Int itemType
Form kForm
Int arrayFind
If iFormIndex <= 0
return
EndIf
Debug.Notification("Lose Some Weight Starting...")
While iFormIndex > 0
kForm = akContainer.GetNthForm(iFormIndex)
itemType = kForm.GetType()
iFormIndex -= 1
If (itemType == 27 || itemType == 30 || itemType == 32 || itemType == 42 || itemType == 52)
kForm.SetWeight(0)
ElseIf itemType == 46
If (isHBLoaded)
If RawMeatFL.hasForm(kForm)
return
EndIf
EndIf
kForm.SetWeight(0.0)
EndIf
EndWhile
Debug.Notification("Lose Some Weight Finished")
EndFunction
; Checks if Hunterborn is loaded or not and if so then populates the array with the specific Hunterborn
; forms to skip and not change weight to 0.0
bool Function isHBLoaded() global
if Game.GetFormFromFile(0x01479E, "Hunterborn.esp")
return true
Else
return false
EndIf
EndFunction
FormList Function popFormList() global
Formlist RawMeat
RawMeat = Game.GetFormFromFile(0x065C99, "Skyrim.esm") as FormList ; FoodBeef Raw Beef
RawMeat.addForm(Game.GetFormFromFile(0x065C9A, "Skyrim.esm")) ; FoodGoatMeat Raw Leg of Goat
RawMeat.addForm(Game.GetFormFromFile(0x065C9B, "Skyrim.esm")) ; FoodHorkerMeat Raw Horker Meat
RawMeat.addForm(Game.GetFormFromFile(0x065C9C, "Skyrim.esm")) ; FoodHorseMeat Raw Horse Meat
RawMeat.addForm(Game.GetFormFromFile(0x065C9D, "Skyrim.esm")) ; FoodPheasant Raw Pheasant Breast
RawMeat.addForm(Game.GetFormFromFile(0x0669A2, "Skyrim.esm")) ; FoodSalmon Raw Venison
RawMeat.addForm(Game.GetFormFromFile(0x0EDB2E, "Skyrim.esm")) ; FoodDogmeat Raw Dog Meat
RawMeat.addForm(Game.GetFormFromFile(0x0F2011, "Skyrim.esm")) ; FoodChicken Raw Chicken Breast
RawMeat.addForm(Game.GetFormFromFile(0x10211A, "Skyrim.esm")) ; DA03FoodMammothMeat Raw Mammoth Snout
RawMeat.addForm(Game.GetFormFromFile(0x003540, "Hearthfires.esm")) ; BYOHFoodMudcrabLegs Raw Mudcrab Legs - Hearthfires.esm
RawMeat.addForm(Game.GetFormFromFile(0x03BD14, "Dragonborn.esm")) ; DLC2FoodBoarMeat Raw Boar Meat - Dragonborn.esm
RawMeat.addForm(Game.GetFormFromFile(0x014795, "Hunterborn.esp")) ; _DS_Food_Raw_Bear Raw Bear Meat
RawMeat.addForm(Game.GetFormFromFile(0x014796, "Hunterborn.esp")) ; _DS_Food_Raw_Skeever Raw Skeever Meat
RawMeat.addForm(Game.GetFormFromFile(0x014798, "Hunterborn.esp")) ; _DS_Food_Raw_Fox Raw Fox Meat
RawMeat.addForm(Game.GetFormFromFile(0x01479A, "Hunterborn.esp")) ; _DS_Food_Raw_Goat Raw Goat Meat
RawMeat.addForm(Game.GetFormFromFile(0x01479C, "Hunterborn.esp")) ; _DS_Food_Raw_Wolf Raw Wolf Meat
RawMeat.addForm(Game.GetFormFromFile(0x01479E, "Hunterborn.esp")) ; _DS_Food_Raw_Mammoth Raw Mammoth Meat
RawMeat.addForm(Game.GetFormFromFile(0x0147A0, "Hunterborn.esp")) ; _DS_Food_Raw_Sabrecat Raw Sabre Cat Meat
RawMeat.addForm(Game.GetFormFromFile(0x0147A2, "Hunterborn.esp")) ; _DS_Food_Raw_Hare Raw Rabbit Meat
RawMeat.addForm(Game.GetFormFromFile(0x014D21, "Hunterborn.esp")) ; _DS_Food_Raw_Elk Venison (Elk)
RawMeat.addForm(Game.GetFormFromFile(0x014D22, "Hunterborn.esp")) ; _DS_Food_Raw_Mudcrab Raw Mudcrab Meat
RawMeat.addForm(Game.GetFormFromFile(0x014D24, "Hunterborn.esp")) ; _DS_Food_Raw_Slaughterfish Raw Slaughterfish Meat
RawMeat.addForm(Game.GetFormFromFile(0x027783, "Hunterborn.esp")) ; _DS_Food_Raw_Chaurus Raw Chaurus Meat
RawMeat.addForm(Game.GetFormFromFile(0x029846, "Hunterborn.esp")) ; _DS_Food_Raw_Spider Raw Spider Meat
RawMeat.addForm(Game.GetFormFromFile(0x029847, "Hunterborn.esp")) ; _DS_Food_Raw_Troll Raw Troll Meat
RawMeat.addForm(Game.GetFormFromFile(0x029849, "Hunterborn.esp")) ; _DS_Food_Raw_Dragon Raw Dragon Meat
debug.Messagebox("RawMeat Size: " + RawMeat.GetSize() + " <--?" + Game.GetFormFromFile(0x01479E, "Hunterborn.esp").GetName())
return RawMeat
EndFunction
Comments