Hello
Long time reader first time poster.
I have created a script that alters the weight of all the potions in the game. It is working but I can't get rid of the feeling that I haven't done it in the most efficient way. Can any of you more experienced scripters suggest a more efficient or less resource intensive way to do this?
setup:
1. I created a formlist of all potions and poisons currently in my game (I don't have any DLC)
2. I created a dummy quest to attach my script to in order to run on game init and on save game load (this is the only method I know of to get my script to run every time, may be a better way to do this?)
Here is the script i created to do the work:
*************************************************************
Scriptname PotsNPoisions extends Quest
FormList Property PotsNPoisionsList Auto ; This is my formlist I created with all the pots and poisons in it
Function Init()
Int iIndex = PotsNPoisionsList.GetSize()
While iIndex
iIndex -= 1
Form kReference = PotsNPoisionsList.GetAt(iIndex) As Form
kReference.SetWeight(0.1)
EndWhile
EndFunction
********************************************************
Additional Thoughts:
This uses the SKSE for the SetWeight function
In an Ideal world I would love to figure out a method to dynamically select all the pots and poisions instead of using a static form list. This would avoid causing errors with other mods, would make it work with any DLC, or even modify custom pots or poisions that are added on the fly. Don't know if this is possible, but would be cool.