Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. scn OBXLGenerateRandomDrops
  2.  
  3. ref target
  4.  
  5. short numItems
  6. short maxItems
  7. short minItems
  8. short minRoll
  9. short maxRoll
  10. short roll
  11. short i
  12. array_var category
  13. short categoryMin
  14. short categoryMax
  15. short categoryRoll
  16. short rareMin
  17. short rareMax
  18. short rare
  19. short rareRoll
  20. short uncommonMin
  21. short uncommonMax
  22. short uncommon
  23. short uncommonRoll
  24. ref item
  25. short minAddCount
  26. short maxAddCount
  27. short count
  28.  
  29. begin Function { target }
  30.  
  31. if target == Player
  32. return
  33. endif
  34.  
  35. let minItems := 1
  36. let maxItems := 11
  37. let minRoll := 0
  38. let categoryMin := 1
  39. let categoryMax := 9
  40. let rareMin := 1
  41. let rareMax := 100
  42. let uncommonMin := 1
  43. let uncommonMax := 30
  44. let numItems := rand minItems maxItems
  45. let minAddCount := 1
  46. let i := 0
  47.  
  48. while i < numItems
  49. let categoryRoll := rand categoryMin categoryMax
  50. if categoryRoll == 1
  51. let category := OBXLRandomDrops.ammo
  52. let maxAddCount := 50
  53. elseif categoryRoll == 2
  54. let category := OBXLRandomDrops.weapons
  55. let maxAddCount := 1
  56. elseif categoryRoll == 3
  57. let category := OBXLRandomDrops.armor
  58. let maxAddCount := 1
  59. elseif categoryRoll == 4
  60. let category := OBXLRandomDrops.misc
  61. let maxAddCount := 6
  62. elseif categoryRoll == 5
  63. let category := OBXLRandomDrops.sigil
  64. let maxAddCount := 6
  65. elseif categoryRoll == 6
  66. let category := OBXLRandomDrops.soulgem
  67. let maxAddCount := 3
  68. elseif categoryRoll == 7
  69. let category := OBXLRandomDrops.clothing
  70. let maxAddCount := 1
  71. elseif categoryRoll >= 8
  72. let category := OBXLRandomDrops.book
  73. let maxAddCount := 3
  74. endif
  75.  
  76. let rareRoll := rand rareMin rareMax
  77. if rareRoll == 50
  78. let rare := 1
  79. else
  80. let rare := 0
  81. endif
  82.  
  83. let uncommonRoll := rand uncommonMin uncommonMax
  84. if uncommonRoll == 15
  85. let uncommon := 1
  86. else
  87. let uncommon := 0
  88. endif
  89.  
  90. if rare == 1
  91. let maxRoll := ar_Size category["rare"]
  92. let roll := rand minRoll maxRoll
  93. let item := category["rare"][roll]
  94. let count := rand minAddCount maxAddCount
  95. target.AddItem item count
  96. let i += 1
  97. continue
  98. elseif uncommon == 1
  99. let maxRoll := ar_Size category["uncommon"]
  100. let roll := rand minRoll maxRoll
  101. let item := category["uncommon"][roll]
  102. let count := rand minAddCount maxAddCount
  103. target.AddItem item count
  104. let i += 1
  105. continue
  106. else
  107. let maxRoll := ar_Size category["common"]
  108. let roll := rand minRoll maxRoll
  109. let item := category["common"][roll]
  110. let count := rand minAddCount maxAddCount
  111. target.AddItem item count
  112. let i += 1
  113. continue
  114. endif
  115. loop
  116. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement