Ammo

Add consumable ammunition to your guns

If you want to prevent players from shooting guns forever, you should use Ammo. Ammo is split into 2 sections, the Weapon Config and the Ammo Config.

Weapon Config

<weapon>:
  Reload: # Make sure that the Ammo section is INSIDE the Reload section!
    Ammo: 
      Out_Of_Ammo_Mechanics: <Mechanics>
      Ammo_Switch_Trigger: <Trigger>
      Ammo_Switch_Mechanics: 
      Ammos:
        - <ammo1>
        - <ammo2>

Out_Of_Ammo_Mechanics

The mechanics triggered when the player tries to shoot but the weapon is empty. Use the Mechanics wiki.

  • @Source{} -> The player who tried to shoot.

Ammo_Switch_Trigger

The Trigger that is used to switch between ammo types. Typically, you use SWAP_HANDS. For example:

      Ammo_Switch_Trigger:
        Main_Hand: SWAP_HANDS
        Off_Hand: SWAP_HANDS

Ammo_Switch_Mechanics

The mechanics triggered when you swap ammo types (So, right after the Ammo_Switch_Trigger is used).

Ammos

A list of all ammunition that this weapon can use. A typical server will only have 1 ammunition per gun. However, if you purchase WeaponMechanicsPlus, then you can make explosive ammo, fire ammo, and much more!

For example:

      Ammos:
        - Rocket  # This Rocket is defined in the Ammo Config (see below)

Ammo Config

So where does the ammo config go? Not in the weapon files! Instead, go to yourserver -> plugins -> WeaponMechanics -> ammos and create a new .yml file (Or use the default one).

Make sure you replace <ammo_title> with a unique name for your ammo, and do not use any special characters. For example, .50 will not work but 50_Caliber is good.

<ammo_title>:
  Symbol: <string>
  Experience_As_Ammo_Cost: <amount>
  Money_As_Ammo_Cost: <amount>
  Item_Ammo:
    Bullet_Item: <Item>
    Magazine_Item: <Item>
    Ammo_Converter_Check:
      Type: <true/false>
      Name: <true/false>
      Lore: <true/false>
      Enchantments: <true/false>
      Custom_Model_Data: <true/false>

Symbol

This is what is displayed by the <ammo_type> placeholder in your Weapon_Info_Display. If you do not use any Symbol, it defaults to the ammo title.

Experience_As_Ammo_Cost

Consumes experience points (not levels) to load your gun. Most mobs drop 5 experience points.

Money_As_Ammo_Cost

If you have Vault installed, you can consume currency to load your gun.

Item_Ammo

Consumes items to be used as ammo. You can use one of Bullet_Item or Magazine_Item, or you can use both.

  • Bullet_Item

    • The item for individual bullets.

  • Magazine_Item

    • The item for full magazines to load into the gun.

  • Ammo_Converter_Check

    • (Optional)

    • Converts vanilla items into ammo usable by WeaponMechanics automatically.

    • For example, Type: true will convert all items of the same material to usable ammo.

    • This is the same as Weapon_Converter_Check.

Last updated