-
Notifications
You must be signed in to change notification settings - Fork 1
Loot table format
This is how basic format looks. In dungeon loot table, it will fill chest with 1 red wool and 10 yellow wool. In campfire table, it will fill chest with wooden pickaxe with Efficiency II. I hope this one is self explanatory.
Dungeon:
Items:
- item:
id: 35
damage: 14
- item:
id: 35
damage: 4
amount: 10
Campfire:
Items:
- item:
id: 270
enchants:
- enchant:
id: 32
level: 2
Each node can have certain chance to get executed. There are two variables: chance and rolls.
- item:
rolls: 3
chance: 0.5
id: 35
damage: 14
In above example, item has 50% chance of getting into chest. But dice is rolled 3 times so player can potentially get that item up to 3 times.
Pick node is useful when you want to pick an item between several different items. It is inserted alongside item or enchant nodes:
- item:
...
- item:
...
- pick
...
Pick is simple parent node and will pick one of the child nodes:
- pick:
- item:
id: 35
damage: 14
- item:
id: 35
damage: 4
In above example, either red or yellow wool will be picked and put into chest.
You may also order it to pick multiple items. For example:
- pick 2:
- item:
id: 35
damage: 1
- item:
id: 35
damage: 2
- item:
id: 35
damage: 3
- item:
id: 35
damage: 4
Above example will pick 2 wools out of 4 provided.
In above examples, all items have same chance of being picked (their weight is 1). But you can specify weight of every item to alter its chance of being picked. You add weights after number of items (which must be provided in that case).
- pick:
- weights 10 20 30 40
- item:
id: 35
damage: 1
- item:
id: 35
damage: 2
- item:
id: 35
damage: 3
- item:
id: 35
damage: 4
In above example first item have weight 1, second item have weight 2, third item have weight 1 and fourth item have weight 2. That means items 2 and 3 have twice chances of being picked than other items because their weight is doubled.
As with other items, you can also define chance and rolls for pick, although a bit differently.
- pick:
- chance 0.7
- rolls 10
- item:
id: 35
damage: 14
- item:
id: 35
damage: 4
Above means that 70% chance must be met for anything to be picked. And again, this is executed 10 times so potentially item inside can be picked up to 10 times.
- pick 2:
- item:
id:1
- group:
- item:
id: 5
- item:
id: 20
- item:
id: 30
You can create groups, so you can pick one item or group of multiple items. Of course groups themselves can also contain chance and rolls parameters, in same syntax than picks.
You can now also use nbt tags on items. For example:
- item:
id: 401
nbt:
Explosion:
compound:
Type:
byte: 0
Colors:
intArray:
- 65361
Trail:
byte: 1
display:
compound:
Name: 'Kaboom '
Lore:
- Biggest
- Explosion
- Ever
Above example would create firework with custom parameters. You just add nbt: tag to item and after that paste nbt structure from MCNSANanobot.
Everything that controls interactions between players and chests. It is in its own node:
Dungeon:
Items:
...
PlayerControl:
...
To prevent players abusing restockable chests, you can reduce chances of getting items on access. So every time player picks up items and they have to reset, all chances will reduce.
PlayerControl:
ChanceDiminishing:
SubtractChanceOnce: 0.5
SubtractChances: 0.9
ZeroChanceMessage: '&cYou''ve used up all chances for items in this chest.
Find more around the map.'
Explanation on how above is working:
so let’s assume item has chance 1.0
and SubOnce is 0.35
and SubChances is 0.2
first loot: 1.0
second: 0.65
third: 0.45
fourth: 0.25
fifth: 0.05 and sixth: less than zero, ZeroChanceMessage.
PlayerControl:
MaximumDisplayedAccessNumber: 10
If number of restocks exceeds this number, this number and plus sign will be displayed (so 10+ instead of 11).
This timeout prevents player from getting valuables by opening chests of same time. When one chest is opened, timeout is applied which lowers any further chance for that chest by specified amount until timeout ends.
This is also per-table:
PlayerControl:
MultiChestTimeout:
Timeout: 10
Message: "You should in <TimeLeft>."
ExclusionRangeSquared: 900
In above example, when player opens chest, he will get 10 minute timeout. So if he tries to open chest of same type in next 10 minutes, his chance for every item will reduce by 0.5.
If player opens chest before 10 minute timeout is reached, timer resets.
But if player opens chest that is within ExclusionRange blocks, he can still open. So player can explore whole structure, but not others.
If Loot table has poison defined, it will have chance to apply potion effect defined in damage node.
PlayerControl:
Poison:
Chance: 0.3
ApplyDamageNode: "CampfirePoison"
If player accesses chest at wrong times (for example graveyard at night), chest will not be restocked.
PlayerControl:
TimeRestrict:
MinTime: 13500
MaxTime: 23000
Message: "Graveyard only displays its treasures at night!"
Above will restrict restocking of chest only between in-game time 13500 and 23000. If player opens chest at inappropriate time, he will get set message.