Skip to content
zackhehuman edited this page Feb 20, 2014 · 2 revisions

Bonus tables control the drop percentages for different items. Enemies can be assigned a specific bonus table -- for example a Robot Master may use a special "no-drop" bonus table to ensure that no item is spawned when they are defeated.

Defining the bonus table

Item drop percentages can be specified in game.json under the itemChances property. This property is an array of key/value pairs, pairing an item object template name with a drop percentage.

Example

The following example shows a "typical" bonus table, as found in Mega Man 2 or 3. Extra lives and e-tanks may drop 1% of the time, large energies 2%, and small energies 15% of the time, leaving a 64% chance that nothing will drop.

"itemChances": [
    { "Extra Life" : 1 },
    { "E-Tank" : 1 },
    { "Large Health Energy" : 2 },
    { "Large Weapon Energy" : 2 },
    { "Small Health Energy" : 15 },
    { "Small Weapon Energy" : 15 }
]

Defining a set of percentages where the sum is greater than 100% is undefined behavior. It doesn't make sense, so don't do it.

Special bonus tables

There is a special bonus table with an id of -1. If an Enemy object template specifies -1 as its bonus table index, this means that the enemy will not drop any items at all. This saves the game creator the work of defining an empty bonus table.

Clone this wiki locally