the name "mod" does not exist in the current context

MasterFraim

Terrarian
I have a problem that I haven't been able to cope with for two days now.

CS0103: name "mod" does not exist in the current context

here is my code:



using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Ler.Items
{
public class BookPY : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Book of PY");
Tooltip.SetDefault("This is a book");
Item.staff[Item.type] = true;

}

public override void SetDefaults()
{
Item.damage = 50;
Item.mana = 10;
Item.width = 28;
Item.height = 30;
Item.useTime = 10;
Item.useAnimation = 10;
Item.useStyle = 5;
Item.knockBack = 6;
Item.value = 10000;
Item.rare = 11;
Item.UseSound = SoundID.Item72;
Item.autoReuse = true;
Item.noMelee = true;
Item.autoReuse = true;
Item.shoot = mod.ProjectileType("RainbowShot1"); //← The problem here
Item.shootSpeed = 15f;
}
 
If RainbowShot1's files are in a different folder than this item, you'll need to add using Ler.Projectiles; (or whatever folder the projectile is in if it's not in Projectiles) at the top of the file as well, otherwise it won't be able to find your projectile.
 
If RainbowShot1's files are in a different folder than this item, you'll need to add using Ler.Projectiles; (or whatever folder the projectile is in if it's not in Projectiles) at the top of the file as well, otherwise it won't be able to find your projectile.
My shell code begins like this:

namespace Ler.Projectiles.Magic
{
public class RainbowShot1 : ModProjectile
{...

Shouldn't be a problem
 
If RainbowShot1's files are in a different folder than this item, you'll need to add using Ler.Projectiles; (or whatever folder the projectile is in if it's not in Projectiles) at the top of the file as well, otherwise it won't be able to find your projectile.
using Ler.Projectiles.Magic;

↑​

I added it at the beginning, but the error is still the same
 
I am having the same problem

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

namespace PopePiss.Items
{
public class StaffofGod : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Staff of God");
Tooltip.SetDefault("Be holy. Or Else.");
Item.staff[Item.type] = true;
}
public override void SetDefaults()
{
Item.damage = 10000000;
Item.mana = 0;
Item.DamageType = DamageClass.Magic;
Item.width = 10;
Item.height = 10;
Item.useTime = 10;
Item.useAnimation = 10;
Item.useStyle = 5;
Item.knockBack = 0;
Item.value = 100000;
Item.rare = 3;
Item.UseSound = SoundID.Item8;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<Godball>;
Item.shootSpeed = 5f;
Item.noMelee = true;
}
public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.SilverBar, 10);
recipe.AddIngredient(ItemID.Ruby, 1);
recipe.AddTile(TileID.WorkBenches);
recipe.Register();
}
}
}
Don't question the name.
 
Back
Top Bottom