tModLoader Issue with ANY modded projectiles I create

ZedCoal9

Official Terrarian
Here is the error I get:
Screenshot 2021-11-28 161328.png


Here's my code:

The Weapon:

using Terraria;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.DataStructures;
using Terraria.Enums;
using System.IO;
using Terraria.ModLoader.IO;
using Terraria.Utilities;

namespace MashOfMad.Items.Weapons
{
public class Butterknife : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Ancient Butterknife");
Tooltip.SetDefault("Wait... who uses this as a Butterknife?!");
}


public override void SetDefaults()
{
item.damage = 140;
item.melee = true;
item.width = 66;
item.height = 70;
item.useTime = 0;
item.useAnimation = 25;
item.channel = true;
item.noMelee = true;
item.useStyle = 5;
item.knockBack = 3;
item.value = Item.buyPrice(0, 22, 50, 0);
item.rare = 9;
item.UseSound = SoundID.Item13;
item.autoReuse = true;
item.shoot = mod.ProjectileType("Swooshy");
item.shootSpeed = 40f;

}

public bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)

{
float numberProjectiles = 3;
float rotation = MathHelper.ToRadians(45);
position += Vector2.Normalize(new Vector2(speedX, speedY)) * 45f;
for (int i = 0; i < numberProjectiles; i++)
{
Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1))) * .2f;
Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI);
}
return false;
}



}
}


And here's the projectile:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace MashOfMad.Items.Weapons
{
class Swooshy : ModProjectile
{
public void SetDefaults()
{
projectile.CloneDefaults(ProjectileID.Arkhalis);
projectile.Name = "Swooshy";
aiType = ProjectileID.Arkhalis;
}

public bool Autoload(ref string name, ref string texture)
{
texture = "Terraria/Projectile_" + ProjectileID.Arkhalis;
return true;
}

public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Stoned, 30);
}
}
}

Note that both are in the weapons folder. Whats going on here?
 
Please put your code in a code block next time. It makes it much easier to read.

projectile.Name is not a thing. Use DisplayName.SetDefault("Swooshy"); in SetStaticDefaults() instead.
The Autoload section of your projectile is not needed. Just replace the whole thing with public override string Texture => "Terraria/Projectile_" + ProjectileID.Arkalis;
That should fix your issue.
 
Please put your code in a code block next time. It makes it much easier to read.

projectile.Name is not a thing. Use DisplayName.SetDefault("Swooshy"); in SetStaticDefaults() instead.
The Autoload section of your projectile is not needed. Just replace the whole thing with public override string Texture => "Terraria/Projectile_" + ProjectileID.Arkalis;
That should fix your issue.
Sorry about that! How do I make a block? I havent been here long
 
Please put your code in a code block next time. It makes it much easier to read.

projectile.Name is not a thing. Use DisplayName.SetDefault("Swooshy"); in SetStaticDefaults() instead.
The Autoload section of your projectile is not needed. Just replace the whole thing with public override string Texture => "Terraria/Projectile_" + ProjectileID.Arkalis;
That should fix your issue.
And also, thank you!
 
Sorry about that! How do I make a block? I havent been here long
Click the three vertical dots when writing a post (next to the emoji button). Then click "Code" </> for a code block or "Inline Code" >_ for a short bit of code text. You can also specify the language in a code block.
C++:
cout << "This is a code block!" << endl;
This is inline code!

If you have other coding questions, I recommend joining the tModLoader Discord server. It has a lot more people who know what they are talking about. There is a modding help channel where you can ask questions.
 
Click the three vertical dots when writing a post (next to the emoji button). Then click "Code" </> for a code block or "Inline Code" >_ for a short bit of code text. You can also specify the language in a code block.
C++:
cout << "This is a code block!" << endl;
This is inline code!

If you have other coding questions, I recommend joining the tModLoader Discord server. It has a lot more people who know what they are talking about. There is a modding help channel where you can ask questions.
Code:
//: Nice
 
Back
Top Bottom