Jump to content

[LE] How can I give the player a list of items with a random count every seven days


capngagi

Recommended Posts

 

You mean doing something like this?

 

 

 

Formlist Property TestStuffToGive Auto
Actor Property PlayerRef Auto
GlobalVariable Property GameDaysPassed Auto 

Float DaysPassed

Event OnInit() 
    GivePlayerItems()
    DaysPassed = GameDaysPassed.GetValue()
    RegisterForSingleUpdateGameTime(168) ; updates in 168 hours, or 7 days.
EndEvent

Event OnUpdateGameTime()
    GivePlayerItems()
    Float Extra = ((GameDaysPassed.GetValue() - DaysPassed - 7) * 24)
    Float NextUpdate = 168 - Extra ;subracts extra time from next update, if there is any. 
    DaysPassed = GameDaysPassed.GetValue() - Extra
    RegisterForSingleUpdateGameTime(NextUpdate)
EndEvent

Function GivePlayerItems()
    Int M = TestStuffToGive.GetSize()
    While M > 0
        M -= 1
        PlayerRef.AddItem(TestStuffToGive.GetAt(M), Utility.RandomInt(0, 10))
    EndWhile
EndFunction

I'm not really familiar with Leveled Lists as I haven't used them in my own mods.

 

Will this script stack? If I activate it twice will I get two instances of items every 7 days?

Link to comment
Share on other sites

There will be one instance of the script for each instance of the object holding the script provided the script was assigned to the base object. If the script is assigned to a specific pre-placed instance then there will ever only be that one instance of the script.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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