tModLoader How do I make my custom bow convert arrows like the molten fury

Code:
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
    if (type == ProjectileID.WoodenArrowFriendly) // any projectile/ammo
        {
            type = mod.ProjectileType("Whatever"); // change "Whatever" to your modded projectile
        }
    return true;
}
 
Code:
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
    if (type == ProjectileID.WoodenArrowFriendly) // any projectile/ammo
        {
            type = mod.ProjectileType("Whatever"); // change "Whatever" to your modded projectile
        }
    return true;
}
I am trying to do the same thing, but it's giving me errors for the Shoot hook (no suitable method found to override) and that Modthingig (my mod file) doesn't contain a definition for Projectile type (unless mod is supposed to be that?)
code:
using Terraria;
using Terraria.ID;
using Terraria.GameContent.Creative;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Modthingig.Projectiles;

namespace Modthingig.Items
{
internal class AluminumBow : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Aluminum Bow");
Tooltip.SetDefault("Turns Wooden Arrows to Electrified Arrows");
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
}
public override void SetDefaults()
{
Item.damage = 20;
Item.DamageType = DamageClass.Ranged;
Item.knockBack = 3;
Item.noMelee = true;
Item.autoReuse = true;
Item.useAnimation = 10;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Shoot;
Item.useAmmo = AmmoID.Arrow;
Item.value = Item.buyPrice(silver: 13);
Item.rare = ItemRarityID.White;
Item.crit = 12;
Item.height = 32;
Item.width = 16;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (type == ProjectileID.WoodenArrowFriendly) // any projectile/ammo
{
type=Modthingig.ProjectileType("ElectricArrow"); // change "Whatever" to your modded projectile
}
return true;
}
}
}
 
You are using old code, my above reply was from 2021, Shoot() is now updated to have an Entity Source as the first parameter. Let VS create the method and parameters for you.
 
You are using old code, my above reply was from 2021, Shoot() is now updated to have an Entity Source as the first parameter. Let VS create the method and parameters for you.
Ok, that did help, but how do I fix the error with [insert my mod's file name here] not containing a definition for ProjectileType?
or is it just "mod"?
Nevermind, I think I fixed it.
 
Last edited:
I'm here doing the same thing, I don't get any errors in my code but the arrows don't convert in game.

Code:
        public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
        {
            if (type == ProjectileID.FrostburnArrow)
            {
                type = ModContent.ProjectileType<Icicle>();
            
            }
            return true;
        }
Would appreciate any help
 
I'm here doing the same thing, I don't get any errors in my code but the arrows don't convert in game.

Code:
        public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
        {
            if (type == ProjectileID.FrostburnArrow)
            {
                type = ModContent.ProjectileType<Icicle>();
           
            }
            return true;
        }
Would appreciate any help
you have to return false/not return anything at all
 
Are you doing this from a specific item? What happens when you shoot a Frostburn Arrow?
I'm not sure if I understand what you mean by am I doing it from a specific item. When I shoot a frostburn arrow it just shoots the frostburn arrow nothing changes.

And if I understood what Osprey meant correctly changing the return value to false just makes it so that the bow doesn't shoot anything.

Sorry if I'm dumb I'm new to this, I can also provide the item code in its entirety if that helps
 
I'm not sure if I understand what you mean by am I doing it from a specific item. When I shoot a frostburn arrow it just shoots the frostburn arrow nothing changes.

And if I understood what Osprey meant correctly changing the return value to false just makes it so that the bow doesn't shoot anything.

Sorry if I'm dumb I'm new to this, I can also provide the item code in its entirety if that helps
Just remove the "return false" part. it worked for me. Also, I totally understand that you feel confused. I'm confused about something that I'm coding, actually.
 
He has to have a return statement or he'll get an error.

Check out examplegun, line 72, that does exactly what you are looking to do, changing 1 type of projectile to another. ExampleGun
 
Thanks for the help guys, I got it working by using ModifyShootStats and removing the return statement. The example was also helpful <3
 
Back
Top Bottom