tModLoader Error CS0115. Need help please.

Phobostar

Spazmatism
error CS0115: 'EyeOfFleshMod.Items.Armor.PhobosHelm.PostDrawInWorld(Microsoft.Xna.Framework.Graphics.SpriteBatch, Microsoft.Xna.Framework.Color, Microsoft.Xna.Framework.Color, float, float, float)': no suitable method found to override

Code:
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace EyeOfFleshMod.Items.Armor
{
    [AutoloadEquip(EquipType.Head)]
    public class PhobosHelm : ModItem
    {
        public override void SetStaticDefaults()
        {
             base.SetStaticDefaults();
             DisplayName.SetDefault("Phobos Filter");
        }

        public override void SetDefaults()
        {
            item.width = 24;
            item.height = 26;
            item.value = 1000000;
            item.rare = 7;
            item.defense = 36;
        }

        public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float  scale, float whoAmI)    
        {
            Texture2D texture = mod.GetTexture("Items/PhobosHelm_Glowmask");
            spriteBatch.draw
        (
        texture,
        new Vector2
        (
            item.position.X - Main.screenPosition.X + item.width * 0.5f,
            item.position.Y - Main.screenPosition.Y + item.height - texture.Height * 0.5f + 2f
        ),
        new Rectangle(0, 0, texture.Width, texture.Height),
        Color.White,
        rotation,
        texture.Size() * 0.5f,
        scale,
        SpriteEffects.None,
        0f
        );
        }

        public override bool IsArmorSet(Item head, Item body, Item legs)
        {
            return body.type == mod.ItemType("PhobosPlate") && legs.type == mod.ItemType("PhobosLegs");
        }
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "Phobostar's Blessing";
            player.meleeCrit += 0.17f;
            player.rangedDamage += 0.16f;
            player.rangedCrit += 0.07f;
            player.AddBuff(BuffID.Gravitation, 2);
            player.AddBuff(BuffID.WeaponImbueIchor, 2);
            player.AddBuff(BuffID.SolarShield1, 2);
        }
    }

I had a lot of errors with this armor. I am just trying to add a Glowmask.
 
Could you help me again?

PhobosHelm.cs(46,16) : error CS1061: 'Microsoft.Xna.Framework.Graphics.SpriteBatch' does not contain a definition for 'draw' and no extension method 'draw' accepting a first argument of type 'Microsoft.Xna.Framework.Graphics.SpriteBatch' could be found (are you missing a using directive or an assembly reference?)

Code:
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace EyeOfFleshMod.Items.Armor
{
    [AutoloadEquip(EquipType.Head)]
    public class PhobosHelm : ModItem
    {
        public override void SetStaticDefaults()
        {
             base.SetStaticDefaults();
             DisplayName.SetDefault("Phobosnian Filter");
             Tooltip.SetDefault("'The dust on Phobos can cut your lungs, so better wear this.'");
        }

        public override void SetDefaults()
        {
            item.width = 24;
            item.height = 26;
            item.value = 1000000;
            item.rare = 7;
            item.defense = 36;
        }

        public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float  scale, int whoAmI)    
        {
            Texture2D texture = mod.GetTexture("Items/PhobosHelm_Glowmask");
            spriteBatch.draw
        (
        texture,
        new Vector2
        (
            item.position.X - Main.screenPosition.X + item.width * 0.5f,
            item.position.Y - Main.screenPosition.Y + item.height - texture.Height * 0.5f + 2f
        ),
        new Rectangle(0, 0, texture.Width, texture.Height),
        Color.White,
        rotation,
        texture.Size() * 0.5f,
        scale,
        SpriteEffects.None,
        0f
        );
        }

        public override bool IsArmorSet(Item head, Item body, Item legs)
        {
            return body.type == mod.ItemType("PhobosPlate") && legs.type == mod.ItemType("PhobosLegs");  //put your Breastplate name and Leggings name
        }
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "Phobostar's Blessing";
            player.meleeCrit += 0.17f;
            player.rangedDamage += 0.16f;
            player.rangedCrit += 0.07f;
            player.AddBuff(BuffID.Gravitation, 2);
            player.AddBuff(BuffID.WeaponImbueIchor, 2);
            player.AddBuff(BuffID.SolarShield1, 2);
        }
    }
}

Sorry for being such a dummy. It is probably something obvious.
 
I guess you aren't using Visual Studio, I highly recommend it or you'll never notice these syntax errors. draw should be Draw, and crit chances are ints,


 
Hello, i have the same problem, can i get assistance?

Error : CS1061

Items :

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace TutorialMOD.Items
{
public class CustomBeamWeapon : ModItem
{
public override void SetDefaults()
{
item.name = "Beam of Destruction"; //the name displayed when hovering over the Weapon ingame.
item.damage = 999; //The damage stat for the Weapon.
item.toolTip = "The fate of everything rest in your hands..."; //The description of the Weapon shown when hovering over the Weapon ingame.
item.noMelee = true; //Setting to True allows the weapon sprite to stop doing damage, so only the projectile does the damge
item.noUseGraphic = false;
item.magic = true; //This defines if it does magic damage and if its effected by magic increasing Armor/Accessories.
item.channel = true; //Channel so that you can held the weapon
item.mana = 0; //How mutch mana this weapon use
item.rare = -11; //The color the title of your Weapon when hovering over it ingame
item.width = 28; //The size of the width of the hitbox in pixels.
item.height = 30; //The size of the height of the hitbox in pixels.
item.useTime = 7; //How fast the Weapon is used.
item.UseSound = SoundID.Item13; //The sound played when using your Weapon
item.useStyle = 5; //The way your Weapon will be used, 5 is the Holding Out Used for: Guns, Spellbooks, Drills, Chainsaws, Flails, Spears for example
item.shootSpeed = 4f; //This defines the projectile speed when shoot
item.useAnimation = 7; //Speed is not important here
item.shoot = mod.ProjectileType("CustomBeamProj"); //This defines what type of projectile this weapon will shoot
item.value = Item.sellPrice(0, 0, 0, 0);// How much the item is worth, in copper coins, when you sell it to a merchant. It costs 1/5th of this to buy it back from them. An easy way to remember the value is platinum, gold, silver, copper or PPGGSSCC (so this item price is 3gold)
}
}
}

Projectile :


using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Terraria.Enums;
namespace TutorialMOD.Projectiles
{
public class CustomBeamProj : ModProjectile
{
private Vector2 _targetPos; //Ending position of the laser beam
private int _charge; //The charge level of the weapon
private float _moveDist = 45f; //The distance charge particle from the player center
public override void SetDefaults()
{
projectile.name = "Custom Laser Beam"; //this is the projectile name
projectile.width = 10;
projectile.height = 10;
projectile.friendly = true; //this defines if the projectile is frendly
projectile.penetrate = -1; //this defines the projectile penetration, -1 = infinity
projectile.tileCollide = false; //this defines if the tile can colide with walls
projectile.magic = true;
projectile.hide = true;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
if (_charge == 100)
{
Vector2 unit = _targetPos - Main.player[projectile.owner].Center;
unit.Normalize();
DrawLaser(spriteBatch, Main.projectileTexture[projectile.type], Main.player[projectile.owner].Center, unit, 5, projectile.damage, -1.57f, 1f, 1000f, Color.White, 45);// this is the projectile sprite draw, 45 = the distance of where the projectile starts from the player
}
return false;
}
/// <summary>
/// The core function of drawing a laser
/// </summary>
public void DrawLaser(SpriteBatch spriteBatch, Texture2D texture, Vector2 start, Vector2 unit, float step, int damage, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default(Color), int transDist = 50)
{
Vector2 origin = start;
float r = unit.ToRotation() + rotation;
#region Draw laser body
for (float i = transDist; i <= _moveDist; i += step)
{
Color c = Color.White;
origin = start + i * unit;
spriteBatch.Draw(texture, origin - Main.screenPosition,
new Rectangle(0, 26, 28, 26), i < transDist ? Color.Transparent : c, r,
new Vector2(28 / 2, 26 / 2), scale, 0, 0);
}
#endregion
#region Draw laser tail
spriteBatch.Draw(texture, start + unit * (transDist - step) - Main.screenPosition,
new Rectangle(0, 0, 28, 26), Color.White, r, new Vector2(28 / 2, 26 / 2), scale, 0, 0);
#endregion
#region Draw laser head
spriteBatch.Draw(texture, start + (_moveDist + step) * unit - Main.screenPosition,
new Rectangle(0, 52, 28, 26), Color.White, r, new Vector2(28 / 2, 26 / 2), scale, 0, 0);
#endregion
}
/// <summary>
/// Change the way of collision check of the projectile
/// </summary>
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (_charge == 100)
{
Player p = Main.player[projectile.owner];
Vector2 unit = (Main.player[projectile.owner].Center - _targetPos);
unit.Normalize();
float point = 0f;
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), p.Center - 95f * unit, p.Center - unit * _moveDist, 22, ref point))
{
return true;
}
}
return false;
}
/// <summary>
/// Change the behavior after hit a NPC
/// </summary>
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[projectile.owner] = 5;
}
/// <summary>
/// The AI of the projectile
/// </summary>
public override void AI()
{
Vector2 mousePos = Main.MouseWorld;
Player player = Main.player[projectile.owner];
#region Set projectile position
if (projectile.owner == Main.myPlayer) // Multiplayer support
{
Vector2 diff = mousePos - player.Center;
diff.Normalize();
projectile.position = player.Center + diff * _moveDist;
projectile.timeLeft = 2;
int dir = projectile.position.X > player.position.X ? 1 : -1;
player.ChangeDir(dir);
player.heldProj = projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (float)Math.Atan2(diff.Y * dir, diff.X * dir);
projectile.soundDelay--;
#endregion
}
#region Charging process
// Kill the projectile if the player stops channeling
if (!player.channel)
{
projectile.Kill();
}
else
{
if (Main.time % 10 < 1 && !player.CheckMana(player.inventory[player.selectedItem].mana, true))
{
projectile.Kill();
}
Vector2 offset = mousePos - player.Center;
offset.Normalize();
offset *= _moveDist - 20;
Vector2 dustPos = player.Center + offset - new Vector2(10, 10);
if (_charge < 100)
{
_charge++;
}
int chargeFact = _charge / 20;
Vector2 dustVelocity = Vector2.UnitX * 18f;
dustVelocity = dustVelocity.RotatedBy(projectile.rotation - 1.57f, default(Vector2));
Vector2 spawnPos = projectile.Center + dustVelocity;
for (int k = 0; k < chargeFact + 1; k++)
{
Vector2 spawn = spawnPos + ((float)Main.rand.NextDouble() * 6.28f).ToRotationVector2() * (12f - (chargeFact * 2));
Dust dust = Main.dust[Dust.NewDust(dustPos, 30, 30, 235, projectile.velocity.X / 2f, //this 30, 30 is the dust weight and height 235 is the tail dust
projectile.velocity.Y / 2f, 0, default(Color), 1f)];
dust.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f;
dust.noGravity = true;
dust.scale = Main.rand.Next(10, 20) * 0.05f;
}
}
#endregion
#region Set laser tail position and dusts
if (_charge < 100) return;
Vector2 start = player.Center;
Vector2 unit = (player.Center - mousePos);
unit.Normalize();
unit *= -1;
for (_moveDist = 95f; _moveDist <= 1600; _moveDist += 5) //this 1600 is the dsitance of the beam
{
start = player.Center + unit * _moveDist;
if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1))
{
_moveDist -= 5f;
break;
}
if (projectile.soundDelay <= 0)//this is the proper sound delay for this type of weapon
{
Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 15); //this is the sound when the weapon is used cheange 15 for diferent sound
projectile.soundDelay = 40; //this is the proper sound delay for this type of weapon
}
}
_targetPos = player.Center + unit * _moveDist;
//dust
for (int i = 0; i < 2; ++i)
{
float num1 = projectile.velocity.ToRotation() + (Main.rand.Next(2) == 1 ? -1.0f : 1.0f) * 1.57f;
float num2 = (float)(Main.rand.NextDouble() * 0.8f + 1.0f);
Vector2 dustVel = new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2);
Dust dust = Main.dust[Dust.NewDust(_targetPos, 0, 0, 235, dustVel.X, dustVel.Y, 0, new Color(), 1f)]; //this is the head dust
Dust dust2 = Main.dust[Dust.NewDust(_targetPos, 0, 0, 235, dustVel.X, dustVel.Y, 0, new Color(), 1f)]; //this is the head dust 2
dust.noGravity = true;
dust.scale = 1.2f;
}

#endregion
}
public override bool ShouldUpdatePosition()
{
return false;
}

}
}
 
Last edited:
Hello, i have the same problem, can i get assistance?

Error : CS1061

Items :

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace TutorialMOD.Items
{
public class CustomBeamWeapon : ModItem
{
public override void SetDefaults()
{
item.name = "Beam of Destruction"; //the name displayed when hovering over the Weapon ingame.
item.damage = 999; //The damage stat for the Weapon.
item.toolTip = "The fate of everything rest in your hands..."; //The description of the Weapon shown when hovering over the Weapon ingame.
item.noMelee = true; //Setting to True allows the weapon sprite to stop doing damage, so only the projectile does the damge
item.noUseGraphic = false;
item.magic = true; //This defines if it does magic damage and if its effected by magic increasing Armor/Accessories.
item.channel = true; //Channel so that you can held the weapon
item.mana = 0; //How mutch mana this weapon use
item.rare = -11; //The color the title of your Weapon when hovering over it ingame
item.width = 28; //The size of the width of the hitbox in pixels.
item.height = 30; //The size of the height of the hitbox in pixels.
item.useTime = 7; //How fast the Weapon is used.
item.UseSound = SoundID.Item13; //The sound played when using your Weapon
item.useStyle = 5; //The way your Weapon will be used, 5 is the Holding Out Used for: Guns, Spellbooks, Drills, Chainsaws, Flails, Spears for example
item.shootSpeed = 4f; //This defines the projectile speed when shoot
item.useAnimation = 7; //Speed is not important here
item.shoot = mod.ProjectileType("CustomBeamProj"); //This defines what type of projectile this weapon will shoot
item.value = Item.sellPrice(0, 0, 0, 0);// How much the item is worth, in copper coins, when you sell it to a merchant. It costs 1/5th of this to buy it back from them. An easy way to remember the value is platinum, gold, silver, copper or PPGGSSCC (so this item price is 3gold)
}
}
}

Projectile :


using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Terraria.Enums;
namespace TutorialMOD.Projectiles
{
public class CustomBeamProj : ModProjectile
{
private Vector2 _targetPos; //Ending position of the laser beam
private int _charge; //The charge level of the weapon
private float _moveDist = 45f; //The distance charge particle from the player center
public override void SetDefaults()
{
projectile.name = "Custom Laser Beam"; //this is the projectile name
projectile.width = 10;
projectile.height = 10;
projectile.friendly = true; //this defines if the projectile is frendly
projectile.penetrate = -1; //this defines the projectile penetration, -1 = infinity
projectile.tileCollide = false; //this defines if the tile can colide with walls
projectile.magic = true;
projectile.hide = true;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
if (_charge == 100)
{
Vector2 unit = _targetPos - Main.player[projectile.owner].Center;
unit.Normalize();
DrawLaser(spriteBatch, Main.projectileTexture[projectile.type], Main.player[projectile.owner].Center, unit, 5, projectile.damage, -1.57f, 1f, 1000f, Color.White, 45);// this is the projectile sprite draw, 45 = the distance of where the projectile starts from the player
}
return false;
}
/// <summary>
/// The core function of drawing a laser
/// </summary>
public void DrawLaser(SpriteBatch spriteBatch, Texture2D texture, Vector2 start, Vector2 unit, float step, int damage, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default(Color), int transDist = 50)
{
Vector2 origin = start;
float r = unit.ToRotation() + rotation;
#region Draw laser body
for (float i = transDist; i <= _moveDist; i += step)
{
Color c = Color.White;
origin = start + i * unit;
spriteBatch.Draw(texture, origin - Main.screenPosition,
new Rectangle(0, 26, 28, 26), i < transDist ? Color.Transparent : c, r,
new Vector2(28 / 2, 26 / 2), scale, 0, 0);
}
#endregion
#region Draw laser tail
spriteBatch.Draw(texture, start + unit * (transDist - step) - Main.screenPosition,
new Rectangle(0, 0, 28, 26), Color.White, r, new Vector2(28 / 2, 26 / 2), scale, 0, 0);
#endregion
#region Draw laser head
spriteBatch.Draw(texture, start + (_moveDist + step) * unit - Main.screenPosition,
new Rectangle(0, 52, 28, 26), Color.White, r, new Vector2(28 / 2, 26 / 2), scale, 0, 0);
#endregion
}
/// <summary>
/// Change the way of collision check of the projectile
/// </summary>
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (_charge == 100)
{
Player p = Main.player[projectile.owner];
Vector2 unit = (Main.player[projectile.owner].Center - _targetPos);
unit.Normalize();
float point = 0f;
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), p.Center - 95f * unit, p.Center - unit * _moveDist, 22, ref point))
{
return true;
}
}
return false;
}
/// <summary>
/// Change the behavior after hit a NPC
/// </summary>
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[projectile.owner] = 5;
}
/// <summary>
/// The AI of the projectile
/// </summary>
public override void AI()
{
Vector2 mousePos = Main.MouseWorld;
Player player = Main.player[projectile.owner];
#region Set projectile position
if (projectile.owner == Main.myPlayer) // Multiplayer support
{
Vector2 diff = mousePos - player.Center;
diff.Normalize();
projectile.position = player.Center + diff * _moveDist;
projectile.timeLeft = 2;
int dir = projectile.position.X > player.position.X ? 1 : -1;
player.ChangeDir(dir);
player.heldProj = projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (float)Math.Atan2(diff.Y * dir, diff.X * dir);
projectile.soundDelay--;
#endregion
}
#region Charging process
// Kill the projectile if the player stops channeling
if (!player.channel)
{
projectile.Kill();
}
else
{
if (Main.time % 10 < 1 && !player.CheckMana(player.inventory[player.selectedItem].mana, true))
{
projectile.Kill();
}
Vector2 offset = mousePos - player.Center;
offset.Normalize();
offset *= _moveDist - 20;
Vector2 dustPos = player.Center + offset - new Vector2(10, 10);
if (_charge < 100)
{
_charge++;
}
int chargeFact = _charge / 20;
Vector2 dustVelocity = Vector2.UnitX * 18f;
dustVelocity = dustVelocity.RotatedBy(projectile.rotation - 1.57f, default(Vector2));
Vector2 spawnPos = projectile.Center + dustVelocity;
for (int k = 0; k < chargeFact + 1; k++)
{
Vector2 spawn = spawnPos + ((float)Main.rand.NextDouble() * 6.28f).ToRotationVector2() * (12f - (chargeFact * 2));
Dust dust = Main.dust[Dust.NewDust(dustPos, 30, 30, 235, projectile.velocity.X / 2f, //this 30, 30 is the dust weight and height 235 is the tail dust
projectile.velocity.Y / 2f, 0, default(Color), 1f)];
dust.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f;
dust.noGravity = true;
dust.scale = Main.rand.Next(10, 20) * 0.05f;
}
}
#endregion
#region Set laser tail position and dusts
if (_charge < 100) return;
Vector2 start = player.Center;
Vector2 unit = (player.Center - mousePos);
unit.Normalize();
unit *= -1;
for (_moveDist = 95f; _moveDist <= 1600; _moveDist += 5) //this 1600 is the dsitance of the beam
{
start = player.Center + unit * _moveDist;
if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1))
{
_moveDist -= 5f;
break;
}
if (projectile.soundDelay <= 0)//this is the proper sound delay for this type of weapon
{
Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 15); //this is the sound when the weapon is used cheange 15 for diferent sound
projectile.soundDelay = 40; //this is the proper sound delay for this type of weapon
}
}
_targetPos = player.Center + unit * _moveDist;
//dust
for (int i = 0; i < 2; ++i)
{
float num1 = projectile.velocity.ToRotation() + (Main.rand.Next(2) == 1 ? -1.0f : 1.0f) * 1.57f;
float num2 = (float)(Main.rand.NextDouble() * 0.8f + 1.0f);
Vector2 dustVel = new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2);
Dust dust = Main.dust[Dust.NewDust(_targetPos, 0, 0, 235, dustVel.X, dustVel.Y, 0, new Color(), 1f)]; //this is the head dust
Dust dust2 = Main.dust[Dust.NewDust(_targetPos, 0, 0, 235, dustVel.X, dustVel.Y, 0, new Color(), 1f)]; //this is the head dust 2
dust.noGravity = true;
dust.scale = 1.2f;
}

#endregion
}
public override bool ShouldUpdatePosition()
{
return false;
}

}
}
The Error message would help. It also tells you the file and the line number, which lead you right to the problem. Also, the tModLoader discord is very active, for those who want help.
 
The Error message would help. It also tells you the file and the line number, which lead you right to the problem. Also, the tModLoader discord is very active, for those who want help.

Oh i have a new issue, ehh


c:\Users\.........\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(6,16) : error CS1514: { expected
c:\Users\.........\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(8,23) : error CS1514: { expected
c:\Users\.........\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(8,32) : error CS1519: Invalid token ':' in class, struct, or interface member declaration
c:\Users\.........\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(9,5) : error CS1519: Invalid token '{' in class, struct, or interface member declaration


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

namespace Dark Écriture
{
    public class Dark Écriture : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Dark Écriture");    
            Tooltip.SetDefault("The fate of the universe rests in your hand...");
        }   
          public override void SetDefaults()   
        {
            item.damage = 999; 
            item.noMelee = true; 
            item.noUseGraphic = false;
            item.magic = true;  
            item.channel = true;                          
            item.mana = 0;
            item.rare = -11;  
            item.width = 28;  
            item.height = 30;   
            item.useTime = 7;  
            item.UseSound = SoundID.Item13; 
            item.useStyle = 5;  
            item.shootSpeed = 4f;      
            item.useAnimation = 7;                       
            item.shoot = mod.ProjectileType("CustomBeamProj"); 
            item.value = Item.sellPrice(0, 0, 0, 0);
        }
       
         public override void AddRecipes()
         {
         ModRecipe recipe = new ModRecipe(mod);
         recipe.AddIngredient(ItemID.Luminite, 10)
         recipe.AddIngredient(ItemID.LastPrism, 1)
         recipe.AddTile(TileID.AncientManipulator)
         recipe.SetResult(this);
         recipe.AddRecipe();
        }
    }
}
[doublepost=1523054595,1523054537][/doublepost]Also i cant join discord, for secret reason, so ya...
 
Well....then I guess my advice is just get Visual Studio or learn the syntax of c#. Currently, it looks like your issue is illegal characters in the classname. I'd suggest looking up what characters are legal in classnames.
 
ill try it
Well....then I guess my advice is just get Visual Studio or learn the syntax of c#. Currently, it looks like your issue is illegal characters in the classname. I'd suggest looking up what characters are legal in classnames.
[doublepost=1523086871,1523086633][/doublepost]OK now i have a new problem
Code:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace Dark Ecriture
{
    public class Dark Ecriture : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Dark Ecriture");    
            Tooltip.SetDefault("The fate of the universe rests in your hand...");
        }   
          public override void SetDefaults()   
        {
            item.damage = 999; 
            item.noMelee = true; 
            item.noUseGraphic = false;
            item.magic = true;  
            item.channel = true;                          
            item.mana = 0;
            item.rare = -11;  
            item.width = 28;  
            item.height = 30;   
            item.useTime = 7;  
            item.UseSound = SoundID.Item13; 
            item.useStyle = 5;  
            item.shootSpeed = 4f;      
            item.useAnimation = 7;                       
            item.shoot = mod.ProjectileType("CustomBeamProj"); 
            item.value = Item.sellPrice(0, 0, 0, 0);
        }
       
         public override void AddRecipes()
         {
         ModRecipe recipe = new ModRecipe(mod);
         recipe.AddIngredient(ItemID.Luminite, 10)
         recipe.AddIngredient(ItemID.LastPrism, 1)
         recipe.AddTile(TileID.AncientManipulator)
         recipe.SetResult(this);
         recipe.AddRecipe();
        }
    }
}
[doublepost=1523086921][/doublepost]c:\Users\...\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(6,16) : error CS1514: { expected
c:\Users\...\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(8,23) : error CS1514: { expected
c:\Users\...\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(8,32) : error CS1519: Invalid token ':' in class, struct, or interface member declaration
c:\Users\...\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(9,5) : error CS1519: Invalid token '{' in class, struct, or interface member declaration
 
Can you rewrite the code for me?
if not i understand


c:\Users\safrfweggher\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(38,45) : error CS1002: ; expected
c:\Users\safrfweggher\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(39,45) : error CS1002: ; expected
c:\Users\safrfweggher\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(40,45) : error CS1002: ; expected


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

namespace DarkEcriture
{
    public class DarkEcriture : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Dark Ecriture");    
            Tooltip.SetDefault("The fate of the universe rests in your hand...");
        }   
          public override void SetDefaults()   
        {
            item.damage = 999; 
            item.noMelee = true; 
            item.noUseGraphic = false;
            item.magic = true;  
            item.channel = true;                          
            item.mana = 0;
            item.rare = -11;  
            item.width = 28;  
            item.height = 30;   
            item.useTime = 7;  
            item.UseSound = SoundID.Item13; 
            item.useStyle = 5;  
            item.shootSpeed = 4f;      
            item.useAnimation = 7;                       
            item.shoot = mod.ProjectileType("CustomBeamProj"); 
            item.value = Item.sellPrice(0, 0, 0, 0);
        }
       
         public override void AddRecipes()
         {
         ModRecipe recipe = new ModRecipe(mod);
         recipe.AddIngredient(ItemID.Luminite, 10)
         recipe.AddIngredient(ItemID.LastPrism, 1)
         recipe.AddTile(TileID.AncientManipulator)
         recipe.SetResult(this);
         recipe.AddRecipe();
        }
    }
}
 
I am am having issues with error cs0115 the error message follows.

c:\Users\Big D\Documents\My Games\Terraria\ModLoader\Mod Sources\FurtherWorlds\Items\NPCs\CorruptPixie.cs(28,31) : error CS0115: 'FurtherWorlds.Items.NPCs.CorruptPixie.CanSpawn(Terraria.ModLoader.NPCSpawnInfo)': no suitable method found to override

c:\Users\Big D\Documents\My Games\Terraria\ModLoader\Mod Sources\FurtherWorlds\Items\NPCs\GorePixie.cs(28,31) : error CS0115: 'FurtherWorlds.Items.NPCs.GorePixie.CanSpawn(Terraria.ModLoader.NPCSpawnInfo)': no suitable method found to override

I am trying to make 2 identical creatures (besides name and skin) and I cannot figure out how to fix the errors the error is the same in both
 
I am am having issues with error cs0115 the error message follows.

c:\Users\Big D\Documents\My Games\Terraria\ModLoader\Mod Sources\FurtherWorlds\Items\NPCs\CorruptPixie.cs(28,31) : error CS0115: 'FurtherWorlds.Items.NPCs.CorruptPixie.CanSpawn(Terraria.ModLoader.NPCSpawnInfo)': no suitable method found to override

c:\Users\Big D\Documents\My Games\Terraria\ModLoader\Mod Sources\FurtherWorlds\Items\NPCs\GorePixie.cs(28,31) : error CS0115: 'FurtherWorlds.Items.NPCs.GorePixie.CanSpawn(Terraria.ModLoader.NPCSpawnInfo)': no suitable method found to override

I am trying to make 2 identical creatures (besides name and skin) and I cannot figure out how to fix the errors the error is the same in both
Show us the code.
[doublepost=1534991735,1534991640][/doublepost]
Can you rewrite the code for me?
if not i understand


c:\Users\safrfweggher\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(38,45) : error CS1002: ; expected
c:\Users\safrfweggher\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(39,45) : error CS1002: ; expected
c:\Users\safrfweggher\Documents\My Games\Terraria\ModLoader\Mod Sources\Deathwish\Items\MagicWeapon.cs(40,45) : error CS1002: ; expected


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

namespace DarkEcriture
{
    public class DarkEcriture : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Dark Ecriture");   
            Tooltip.SetDefault("The fate of the universe rests in your hand...");
        }  
          public override void SetDefaults()  
        {
            item.damage = 999;
            item.noMelee = true;
            item.noUseGraphic = false;
            item.magic = true; 
            item.channel = true;                         
            item.mana = 0;
            item.rare = -11; 
            item.width = 28; 
            item.height = 30;  
            item.useTime = 7; 
            item.UseSound = SoundID.Item13;
            item.useStyle = 5; 
            item.shootSpeed = 4f;     
            item.useAnimation = 7;                      
            item.shoot = mod.ProjectileType("CustomBeamProj");
            item.value = Item.sellPrice(0, 0, 0, 0);
        }
      
         public override void AddRecipes()
         {
         ModRecipe recipe = new ModRecipe(mod);
         recipe.AddIngredient(ItemID.Luminite, 10)
         recipe.AddIngredient(ItemID.LastPrism, 1)
         recipe.AddTile(TileID.AncientManipulator)
         recipe.SetResult(this);
         recipe.AddRecipe();
        }
    }
}
As jopojelly said, those Item Ids are wrong, the ancient manipulator is hard to find, but it is called LunarCraftingStation (I Know this cause i looked it up earlier)
 
por favor ayuda, no sé lo que estoy fallando /
-------------------------------------------------- ---- /
usando Terraria;
usando Terraria.ID;
usando Terraria.ModLoader;
utilizando System.Collections.Generic;

namespace prueba.Items
{
clase pública Nightchesplate: ModItem
{
anulación pública bool Autoload (ref nombre de cadena, textura de cadena de ref, IList <EquipType> equipa)
{
equipas.Add (EquipType = Cuerpo);
restaurante
}

anulación pública anulada SetDefaults ()
{
item.name = "Coraza de la noche";
item.width = 18;
item.height = 18;
AddTooltip ("Esta es una armadura de cuerpo de estrella");
AddTooltip2 ("+ 20 maná máximo");
item.value = 10;
item.rare = 2;
item.defense = 15;
}

anulación pública void UpdateEquip (Reproductor jugador)
{
player.statManaMax2 + = 20; // 20 máximos de maná
}
anulación pública void AddRecipes () // Cómo crear este elemento
{
Receta ModRecipe = nueva ModRecipe (mod);
recipe.AddIngredient (ItemID.JungleShirt, 1);
recipe.AddIngredient (ItemID.CrimsonScalemail, 1);
recipe.AddIngredient (ItemID.MoltenBreastplate, 1);
recipe.AddTile (TileID.DemonAltar);
receta.SetResult (esto);
recipe.AddRecipe ();
}
}
}
 

Attachments

  • Nightchesplate.cs
    1.2 KB · Views: 186
So....

c:\Users\Zach\Documents\My Games\Terraria\ModLoader\Mod Sources\TestMod\NPCs\Boss\ThePerfectOne.cs(40,30) : error CS0115: 'TestMod.NPCs.Boss.ThePerfectOne.AutoloadHead(ref string, ref string)': no suitable method found to override
b

and here's my code:

using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
//By Al0n37 www.youtube.com/Al0n37
namespace TestMod.NPCs.Boss
{
public class ThePerfectOne : ModNPC
{
public override void SetDefaults()
{
npc.name = "cheater";
npc.displayName = "The Perfect One";
npc.aiStyle = 22; //5 is the flying AI
npc.lifeMax = 250000; //boss life
npc.damage = 20; //boss damage
npc.defense = 10; //boss defense
npc.knockBackResist = 0f;
npc.width = 100;
npc.height = 100;
animationType = NPCID.DemonEye; //this boss will behavior like the DemonEye
Main.npcFrameCount[npc.type] = 2; //boss frame/animation
npc.value = Item.buyPrice(0, 40, 75, 45);
npc.npcSlots = 1f;
npc.boss = true;
npc.lavaImmune = true;
npc.noGravity = true;
npc.noTileCollide = true;
npc.soundHit = 8;
npc.soundKilled = 14;
npc.buffImmune[24] = true;
music = MusicID.Boss2;
npc.netAlways = true;
}


public override void AutoloadHead(ref string headTexture, ref string bossHeadTexture)
{
bossHeadTexture = "TestMod/NPCs/Boss/ThePerfectOne_Head_Boss"; //the boss head texture
}
public override void BossLoot(ref string name, ref int potionType)
{
potionType = ItemID.LesserHealingPotion; //boss drops
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheAncientOne"));
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = (int)(npc.lifeMax * 0.579f * bossLifeScale); //boss life scale in expertmode
npc.damage = (int)(npc.damage * 0.6f); //boss damage increase in expermode
}
public override void AI()
{
npc.ai[0]++;
Player P = Main.player[npc.target];
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
{
npc.TargetClosest(true);
}
npc.netUpdate = true;

npc.ai[1]++;
if (npc.ai[1] >= 230) // 230 is projectile fire rate
{
float Speed = 20f; //projectile speed
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
int damage = 10; //projectile damage
int type = mod.ProjectileType("ProBoss"); //put your projectile
Main.PlaySound(23, (int)npc.position.X, (int)npc.position.Y, 17);
float rotation = (float)Math.Atan2(vector8.Y - (P.position.Y + (P.height * 0.5f)), vector8.X - (P.position.X + (P.width * 0.5f)));
int num54 = Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 0f, 0);
npc.ai[1] = 0;
}
if (npc.ai[0] % 600 == 3) //Npc spown rate

npc.ai[1] += 0;
if (npc.life <= 70) //when the boss has less than 70 health he will do the charge attack
npc.ai[2]++; //Charge Attack
if (npc.ai[2] >= 20)
{
npc.velocity.X *= 0.98f;
npc.velocity.Y *= 0.98f;
Vector2 vector8 = new Vector2(npc.position.X + (npc.width * 0.5f), npc.position.Y + (npc.height * 0.5f));
{
float rotation = (float)Math.Atan2((vector8.Y) - (Main.player[npc.target].position.Y + (Main.player[npc.target].height * 0.5f)), (vector8.X) - (Main.player[npc.target].position.X + (Main.player[npc.target].width * 0.5f)));
npc.velocity.X = (float)(Math.Cos(rotation) * 12) * -1;
npc.velocity.Y = (float)(Math.Sin(rotation) * 12) * -1;
}
//Dust
npc.ai[0] %= (float)Math.PI * 2f;
Vector2 offset = new Vector2((float)Math.Cos(npc.ai[0]), (float)Math.Sin(npc.ai[0]));
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 20);
npc.ai[2] = -300;
Color color = new Color();
Rectangle rectangle = new Rectangle((int)npc.position.X, (int)(npc.position.Y + ((npc.height - npc.width) / 2)), npc.width, npc.width);
int count = 30;
for (int i = 1; i <= count; i++)
{
int dust = Dust.NewDust(npc.position, rectangle.Width, rectangle.Height, 6, 0, 0, 100, color, 2.5f);
Main.dust[dust].noGravity = false;
}
return;
}
}
//Boss second stage texture
private const int Sphere = 50;
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
{
if (npc.life <= 70)
{
spriteBatch.Draw(mod.GetTexture("NPCs/Boss/ThePerfectOne2"), npc.Center - Main.screenPosition, null, Color.White * (70f / 255f), 0f, new Vector2(Sphere, Sphere), 3f, SpriteEffects.None, 0f);

}
return true;
}

}
}

help (and yes i used Al0n37's template. i just made a few tweaks to make it my own)
 
An error occurred while building WyvernMod
Compiling WyvernMod.XNAdll failed with 3 errors and C:/Users/-----/Documents/My Games/Terraria/ModLoader/ModSources/WyvernMod/Items/Armor/WyvernHelmet.cs(10,23) : error CS0115:
'WyvernHelmet.Autoload(refstring, ref string, List<EquipType>)': no suitable method found to override warnings

Here's my code (I'm using Notepad++):
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using System.Collections.Generic;

namespace WyvernMod.Items.Armor
{
    public class WyvernHelmet : ModItem
    {
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.Head);
            return true;
        }
        
        public override void SetDefaults()
        {
            item.name = "Wyvern Helmet";
            item.width = 12;
            item.height = 11;
            item.toolTip = "Part of the Wyvern Armor Set";
            item.value = 500000;
            item.rare = 13;
            item.defense = 50;
        }
        /*
        public override bool IsArmorSet(Item head, Item body, Item legs)
        {
            return body.type == mod.Item.Type("WyvernBreastplate") && legs.type == mod.ItemType("WyvernLeggings");
        }
        */
        
        public override void UpdateArmorSet(Player player)
        {
            player.AddBuff(BuffID.Lifeforce, 500);
        }
        
        public override void AddRecipes()
        {
            ModRecipe r = new ModRecipe(mod);
            r.AddIngredient(ItemID.SolarFlareHelmet, 1);
            r.AddIngredient(ItemID.VortexHelmet, 1);
            r.AddTile(TileID.Anvils); // Anvils = Iron, Lead, Mythril, etc
            r.SetResult(this);
            r.AddRecipe();
        }
    }
}
 
Back
Top Bottom