Jump to content

Adding items to container on timer rather than respawn


Recommended Posts

Title says it all. I've been out of the modding game for a while so if anyone could point me in the direction of a tutorial or give me some pointers on how to do this I'd be much obliged.

Link to comment
Share on other sites

There are several versions to do this. One would be with a randomint

For instance you could put this script on your container

 

MiscItem Property TheItem Auto

Int Property RandomInteger Auto

 

 

Event OnInit() / Onload()

; Onload means it does work when you load the cell where the container is in it

Randominteger = utility.randomint(1,4)

;Creates a random number from 1 to 4

Utility.WaitGameTime(RandomInteger)

;Wait 1-4 hours

Self.RemoveAllItems(akTransferTo = None, abKeepOwnership = false)

;This means the container will self-empty itself

self.additem(TheItem, 1)

;This will add the item

Endevent

 

Now if you want to make this a looping script you'd have to make the script this way

 

Event OnInit()

While self.isenabled()

... Insert script stuff

Endwhile

EndEvent

 

 

 

Instead of a MiscObject (Item) you can also use potions and formlists. Bear in mind that this is based on Fallout 4, so there might be a difference here and there.

Onload() is of course the worse option here, since it will only affect your container if your cell has been loaded.

 

OnInit() would mean it starts right away. However if you have multiple custom containers (Eg. 60) it could mean that a lot of scripts are running in the background

Link to comment
Share on other sites

Optionally an alternative:

Everytime you visit the container area it has a chance of self resetting

 

 

Event onload()

while self.isenabled()

RandomInteger = utility.randomint(1, :cool:

; a chance of 1 in 8

if randomint == 1

Self.RemoveAllItems(akTransferTo = None, abKeepOwnership = false)

;Clear container

self.additem(TheItem, 1)

Endif

Endwhile

Endevent

 

 

The smiley is supposed to be: 8 )

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...