tModLoader Official tModLoader Help Thread

Thanks. :happy:
By 'anywhere meaningful', I meant anywhere where you can actually modify the value of a number. You can't change a number in the condition of an if statement.
I had another look at your code, and realised I'd missed a mistake. You are resetting projectile frame to 0 when it exceeds it's max value, but you aren't actually increasing the frame number anywhere. Your code should look like this:
Code:
projectile.frameCounter = 0;
projectile.frame++; //<--new line of code here
if (projectile.frame >= 10)
{
    projectile.frame = 0;
}
It works :) Tested it a bit, and made some changes:
Realized that "10" is the end frame, then it loops back to the 1st frame, so I added a 'return' value to loop the animation, and changed the "10" to 32 in (projectile.frame >= 10) so it loops through all sprites, but now it loops through the animation too quickly. Is there a way to slow it down?
 
Last edited:
So me and a friend of mine wanted to load up tmodloader with a ton of mods, so we slapped 82 mods together and for some unknown reason whenever one of us hosts the other person cannot join and the host cannot harvest resources from blocks, but they can from mobs.
If someone has a solution please tell us, thank you.
Our mod list is in the uploaded image btw.
 

Attachments

  • 9aff5f1f6ecb75bd623498c8be238b90.png
    9aff5f1f6ecb75bd623498c8be238b90.png
    58.6 KB · Views: 136
So me and a friend of mine wanted to load up tmodloader with a ton of mods, so we slapped 82 mods together and for some unknown reason whenever one of us hosts the other person cannot join and the host cannot harvest resources from blocks, but they can from mobs.
If someone has a solution please tell us, thank you.
Our mod list is in the uploaded image btw.
This is the advice we give people, especially people using a huge number of mods.
5nGP6Qi.png
 
This is the advice we give people, especially people using a huge number of mods.
5nGP6Qi.png
As it turns out getting rid of Chest Browser solved our problem, but now another issue we have is that my computer can't handle running a server with that many mods and play it at the same time without very consistent lag. Thanks for the help.
 
It works :) Tested it a bit, and made some changes:
Realized that "10" is the end frame, then it loops back to the 1st frame, so I added a 'return' value to loop the animation, and changed the "10" to 32 in (projectile.frame >= 10) so it loops through all sprites, but now it loops through the animation too quickly. Is there a way to slow it down?
Ok, so changing the frame speed is very similar to changing the maximum number of frames. Basically, what you are doing is increasing projectile.frameCounter every frame and, once it reaches a certain value, you reset the counter and increase the frame.

All you need to do is change the number in "if (projectile.frameCounter >= 32)"
 
Ok, so changing the frame speed is very similar to changing the maximum number of frames. Basically, what you are doing is increasing projectile.frameCounter every frame and, once it reaches a certain value, you reset the counter and increase the frame.

All you need to do is change the number in "if (projectile.frameCounter >= 32)"
Did that, doesn't seem to change the overall frame speed. :indifferent: What I meant to ask is "How do I slow down the animation speed without changing the amount of frames (sprites), as in delaying the time between each sprite." :p Also, I got confused and wondered if you were talking about "projectile.frameCounter = 0;" or "if (projectile.frame >= 32)", since I don't have the "if (projectile.frameCounter >= 32)" line. Here's the projectile code and the spritesheet so you don't get confused:
Small Version (Need to zoom in):
View attachment 197595
Bigger version:
View attachment 197595
For some reason I do not have permission to view my own files. ( ͡° ͜ʖ ͡°)
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace JoshuasMod.Projectiles
{
    public class CelicaProj : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            Main.projFrames[projectile.type] = 32;
        }

        public override void SetDefaults()
        {
            projectile.damage = 100;
            projectile.scale = 1f;
            projectile.friendly = true;
            projectile.melee = true;
            projectile.tileCollide = false;
            projectile.timeLeft = 320;
            projectile.width = 66;
            projectile.height = 66;
            projectile.penetrate = -1;
            projectile.extraUpdates = 1;
            projectile.ignoreWater = true;
        }

        public override void AI()
        {
            //Making sure the projectile faces the correct way.
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.75f;
 
            //Loop through the 32 animation frames (Hopefully with 10 frames per sprite).
            projectile.frameCounter = 0;
            projectile.frame++;
            if (projectile.frame >= 32)
            {
                projectile.frame = 0;
            }
            return;
   
            //This is the dust used, it is the size of the projectile.
            projectile.velocity.Y += projectile.ai[0];
            for (int d = 0; d < 1; d++)
            {
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 15, 0f, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f);
            }
        }

        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(BuffID.OnFire, 5 * 60);
            target.AddBuff(BuffID.Frostburn, 5 * 60);
            target.AddBuff(BuffID.CursedInferno, 5 * 60);
            target.AddBuff(BuffID.ShadowFlame, 5 * 60);
            target.immune[projectile.owner] = 2;
        }
    }
}
Also also, have a similar problem with an Arkhalis-like projectile with the frames going by too fast, and was wondering how to make the projectile appear closer to the player.
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.DataStructures;

namespace JoshuasMod.Projectiles
{
    public class SpacialRendProj : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Spacial Rend");
            Main.RegisterItemAnimation(projectile.type, new DrawAnimationVertical(20, 12));
            Main.projFrames[mod.ProjectileType("SpacialRendProj")] = 12; //"12" is the amount of frames there are in 1 loop.
        }

        public override void SetDefaults()
        {
            projectile.width = 78;
            projectile.height = 68;
            projectile.aiStyle = 75;
            projectile.scale = 1.1f;
            projectile.penetrate = -1;
            projectile.friendly = true;
            projectile.melee = true;
            projectile.ownerHitCheck = true;
            projectile.ignoreWater = true;
            projectile.tileCollide = false;
        }

        public override void AI()
        {
            //This is the "Arkhalis" projectile code.
            Player player = Main.player[projectile.owner];
            float num = 1.57079637f;
            Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true);
   
            num = 0f;
            if (projectile.spriteDirection == -1)
            {
                num = 3.14159265274f;
            }
   
            if (++projectile.frame >= Main.projFrames[projectile.type])
            {
                projectile.frame = 1;
            }

            projectile.soundDelay--;
            if (projectile.soundDelay <=0)
            {
                Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 1);
                projectile.soundDelay = 16;
            }
   
            if (Main.myPlayer == projectile.owner)
            {
                if (player.channel && !player.noItems && !player.CCed)
                {
                    float scaleFactor6 = 1f;
                    if (player.inventory[player.selectedItem].shoot == projectile.type)
                    {
                        scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
                    }
           
                    Vector2 vector13 = Main.MouseWorld - vector;
                    vector13.Normalize();
                    if (vector13.HasNaNs())
                    {
                        vector13 = Vector2.UnitX * (float)player.direction;
                    }
           
                    vector13 *= scaleFactor6;
                    if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y)
                    {
                        projectile.netUpdate = true;
                    }
                    projectile.velocity = vector13;
                }
                else
                {
                    projectile.Kill();
                }
            }
            Vector2 vector14 = projectile.Center + projectile.velocity * 3f;
            Lighting.AddLight(vector14, 0.1f, 0.1f, 0.1f);
            projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f;
            projectile.rotation = projectile.velocity.ToRotation() + num;
            projectile.spriteDirection = projectile.direction;
            projectile.timeLeft = 2;
            player.ChangeDir(projectile.direction);
            player.heldProj = projectile.whoAmI;
            player.itemTime = 2;
            player.itemAnimation = 2;
            player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction));
   
            //This is the dust used, it is the size of the projectile.
            projectile.velocity.Y += projectile.ai[0];
            for (int d = 0; d < 1; d++)
            {
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 15, 0f, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.85f);
            }
        }

        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(BuffID.OnFire, 5 * 60);
            target.AddBuff(BuffID.Frostburn, 5 * 60);
            target.AddBuff(BuffID.CursedInferno, 5 * 60);
            target.AddBuff(BuffID.ShadowFlame, 5 * 60);
            target.immune[projectile.owner] = 3;
        }
    }
}
 
Last edited:
Did that, doesn't seem to change the overall frame speed. :indifferent: What I meant to ask is "How do I slow down the animation speed without changing the amount of frames (sprites), as in delaying the time between each sprite." :p Also, I got confused and wondered if you were talking about "projectile.frameCounter = 0;" or "if (projectile.frame >= 32)", since I don't have the "if (projectile.frameCounter >= 32)" line. Here's the projectile code and the spritesheet so you don't get confused:
Small Version (Need to zoom in):
View attachment 197595
Bigger version:
View attachment 197595
For some reason I do not have permission to view my own files. ( ͡° ͜ʖ ͡°)
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace JoshuasMod.Projectiles
{
    public class CelicaProj : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            Main.projFrames[projectile.type] = 32;
        }

        public override void SetDefaults()
        {
            projectile.damage = 100;
            projectile.scale = 1f;
            projectile.friendly = true;
            projectile.melee = true;
            projectile.tileCollide = false;
            projectile.timeLeft = 320;
            projectile.width = 66;
            projectile.height = 66;
            projectile.penetrate = -1;
            projectile.extraUpdates = 1;
            projectile.ignoreWater = true;
        }

        public override void AI()
        {
            //Making sure the projectile faces the correct way.
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.75f;

            //Loop through the 32 animation frames (Hopefully with 10 frames per sprite).
            projectile.frameCounter = 0;
            projectile.frame++;
            if (projectile.frame >= 32)
            {
                projectile.frame = 0;
            }
            return;
  
            //This is the dust used, it is the size of the projectile.
            projectile.velocity.Y += projectile.ai[0];
            for (int d = 0; d < 1; d++)
            {
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 15, 0f, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f);
            }
        }

        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(BuffID.OnFire, 5 * 60);
            target.AddBuff(BuffID.Frostburn, 5 * 60);
            target.AddBuff(BuffID.CursedInferno, 5 * 60);
            target.AddBuff(BuffID.ShadowFlame, 5 * 60);
            target.immune[projectile.owner] = 2;
        }
    }
}
Also also, have a similar problem with an Arkhalis-like projectile with the frames going by too fast, and was wondering how to make the projectile appear closer to the player.
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.DataStructures;

namespace JoshuasMod.Projectiles
{
    public class SpacialRendProj : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Spacial Rend");
            Main.RegisterItemAnimation(projectile.type, new DrawAnimationVertical(20, 12));
            Main.projFrames[mod.ProjectileType("SpacialRendProj")] = 12; //"12" is the amount of frames there are in 1 loop.
        }

        public override void SetDefaults()
        {
            projectile.width = 78;
            projectile.height = 68;
            projectile.aiStyle = 75;
            projectile.scale = 1.1f;
            projectile.penetrate = -1;
            projectile.friendly = true;
            projectile.melee = true;
            projectile.ownerHitCheck = true;
            projectile.ignoreWater = true;
            projectile.tileCollide = false;
        }

        public override void AI()
        {
            //This is the "Arkhalis" projectile code.
            Player player = Main.player[projectile.owner];
            float num = 1.57079637f;
            Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true);
  
            num = 0f;
            if (projectile.spriteDirection == -1)
            {
                num = 3.14159265274f;
            }
  
            if (++projectile.frame >= Main.projFrames[projectile.type])
            {
                projectile.frame = 1;
            }

            projectile.soundDelay--;
            if (projectile.soundDelay <=0)
            {
                Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 1);
                projectile.soundDelay = 16;
            }
  
            if (Main.myPlayer == projectile.owner)
            {
                if (player.channel && !player.noItems && !player.CCed)
                {
                    float scaleFactor6 = 1f;
                    if (player.inventory[player.selectedItem].shoot == projectile.type)
                    {
                        scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
                    }
          
                    Vector2 vector13 = Main.MouseWorld - vector;
                    vector13.Normalize();
                    if (vector13.HasNaNs())
                    {
                        vector13 = Vector2.UnitX * (float)player.direction;
                    }
          
                    vector13 *= scaleFactor6;
                    if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y)
                    {
                        projectile.netUpdate = true;
                    }
                    projectile.velocity = vector13;
                }
                else
                {
                    projectile.Kill();
                }
            }
            Vector2 vector14 = projectile.Center + projectile.velocity * 3f;
            Lighting.AddLight(vector14, 0.1f, 0.1f, 0.1f);
            projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f;
            projectile.rotation = projectile.velocity.ToRotation() + num;
            projectile.spriteDirection = projectile.direction;
            projectile.timeLeft = 2;
            player.ChangeDir(projectile.direction);
            player.heldProj = projectile.whoAmI;
            player.itemTime = 2;
            player.itemAnimation = 2;
            player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction));
  
            //This is the dust used, it is the size of the projectile.
            projectile.velocity.Y += projectile.ai[0];
            for (int d = 0; d < 1; d++)
            {
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 15, 0f, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.85f);
            }
        }

        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(BuffID.OnFire, 5 * 60);
            target.AddBuff(BuffID.Frostburn, 5 * 60);
            target.AddBuff(BuffID.CursedInferno, 5 * 60);
            target.AddBuff(BuffID.ShadowFlame, 5 * 60);
            target.immune[projectile.owner] = 3;
        }
    }
}
Hm, looks like you've removed a bit of your code. Where before you had
Code:
            projectile.frameCounter++; //"projectile.frameCounter++;" statement must go before the "if" statement. That's before the "if" statement, right? O_o
            if (projectile.frameCounter >= 32)
            {
                projectile.frameCounter = 0;
                if (projectile.frame >= 10)
                {
                    projectile.frame = 0;
                }
            }
you now have
Code:
            projectile.frameCounter = 0;

            projectile.frame++;
            if (projectile.frame >= 32)
            {
                projectile.frame = 0;
            }
What you want is something like this:
Code:
            projectile.frameCounter++; // statement must go before the "if" statement. That's before the "if" statement, right? O_o
            if (projectile.frameCounter >= 10) //this is the number that controls how fast your projectile animates
            {
                projectile.frameCounter = 0;
                projectile.frame++; //I've added this line
                if (projectile.frame > 32) //this is the maximum number of frames in your peojectile
                {
                    projectile.frame = 0;
                }
            }

You can use the same code for your Arkhalis-like projectile, you'll just need to change the numbers in the if statements to set the speed and max frame count.

The position of that projectile is set by this line:
Code:
projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f;
So, it's position is set by half of its Size plus a value that I don't fully understand but I think is more or less the center of the player. You could either adjust the projectile's size, or add a manual offset, though I'm not exactly sure how that last one would be done.
 
Hm, looks like you've removed a bit of your code. Where before you had
Code:
            projectile.frameCounter++; //"projectile.frameCounter++;" statement must go before the "if" statement. That's before the "if" statement, right? O_o
            if (projectile.frameCounter >= 32)
            {
                projectile.frameCounter = 0;
                if (projectile.frame >= 10)
                {
                    projectile.frame = 0;
                }
            }
you now have
Code:
            projectile.frameCounter = 0;

            projectile.frame++;
            if (projectile.frame >= 32)
            {
                projectile.frame = 0;
            }
What you want is something like this:
Code:
            projectile.frameCounter++; // statement must go before the "if" statement. That's before the "if" statement, right? O_o
            if (projectile.frameCounter >= 10) //this is the number that controls how fast your projectile animates
            {
                projectile.frameCounter = 0;
                projectile.frame++; //I've added this line
                if (projectile.frame > 32) //this is the maximum number of frames in your peojectile
                {
                    projectile.frame = 0;
                }
            }

You can use the same code for your Arkhalis-like projectile, you'll just need to change the numbers in the if statements to set the speed and max frame count.

The position of that projectile is set by this line:
Code:
projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f;
So, it's position is set by half of its Size plus a value that I don't fully understand but I think is more or less the center of the player. You could either adjust the projectile's size, or add a manual offset, though I'm not exactly sure how that last one would be done.
Thank you, finally works! :>
 
I have what I believe to be a major bug with tmodloader. I am running terraria on ubuntu trusty, with calamity mod, wing slot, alchemist npc and luiafk.
I created a world two days ago, and now whenever I try to enter it, not only terraria, but my whole computer crashes.
Edit: now crashes whenever creating world aswell
 
Last edited:
Any chance to access local in function defined variables?
e.g. in vanilla generateWorld function, the tasks defined in there can access the local defined variables (e.g. dungeonSide). But if I add some generation pass with ModifyWorldGenTasks I'm not able to, at least not with just writing the variable name. Any way to do so?

EDIT: No way to do so.
 
Last edited:
Fixed my issue. completely reinstalled terraria + modloader, used only 3 mods (calamity, magic storage, luiafk) and set swap to 2 gigs
 
Error CS0115 - NPC Spawning



So I recently started Terraria modding and came across this problem:
c:\Users\ron\Documents\My Games\Terraria\ModLoader\Mod Sources\ModOne\NPCs\FlyingS.cs(30,31) : error CS0115: 'ModOne.NPCs.FlyingS.CanSpawn(Terraria.ModLoader.NPCSpawnInfo)': no suitable method found to override

I copied the line from an old modding tutorial so i'm not surprised there were gonna be errors.:red2:
Not sure if this is where i should put this thread tho.
Here's my code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

//By Al0n37
namespace ModOne.NPCs
{
public class FlyingS : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Flying Skull"); //the name displayed when hovering over the item ingame.
}
public override void SetDefaults()
{
npc.width = 50;
npc.height = 40;
npc.damage = 10;
npc.defense = 10;
npc.lifeMax = 200;
npc.soundHit = 1;
npc.soundKilled = 13;
npc.value = 60f;
npc.knockBackResist = 0.5f;
npc.aiStyle = 2;
npc.aiType = 2; //npc behavior
}

public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
return spawnInfo.spawnTileY < Main.rockLayer && !Main.dayTime ? 0.5f : 0.5f; //spown at day
}

public override void NPCLoot() //Npc drop
{
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FrozenHood"), 1); //Item spawn
}

}
}
}
Help and explanation would be much appreciated. :eek::islime:
 
Error CS0115 - NPC Spawning



So I recently started Terraria modding and came across this problem:
c:\Users\ron\Documents\My Games\Terraria\ModLoader\Mod Sources\ModOne\NPCs\FlyingS.cs(30,31) : error CS0115: 'ModOne.NPCs.FlyingS.CanSpawn(Terraria.ModLoader.NPCSpawnInfo)': no suitable method found to override

I copied the line from an old modding tutorial so i'm not surprised there were gonna be errors.:red2:
Not sure if this is where i should put this thread tho.
Here's my code:
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

//By Al0n37
namespace ModOne.NPCs
{
    public class FlyingS : ModNPC
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Flying Skull"); //the name displayed when hovering over the item ingame.
        }
        public override void SetDefaults()
        {
            npc.width = 50;
            npc.height = 40;
            npc.damage = 10;
            npc.defense = 10;
            npc.lifeMax = 200;
            npc.soundHit = 1;
            npc.soundKilled = 13;
            npc.value = 60f;
            npc.knockBackResist = 0.5f;
            npc.aiStyle = 2;
            npc.aiType = 2; //npc behavior
        }

        public override float CanSpawn(NPCSpawnInfo spawnInfo)
        {
            return spawnInfo.spawnTileY < Main.rockLayer && !Main.dayTime ? 0.5f : 0.5f; //spown at day
        }

        public override void NPCLoot() //Npc drop
        {
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FrozenHood"), 1); //Item spawn
            }

        }
    }
}
Help and explanation would be much appreciated. :eek::islime:
CanSpawn is outdated. Look at ExampleMod instead of YouTube.
 
I found the answer to my old question but unfortunately I have new one. Basically I was creating a debuff for my mod and when I tried to compile it, it gave me this error.

error:
c:\Users\acer\Documents\My Games\Terraria\ModLoader\Mod Sources\something\NPCs\NPCsINFO.cs(5,29) : error CS0246: The type or namespace name 'NPCInfo' could not be found (are you missing a using directive or an assembly reference?)

code:
using Terraria.ModLoader;

namespace something.NPCs
{
public class NPCsINFO : NPCInfo
{
public bool customdebuff = false;
}
}


Please help and thanks in advance.
 
Last edited:
A bit of help, please, every few times I close and re-open Steam, Terraria(With tModloader on) will appear uninstalled and when I replace the .acf file and launch the game, the game reverts back to its default box resolution and asks for a language, and although my player is unscathed, every modded item and block are mysteriously missing from my worlds, setting me back every few times I get forward a few more steps.
 
im getting Error CS1026 on this code:

using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace TheUndertaleMod.Items
{
public class ChaosBlaster : ModItem
{
public override void SetStaticDefaults()
{
Tooltip.SetDefault("Shoot a rainbow beam.");
}
public override void SetDefaults()
{
item.damage = 9999;
item.noMelee = true;
item.magic = true;
item.channel = true; //Channel so that you can held the weapon [Important]
item.mana = 20;
item.rare = 13;
item.width = 25;
item.height = 30;
item.useTime = 5;
item.UseSound = SoundID.Item13;
item.useStyle = 5;
item.shootSpeed = 1f;
item.useAnimation = 1;
item.shoot = mod.ProjectileType("ChaosBeam");
item.value = Item.sellPrice(platinum: 999);
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ID.3467,99);
recipe.AddTile(mod, "Workbench");
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

It says ") expected", but all ( have a ) so i dont know what to do, help please. (Also it's a magic weapon)
 
im getting Error CS1026 on this code:

using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace TheUndertaleMod.Items
{
public class ChaosBlaster : ModItem
{
public override void SetStaticDefaults()
{
Tooltip.SetDefault("Shoot a rainbow beam.");
}
public override void SetDefaults()
{
item.damage = 9999;
item.noMelee = true;
item.magic = true;
item.channel = true; //Channel so that you can held the weapon [Important]
item.mana = 20;
item.rare = 13;
item.width = 25;
item.height = 30;
item.useTime = 5;
item.UseSound = SoundID.Item13;
item.useStyle = 5;
item.shootSpeed = 1f;
item.useAnimation = 1;
item.shoot = mod.ProjectileType("ChaosBeam");
item.value = Item.sellPrice(platinum: 999);
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ID.3467,99);
recipe.AddTile(mod, "Workbench");
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

It says ") expected", but all ( have a ) so i dont know what to do, help please. (Also it's a magic weapon)
Weird. Which line is the error on?
An error will look like this: FrostblazeBoots.cs(51,21) : error CS0266
51 is the line the error's on. When you load it, what line does it say?
 
Back
Top Bottom