Advertisement
Guest User

AddItemsToLList.psc

a guest
Feb 5th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. scriptname AddItemsToLList extends ReferenceAlias
  2. {
  3. Script to be attached to an alias referencing the player.
  4. The quest holding the alias should be an empty one with both "Run Once" and "Start Game Enabled" checked.
  5.  
  6. Will add the content of the "Items" property to the leveledlist property.
  7. There are two examples :
  8. - one using a generic formlist (anything can be added to the LList)
  9. - one using a specific array (armors in the example). The actual list of items have to be set as property in the CK, limited to 128
  10. '-> this one is commented out.
  11.  
  12. It's possible to use an array of form (Form[]) instead of the LList. It's faster then relying on LList but limited to 128 forms.
  13. And also fucking boring to set by hand when you can just drag n drop everything into a formlist via CK.
  14.  
  15. Refresh() is the actual distribution function.
  16. It is always called whenever the game load :
  17. - Because scripted modifications to LList are reverted on game load.
  18. - This also allow for easy updates to add/remove items from LList.
  19. }
  20.  
  21. ;Armor[] Property Items Auto
  22. FormList Property Items Auto
  23. LeveledItem Property theLLIst Auto
  24.  
  25.  
  26. ;Called once the first time the mod is loaded in game.
  27. Event OnInit()
  28. Refresh()
  29. EndEvent
  30.  
  31. ;Called every time the player load the game with the mod already installed (so not when OnInit is called)
  32. Event OnPlayerLoadGame()
  33. Refresh()
  34. EndEvent
  35.  
  36. ;
  37.  
  38.  
  39. ;To be used when adding objects from an array.
  40. ;Function Refresh()
  41. ; int nbScarves = Items.length
  42. ; int i = 0
  43. ;
  44. ; while i < nbScarves
  45. ; theLLIst.AddForm(Items[i], 0, 1)
  46. ; i += 1
  47. ; endwhile
  48. ;
  49. ;EndFunction
  50.  
  51. ;To be used when adding objects from a formlist.
  52. Function Refresh()
  53. int nbScarves = Items.GetSize()
  54. int i = 0
  55.  
  56. while i < nbScarves
  57. theLLIst.AddForm(Items.GetAt(i), 0, 1)
  58. i += 1
  59. endwhile
  60.  
  61. EndFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement