Battle Bee
Terrarian
I have a simple question.
How can I make a weapon burst-fire like the Clockwork Assault Rifle?
How can I make a weapon burst-fire like the Clockwork Assault Rifle?
"useAnimation": 17,
"useTime": 8,
I already know how to do this, and it's a bit wonky for what I intended to do.You basically have the useAnimation greater than the useTime in your json file. Something like this.
Code:"useAnimation": 17, "useTime": 8,
public override bool ConsumeAmmo(Player p)
{
if(item.itemTime == 0)
{
return true;
}
else
{
return false;
}
}
"useAnimation": 12,
"useTime":4,
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;
}
}
}
}
This helps quite a bit! Still doesn't add the delay between the bursts that I want, but thanks anyway!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.
if(p.itemAnimation < p.inventory[p.selectedItem].useAnimation - 8 //this guy)