soulbladex Posted October 29, 2013 Share Posted October 29, 2013 I don't know if anyone can help me out, but I am trying to create an array that holds the values of 10 items. I want the script below to select one of the 10 items at random after a menu option is selected and place the item on the floor. Thanks for any help/suggestions. Scriptname RandomItemArray extends ObjectReference Actor Property PlayerREF AutoObjectReference property ItemPlacementMarker autoMessage property OptionsMenu AutoFormList Property ListOfItems AutoEvent OnActivate(ObjectReference akActionRef) If akActionRef == PlayerREF OpenMenu() EndIfEndEvent Function OpenMenu(int aiButton = 0) aiButton = OptionsMenu.show() If aiButton == 0 ; Cancel Button ElseIf aiButton == 1 Int RandomNumber = Utility.RandomInt(0,9) Int iIndex = ListOfItems.GetSize() While iIndex iIndex -= 1 ObjectReference RandomItem = ListOfItems.GetAt(iIndex) As ObjectReference If RandomNumber == 0 ElseIf RandomNumber == iIndex ItemPlacementMarker.placeAtMe(RandomItem, 1) EndIf EndWhile EndIfEndFunction Link to comment Share on other sites More sharing options...
Vamyan Posted October 29, 2013 Share Posted October 29, 2013 so what's wrong with the script? Link to comment Share on other sites More sharing options...
soulbladex Posted October 29, 2013 Author Share Posted October 29, 2013 Nothing appears on the ground Link to comment Share on other sites More sharing options...
Vamyan Posted October 29, 2013 Share Posted October 29, 2013 so... move the objectplacementmarker to where you want the item to appear before you place the item... unless it's already there in a static location... check your papyrus log to see if you're getting any errors? Link to comment Share on other sites More sharing options...
soulbladex Posted October 29, 2013 Author Share Posted October 29, 2013 Complied, no errors. Link to comment Share on other sites More sharing options...
soulbladex Posted October 29, 2013 Author Share Posted October 29, 2013 I just realized you are the one that helped me the other day with my other question. Thanks! I am trying to convert my lengthy "if/then" based script to a shorter array based script. The script you saw the other day works perfectly, but I am running out of space in the script. I hit line 621 and can no longer type/paste anything. Link to comment Share on other sites More sharing options...
Vamyan Posted October 29, 2013 Share Posted October 29, 2013 I meant the papyrus log the game dumps to a file when you've got papyrus logging enabled in the skyrim.ini file... Link to comment Share on other sites More sharing options...
soulbladex Posted October 29, 2013 Author Share Posted October 29, 2013 Oh, I forgot about that and didn't check it. I ended up tinkering around with the script a bit and I ended using FormLists. The random items load/appear much faster than the lengthy if/then script. Mission accomplished. Thanks! Link to comment Share on other sites More sharing options...
Vamyan Posted October 29, 2013 Share Posted October 29, 2013 no problem, I hope you can get that mod finished up, because I'm thirsty for a nice big rack of venison potion. Link to comment Share on other sites More sharing options...
Recommended Posts