tModLoader How to make modded bullet / ammo shoot out of a vanilla gun?

AxerTheAxe

Skeletron Prime
Hi! I have been looking everywhere for this but have not found it. I made a modded projectile and ammo that I want to shoot out of the vanilla snowball cannon. How do I do this? Thanks!
 
I don't have experience with modding, but I would think it's a specific value assigned only to the snowball. If you can extract that and copy it into your new item it might work. Good luck.
 
Hi! I have been looking everywhere for this but have not found it. I made a modded projectile and ammo that I want to shoot out of the vanilla snowball cannon. How do I do this? Thanks!
when making modded ammo, you usually have a thing that says item.ammo and you should try putting AmmoID.Snowball
 

HI, sorry for the delayed response I had things to do. I used some of the code you gave me, I get no errors but it doesent work. Here is my code:

C#:
public class SnowballCannon : GlobalItem
    {
        public override void SetDefaults(Item item)
        {
            if (item.type == ItemID.SnowballCannon)
            {
                item.ammo = mod.ItemType("IceBall");
                item.shoot = mod.ProjectileType("IceBallProjectile");
    
            }
        }
    }

Thanks for any help!
 
In your IceBall item, in SetDefaults
Code:
item.ammo = AmmoID.Snowball;
item.shoot = ModContent.ItemType<IceBallProjectile>();
 
Just woke up today and realized I told you to put ItemType instead of ProjectileType.
So try item.shoot = ModContent.ProjectileType<IceBallProjectile>();
 
Just woke up today and realized I told you to put ItemType instead of ProjectileType.
So try item.shoot = ModContent.ProjectileType<IceBallProjectile>();

I don't think you understand what I'm trying to do sry. I have a throwing weapon called "IceBall" that throws "IceBallProjectile" It workes fine.

I'm trying to have the snowball cannon use "IceBall" as ammo and shoot IceBallProjectile

I allready have item.shoot = ModContent.ProjectileType<IceBallProjectile>(); in my iceball code.

Sorry for any confusion and thank you for your help.
 
C#:
public class SnowballCannon : GlobalItem
    {
        public override void SetDefaults(Item item)
        {
            if (item.type == ItemID.SnowballCannon)
            {
                item.ammo = mod.ItemType("IceBall");
                item.shoot = mod.ProjectileType("IceBallProjectile");
   
            }
        }
    }

If you still have this in your code, remove it
 
I see what you are trying to do but I have no idea how to work this way when making ammo. so I'll let you see how my ammo works to try and help you.

public class ChlarospharicBullet : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("ChlarospharicBullet");
Tooltip.SetDefault("would it be called chlarosphic or chlarosphine?");
}

public override void SetDefaults()
{
item.damage = 45;
item.ranged = true;
item.width = 8;
item.height = 8;
item.maxStack = 9999;
item.consumable = true;
item.knockBack = 16f;
item.value = 1;
item.rare = 2;
item.shoot = mod.ProjectileType("ChlarospharicBullet"); // replace with your projectile
item.shootSpeed = 20f;
item.ammo = AmmoID.Bullet; // replace with snowball
 
I see what you are trying to do but I have no idea how to work this way when making ammo. so I'll let you see how my ammo works to try and help you.

public class ChlarospharicBullet : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("ChlarospharicBullet");
Tooltip.SetDefault("would it be called chlarosphic or chlarosphine?");
}

public override void SetDefaults()
{
item.damage = 45;
item.ranged = true;
item.width = 8;
item.height = 8;
item.maxStack = 9999;
item.consumable = true;
item.knockBack = 16f;
item.value = 1;
item.rare = 2;
item.shoot = mod.ProjectileType("ChlarospharicBullet"); // replace with your projectile
item.shootSpeed = 20f;
item.ammo = AmmoID.Bullet; // replace with snowball


Thanks for all the help / replying!
 
Back
Top Bottom