Drop Tables - GregHib/void GitHub Wiki
Players are rewarded for killing monsters with Item that are dropped on the floor on their death, the items dropped are selected at random from a table of options which vary depending on the type monster defeated.
Drop tables are defined inside drops.yml
chicken_drop_table: # Name of the table
type: all # How to pick from this table
drops: # List of potential drops
# Nested sub table for 100% drops
- type: all # Drop every item in this sub-table
# Default roll is 1
drops:
- id: raw_chicken # Default 100% chance to drop 1
- id: bones
# Nested sub-table for main drop
- roll: 128 # Roll a random number between 1-128
# Default type "first" stops after one drop
drops:
- id: feather
amount: 5
chance: 64 # Drop 5 feathers if roll lands between 1-64 (50% chance)
- id: feather
amount: 10-15 # Drop between 10 and 15 feathers if roll lands between 64-96 (25% chance)
chance: 32
members: true # Only drop on members worlds
# Drop nothing if roll lands between 96-128 (25% chance)
# Nested sub-table for rare drop
- roll: 300 # Roll between 1-300
drops:
- id: clue_scroll_easy # Drop easy clue scroll if lands on 1 (0.3% chance)
chance: 1
lacks: clue_scroll_easy* # Drop only if player doesn't already own an easy clue scroll
- id: super_large_egg
chance: 1
variable: cooks_assistant_egg # Variable to check
equals: false # Check if the variable is equal to this
default: false # The default value of the variable if it's not set on the player
There are two table types by default a tables type will be first
.
-
all
- drop every item listed -
first
- drop only one item
Tables with type all
will drop every item or call every sub-table listed, as such no chance
parameter is required as all items have a 100% chance of being selected.
cow_guaranteed_table:
type: all
drops:
- id: cowhide
- id: raw_beef
- id: bones
Most tables however roll a random number between 0 and roll
and select the first drop in the list that the cumulative chance
is within.
For example take this table:
talisman_drop_table:
roll: 70
drops:
- id: air_talisman
chance: 10
- id: body_talisman
chance: 10
- id: earth_talisman
chance: 10
- id: fire_talisman
chance: 10
- First we roll a random number between 0-70. Let's say 22.
- We check down the list of items starting from the top and a chance of 0
- For
air_talisman
22 is not within 0-10; so we move on adding 10 to our total. - For
body_talisman
22 is not within 10-20; so we move on, adding 10 to our total. - For
earth_talisman
2 is within 20-30. Soearth_talisman
is our selected drop.
Warning
Drops chances should never exceed the tables roll
as that could mistakenly give some drops a 0% chance.
Tables can also be drops themselves allowing for nesting and control over "groups" of drops.
The following example will always drop bones
and raw_rat_meat
but giant_rat_bones
will only have a 25% of being dropped
giant_rat_drop_table:
type: all
drops:
- drops:
- id: bones
- id: raw_rat_meat
- roll: 4
drops:
- id: giant_rat_bone
chance: 1
Items can have optional conditions for being dropped by specifying a variable and the value it should match
drops:
- id: blood_rune
chance: 2
amount: 2
members: true # Spawn only on members worlds
- id: clue_scroll_elite
variable: elite_clue # The variable to check
equals: false # The value to compare against equally
default: false # The default value if the variable is not set
- id: rats_paper
variable: what_lies_below_stage # The variable to check
within: 2-4 # The range the variable value must be within (inclusive)
default: 0
Drops can also have optional conditions if a player owns (has on them or in their bank) or does not own a particular item using the owns
or lacks
fields.
drops:
- id: small_pouch
chance: 6
lacks: small_pouch # Only drop if the player doesn't have a small pouch already
- id: medium_pouch
chance: 6
charges: 45
owns: small_pouch # Only drop if player owns a small pouch
lacks: medium_pouch* # But not if the player owns any type of medium pouch (i.e. medium_pouch or medium_pouch_damaged)
You can specify a drop table for a monster simply by naming a table in either a <npc_id>_drop_table
, or <npc_race>_drop_table
format.
The more specific table name will be used first, for example the King Black Dragon will use the king_black_dragon_drop_table
even though it is classified as one of the dragon race in npcs.yml
, where a Green Dragon will use dragon_drop_table
as a green_dragon_drop_table
doesn't exist.
green_dragon:
id: 941
race: dragon
examine: "Must be related to Elvarg."
king_black_dragon:
id: 50
race: dragon
examine: "One of the biggest, meanest dragons around."
Drop tables can be converted from the osrs and rs3 wiki pages (with some exceptions) using DropTableConverter.kt.
Find the drops section of an npcs wiki page, in this example we'll use Dark wizards.
Clicking on "edit source" will reveal the underlying Wikitext:
Copy and paste the wikitext into and run the DropTableConverter
The converter will print out the drop table in YAML with the quanities and rarities converted
drop_table:
roll: 128
drops:
- id: nature_rune
chance: 7
amount: 4
- id: chaos_rune
chance: 6
amount: 5
- id: mind_rune
chance: 3
amount: 10
- id: body_rune
chance: 3
amount: 10
- id: mind_rune
chance: 2
amount: 18
- id: body_rune
chance: 2
amount: 18
- id: blood_rune
chance: 2
amount: 2
members: true
- id: cosmic_rune
amount: 2
- id: law_rune
amount: 3
Caution
The converter doesn't verify item ids, so an item named "Wizard hat" will be
converted to wizard_hat
even though the items.yml
id is black_wizard_hat
.
Any incorrect ids will be printed out on server startup: [ItemDrop] - Invalid drop id wizard_hat
.
Warning
The converter won't correctly convert most variable conditions such as drop limits, dynamic drop rates, quest requirements or other exceptions. These will need to be added manually.