module consumables - magemonkeystudio/divinity GitHub Wiki

๐Ÿท Consumables Module

The Consumables Module allows players to use special items (like potions or food) that apply buffs, restore health or hunger, and trigger commands or effects. Items can have cooldowns, target logic, class/level requirements, and more.


๐Ÿ“ File Structure

plugins/Divinity/modules/consumables/
โ”œโ”€โ”€ items/                # All custom consumables go here
โ”‚   โ””โ”€โ”€ small_loot_potion.yml
โ”œโ”€โ”€ settings.yml          # Global config

โš™๏ธ Global Configuration

File: settings.yml

command-aliases: consumables,consumes

consuming:
  allow-on-full-health: true   # Allow usage at full HP
  allow-on-full-food: true     # Allow usage at full hunger

item-format:
  name: '%ITEM_NAME%'
  lore:
    - '%ITEM_LORE%'

๐Ÿงช Example: Small Loot Potion

File: items/small_loot_potion.yml

material: POTION
name: '&eSmall Loot Potion %ITEM_LEVEL_ROMAN%'
lore:
  - '%ITEM_CHARGES%'
  - '&7Cooldown: &f1 minute&7.'
  - ''
  - '%USER_LEVEL%'
  - '%USER_CLASS%'
  - ''
  - '&7Increases a chance to find the item'
  - '&7by &f10%&7 for &f10 minutes&7.'
tier: common
effects:
  health: 0
  hunger: 0
  saturation: 0
usage:
  RIGHT:
    cooldown: 1
    actions:
      default:
        target-selectors:
          self:
            - '[SELF]'
        conditions:
          list: []
          actions-on-fail: 'null'
        action-executors:
          - '[COMMAND_CONSOLE] ~message: qrpg buff %executor% stat LOOT_RATE 10 600; ~target: self;'
          - '[PARTICLE_SIMPLE] ~name: VILLAGER_HAPPY; ~offset: 0.3,0.3,0.3; ~speed: 0.3; ~amount: 50; ~target: self;'
          - '[SOUND] ~name: BLOCK_NOTE_BLOCK_BELL; ~target: self;'

๐Ÿ” Field Reference

Field Description
material What item appears in-game
effects Controls health, hunger, and saturation gain
usage.RIGHT Defines behavior on right-click
cooldown Time before item can be used again
action-executors Executes commands, plays sounds, shows particles, etc.
target-selectors Determines who the effects/actions apply to ([SELF])

๐ŸŽฏ Bonus: Fabled Skill Integration

Consumables can trigger Fabled skills using this syntax:

action-executors:
  - '[COMMAND_CONSOLE] ~message: class forcecast %target% potionofhealingq1; ~target: self;'

Replace potionofhealingq1 with the skill defined in your Fabled skills list.


๐Ÿ’ฌ Commands & Permissions

Command Description Permission
/consumables help Show help page divinity.consumables.help
/consumables get <id> [level] [amount] Get an item divinity.consumables.get
/consumables give <player> <id> [level] [amount] Give an item divinity.consumables.give
/consumables drop <world> <x> <y> <z> <id> [level] [amount] Drop an item in the world divinity.consumables.drop
/consumables list [page] List available consumables divinity.consumables.list
/consumables reload Reload the module divinity.consumables.reload

๐Ÿ“Œ Notes

  • All consumables must be defined in the items/ folder.
  • %executor% is auto-filled with the player who used the item.
  • You can mix actions like commands, particles, and sounds.
  • Conditions can be added to control when actions succeed or fail.

๐Ÿ”— Return to Home

โ† Return to Home

โš ๏ธ **GitHub.com Fallback** โš ๏ธ