Namespace not found

aSnek147

Terrarian
I'm making a mod that adds Tizona and Vulcan Repeater back into the game, but I'm having a problem with the Vulcan Repeater. See the attached files.
How do I fix this? The repeater is based off the Example Gun.
 

Attachments

  • Terraria_ Can You Re-Dig-It_ 16_08_2022 12_53_36.png
    Terraria_ Can You Re-Dig-It_ 16_08_2022 12_53_36.png
    739.3 KB · Views: 36
  • C__Users_Maxan_Documents_My Games_Terraria_tModLoader_ModSources_TizonaMod_Items_VulcanRepeate...png
    C__Users_Maxan_Documents_My Games_Terraria_tModLoader_ModSources_TizonaMod_Items_VulcanRepeate...png
    105 KB · Views: 37
The full code for the repeater is:

Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace TizonaMod.Items
{
    public class VulcanRepeater : ModItem
    {
        public override void SetStaticDefaults() {
            
            Tooltip.SetDefault("");
        }

        public override void SetDefaults()
        {
            Item.damage = 56; // Sets the item's damage. Note that projectiles shot by this weapon will use its and the used ammunition's damage added together.
            Item.DamageType = DamageClass.Ranged;
            Item.width = 40; // hitbox width of the item
            Item.height = 20; // hitbox height of the item
            Item.useTime = 17; // The item's use time in ticks (60 ticks == 1 second.)
            Item.useAnimation = 20; // The length of the item's use animation in ticks (60 ticks == 1 second.)
            Item.useStyle = ItemUseStyleID.Shoot; // how you use the item (swinging, holding out, etc)
            Item.noMelee = true; //so the item's animation doesn't do damage
            Item.knockBack = 2.5f; // Sets the item's knockback. Note that projectiles shot by this weapon will use its and the used ammunition's knockback added together.
            Item.value = 10000; // how much the item sells for (measured in copper)
            Item.rare = ItemRarityID.Green; // the color that the item's name will be in-game
            Item.UseSound = SoundID.Item5; // The sound that this item plays when used.
            Item.autoReuse = true; // if you can hold click to automatically use it again
            Item.shoot = 10; //idk why but all the guns in the vanilla source have this
            Item.shootSpeed = 16; // the speed of the projectile (measured in pixels per frame)
            Item.useAmmo = AmmoID.Arrow; // The "ammo Id" of the ammo item that this weapon uses. Note that this is not an item Id, but just a magic value.
        }

        public override void AddRecipes() 
        {
            Recipe recipe = CreateRecipe();
            recipe.AddIngredient(ItemID.SoulofSight, 5);
            recipe.AddIngredient(ItemID.SoulofFright, 5);
            recipe.AddIngredient(ItemID.SoulofMight, 5);
            recipe.AddIngredient(ItemID.TitaniumBar, 15);
            recipe.AddIngredient(ItemID.HallowedRepeater, 1);
            recipe.AddTile(TileID.MythrilAnvil);
            recipe.Register();
            
            Recipe recipe2 = CreateRecipe();
            recipe2.AddIngredient(ItemID.SoulofSight, 5);
            recipe2.AddIngredient(ItemID.SoulofFright, 5);
            recipe2.AddIngredient(ItemID.SoulofMight, 5);
            recipe2.AddIngredient(ItemID.AdamantiteBar, 15);
            recipe2.AddIngredient(ItemID.HallowedRepeater, 1);
            recipe2.AddTile(TileID.MythrilAnvil);
            recipe2.Register();
        
        }

        /*
         * Feel free to uncomment any of the examples below to see what they do
         */

        // What if I wanted this gun to have a 38% chance not to consume ammo?
        /*public override bool ConsumeAmmo(Player player)
        {
            return Main.rand.NextFloat() >= .38f;
        }*/

        // What if I wanted it to work like Uzi, replacing regular bullets with High Velocity Bullets?
        // Uzi/Molten Fury style: Replace normal Bullets with High Velocity
        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) // or ProjectileID.WoodenArrowFriendly
            {
                type = ProjectileID.HellfireArrow; // or ProjectileID.FireArrow;
            }
            return true; // return true to allow tmodloader to call Projectile.NewProjectile as normal
        
            
            
        
        }
    }
}
 
Add using Microsoft.Xna.Framework; at the top of the code file. (Honestly, even if you don't think you need it, add it to all of your code files just in case)
 
1.4 changed the shoot method, here's the stuff from my code (With some comments added for where to put them)
C#:
using Terraria.DataStructures; //Goes at the top

public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) //Is the new method
{
    Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); //Is the new Projectile.NewProjectile for items
}
 
return false; (or true if you also want to shoot the projectile listed in SetDefaults) after the newprojectile code
 
Back
Top Bottom