Burst-Fire Weapons

You basically have the useAnimation greater than the useTime in your json file. Something like this.
Code:
"useAnimation": 17,
"useTime": 8,
 
You basically have the useAnimation greater than the useTime in your json file. Something like this.
Code:
"useAnimation": 17,
"useTime": 8,
I already know how to do this, and it's a bit wonky for what I intended to do.
The Clockwork Rifle fires three bullets at once, and at the cost of only one bullet. There's also a delay after the burst was over.
That's, from what I can tell, not possible with this method.
 
Probably has to do with this then. I don't really know what to do with it though.
Code:
public override bool ConsumeAmmo(Player p)
{
    if(item.itemTime == 0)
    {
          return true;
    }
    else
    {
          return false;
    }
}
 
Nevermind, i think I got it to work.
If you keep the item's useAnimation/useTime like this:
Code:
"useAnimation": 12,
"useTime":4,

And then use this code within your item cs file.
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using TAPI;
using Terraria;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ModName.Items
{
    public class ModItemName: ModItem
    {
        public override bool ConsumeAmmo(Player p)
        {
            if(p.itemAnimation < p.inventory[p.selectedItem].useAnimation - 8)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}

It shoots 3 times, only spending 1 ammo.
 
Nevermind, i think I got it to work.
If you keep the item's useAnimation/useTime like this:
Code:
"useAnimation": 12,
"useTime":4,

And then use this code within your item cs file.
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using TAPI;
using Terraria;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ModName.Items
{
    public class ModItemName: ModItem
    {
        public override bool ConsumeAmmo(Player p)
        {
            if(p.itemAnimation < p.inventory[p.selectedItem].useAnimation - 8)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}

It shoots 3 times, only spending 1 ammo.
This helps quite a bit! Still doesn't add the delay between the bursts that I want, but thanks anyway!
 
Well, if you want to add more delay between the bursts, I think you just need to increase both the useAnimation time and useTime time and adjust the
Code:
if(p.itemAnimation < p.inventory[p.selectedItem].useAnimation - 8 //this guy)
accordingly.
 
Back
Top Bottom