Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Script optimization help


tesvet
 Share

Recommended Posts

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.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...