Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scn OBXLGenerateRandomDrops
- ref target
- short numItems
- short maxItems
- short minItems
- short minRoll
- short maxRoll
- short roll
- short i
- array_var category
- short categoryMin
- short categoryMax
- short categoryRoll
- short rareMin
- short rareMax
- short rare
- short rareRoll
- short uncommonMin
- short uncommonMax
- short uncommon
- short uncommonRoll
- ref item
- short minAddCount
- short maxAddCount
- short count
- begin Function { target }
- if target == Player
- return
- endif
- let minItems := 1
- let maxItems := 11
- let minRoll := 0
- let categoryMin := 1
- let categoryMax := 9
- let rareMin := 1
- let rareMax := 100
- let uncommonMin := 1
- let uncommonMax := 30
- let numItems := rand minItems maxItems
- let minAddCount := 1
- let i := 0
- while i < numItems
- let categoryRoll := rand categoryMin categoryMax
- if categoryRoll == 1
- let category := OBXLRandomDrops.ammo
- let maxAddCount := 50
- elseif categoryRoll == 2
- let category := OBXLRandomDrops.weapons
- let maxAddCount := 1
- elseif categoryRoll == 3
- let category := OBXLRandomDrops.armor
- let maxAddCount := 1
- elseif categoryRoll == 4
- let category := OBXLRandomDrops.misc
- let maxAddCount := 6
- elseif categoryRoll == 5
- let category := OBXLRandomDrops.sigil
- let maxAddCount := 6
- elseif categoryRoll == 6
- let category := OBXLRandomDrops.soulgem
- let maxAddCount := 3
- elseif categoryRoll == 7
- let category := OBXLRandomDrops.clothing
- let maxAddCount := 1
- elseif categoryRoll >= 8
- let category := OBXLRandomDrops.book
- let maxAddCount := 3
- endif
- let rareRoll := rand rareMin rareMax
- if rareRoll == 50
- let rare := 1
- else
- let rare := 0
- endif
- let uncommonRoll := rand uncommonMin uncommonMax
- if uncommonRoll == 15
- let uncommon := 1
- else
- let uncommon := 0
- endif
- if rare == 1
- let maxRoll := ar_Size category["rare"]
- let roll := rand minRoll maxRoll
- let item := category["rare"][roll]
- let count := rand minAddCount maxAddCount
- target.AddItem item count
- let i += 1
- continue
- elseif uncommon == 1
- let maxRoll := ar_Size category["uncommon"]
- let roll := rand minRoll maxRoll
- let item := category["uncommon"][roll]
- let count := rand minAddCount maxAddCount
- target.AddItem item count
- let i += 1
- continue
- else
- let maxRoll := ar_Size category["common"]
- let roll := rand minRoll maxRoll
- let item := category["common"][roll]
- let count := rand minAddCount maxAddCount
- target.AddItem item count
- let i += 1
- continue
- endif
- loop
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement