How would I make a vanilla item into ammo?

desmondh2o🌳

Steampunker
I'm making a bow that using cactus as ammo, how would one make cactus into ammo and how would the code for that work and go? If anyone has any answers, that would be very appreiciated.
 
Not 100% sure on this but...
create a new cs file for this...
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ModName.Fileblablabla
{
    public class ModifyDefaults : GlobalItem
    {
        public override void SetDefaults(Item item)
        {
            if(item.type == ItemID.Cactus)
            {
                item.ammo = AmmoID.Bullet;
                item.shoot = ModContent.ProjectileType<customCactusProjectile>();
            }
        }
    }
}

and then create your own custom cactus projectile and make the bow shoot that projectile.

Although now every weapon can shoot cactus i think.
Atleast its a start. Probably wont be able to help much more than this.
 
Back
Top Bottom