Item Ammo [Artifacts]

Making items that require Ammo using Artifacts is easy! Artifacts comes with a built-in ammo system that stores Ammo in the item's lore.

Items that use the ammo system will only execute onUse skills if the item has sufficient ammo, and onUse will consume 1 ammo per shot.

Configuration

The configuration block for Ammo looks like this, with each attribute commented:

Ammo: 
  Enabled: TRUE            # Enabled the Ammo system
  Bullet: PistolClip       # Ammo type to use (references another Mythic Item)
  ClipSize: 8              # The maximum amount of ammo
  AmmoPerItem: 20          # How many Ammo the item gets per bullet when reloading
  

The item must also have an Ammunition line in the lore, like so:

Lore:
- "&fRequires Pistol Clips to fire."   
- ""
- "&7Ammunition 8 / 8"

Reloading

To reload an item, simply call the reloadammo{} mechanic in a skill. This mechanic will fail if the player does not have the required Bullet item.

I recommend binding this to an onSwing skill if making a gun, but you can also make your own other interesting ways of reloading (such as talking to an NPC that signals a skill).

Example

Here is an example Pistol item from my gun collection:

Pistol:
  Id: wood_sword
  Data: 0
  Display: '&7Pistol'
  Resource: Ammo
  Ammo: 
    Enabled: TRUE
    Bullet: PistolClip
    ClipSize: 8
    AmmoPerItem: 8
  Lore:
  - "&fRequires Pistol Clips to fire." 
  - "" 
  - "&7Ammunition 8 / 8"
  - "&7Durability 50 / 50"
  Hide:
  - ATTRIBUTES
  Attributes:
    MainHand:
      ATTACK_SPEED: -0.75
      DAMAGE: 1
  Skills:
  - skill{s=Pistol-Fire} @TargetLocation ~onUse
  - skill{s=Pistol-Reload} @self ~onSwing

artifacts/ammo.txt · Last modified: 2017/03/13 04:11 (external edit)