Jump to content

[LE] Add item from a list of notes and not get them more than once issue.


Recommended Posts

So I am not sure if there is a way to do this but maybe someone knows.

 

I have a chest that spawn 5 notes. Now I have about 13 notes to choose from and I want the 5 notes to be chosen from that list. I know how to add an item from a formlist/leveledlist/array etc but the problem I am running into is that it might give me the same item multiple time.

 

Is there a way to ask for 5 items from a list and make it so it will not give me a second copy of the item, a bit like making the notes unique? I really want it to be random

Edited by littleork
Link to comment
Share on other sites

Use a FormList, and RemoveAddedForm, perhaps?

 

Have an empty Form List, and on start-up, have a Quest populate it with all of the possible notes, then grab 1 note from the list, and add it to the chest. Not 100% sure on the Script, but something like :

 

 

Function SelectANote()
MyFormList.AddForm(Note001)
;Do for all 13 Notes
 
NoteCount = 0
While ( NoteCount < 5 )
   FormListLength = MyFormList.GetSize()
   FormListLength = ( FormListLength - 1 )
   WhichNote = Utility.RandomInt(0, FormListLength)
   MyNote = MyFormList.GetAt(WhichNote) as Book
   MyChest.AddItem(MyNote, 1, 1)
   MyFormList.RemoveAddedForm(MyNote)
   NoteCount = ( NoteCount + 1 )
EndWhile
EndFunction

 

Depending how you want it to do, you could have it fire on the Chest being Activated, so it would populate it the first time it's opened.

Link to comment
Share on other sites

  On 6/16/2017 at 1:18 PM, CDM_ said:

Use a FormList, and RemoveAddedForm, perhaps?

 

Have an empty Form List, and on start-up, have a Quest populate it with all of the possible notes, then grab 1 note from the list, and add it to the chest. Not 100% sure on the Script, but something like :

Function SelectANote()
MyFormList.AddForm(Note001)
;Do for all 13 Notes
 
NoteCount = 0
While ( NoteCount < 5 )
   FormListLength = MyFormList.GetSize()
   FormListLength = ( FormListLength - 1 )
   WhichNote = Utility.RandomInt(0, FormListLength)
   MyNote = MyFormList.GetAt(WhichNote) as Book
   MyChest.AddItem(MyNote, 1, 1)
   MyFormList.RemoveAddedForm(MyNote)
   NoteCount = ( NoteCount + 1 )
EndWhile
EndFunction

Depending how you want it to do, you could have it fire on the Chest being Activated, so it would populate it the first time it's opened.

Hmmm I will try that! Thanks.

Link to comment
Share on other sites

Maybe the following script is what you want to have? It's a bit different to the approach of CDM_

 

FiveNotesAddToChestScript

  Reveal hidden contents

 

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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