Skip to content
This repository has been archived by the owner on Oct 5, 2019. It is now read-only.

port library: lootastic (used to roll drops for npcs) #13

Open
Oipo opened this issue Oct 1, 2019 · 0 comments
Open

port library: lootastic (used to roll drops for npcs) #13

Oipo opened this issue Oct 1, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@Oipo
Copy link
Contributor

Oipo commented Oct 1, 2019

basically, it's like those dumb statistics exercises you might have done in school. it lets you build a loot table with an array of items in it. an item has a string result (used to look up the item, in most cases) as well as a chance. chance is a relative value - an item with a chance of 1 compared to another with a chance of 2 will drop half as often. 1 compared to 10 is 1/10 as often. the algorithm is pretty simple to do weighted picks.

this is also used for npc skill picking and spawner npc picking.

it offers flexibility for example with choosing. you can choose with replacement, without replacement, or try to drop each item individually

if you drop with replacement, it will try to drop X items using the same pool each time. the npc dropPool feature uses this.

if you drop without replacement, it will try to drop X items, but each time it drops one, it will remove from the pool for the next pick. the npc dropPool feature also uses this. it is also used for npc gear picking (since each slot can only hold one item, it doesn't matter if you use with or without replacement though)

trying to drop each item means it will try to drop each item on a relative scale of chance/maxChance (usually in this case, chance is always 1, but maxChance is 1000, 100000, or whatever). this is used in npc drops.

if maxChance is specified in the first two algorithms, I believe it is ignored.

if chance is set to -1, it always drops. you will see this in npc copyDrops, npc drops

it also offers helpers for you to roll multiple tables at once and get an aggregate set of results, I use this when an npc dies to roll global, map, region, and npc drop tables all at once

@Oipo Oipo added the enhancement New feature or request label Oct 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant