tModLoader Official tModLoader Help Thread

Can someone plz help i wanna make it so my killer whale npc spawns in ocean WITHOUT GETTING OVER 9000 ERRORS
that was a joke but i do get a ton of errors
error CS1002: ; expected
error CS1525: Invalid expression term ')'
Those are my current errors
oh and also tell me if my ocean spawning code inst right


Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;



namespace NicksMod.NPCs
{
    public class KillerWhale : ModNPC
    {
        public override void SetDefaults()
        {
            npc.name = "Killer Whale";
            npc.displayName = "Killer Whale";
            npc.width = 70;
            npc.height = 70;
            npc.damage = 65;
            npc.defense = 15;
            npc.lifeMax = 500;
            npc.HitSound = SoundID.NPCHit1;
            npc.DeathSound = SoundID.NPCDeath1;
            npc.value = 60f;
            npc.knockBackResist = 0.5f;
            npc.aiStyle = 16;
            Main.npcFrameCount[npc.type] = 3;
            aiType = NPCID.Shark;  //npc behavior
            animationType = NPCID.Shark;
    
        }
        public override void FindFrame(int frameHeight)
        {
            npc.frameCounter -= 0.1F; // Determines the animation speed. Higher value = faster animation.
            npc.frameCounter %= Main.npcFrameCount[npc.type];
            int frame = (int)npc.frameCounter;
            npc.frame.Y = frame * frameHeight;
            npc.spriteDirection = npc.direction;
        }
      
        public override void NPCLoot()  //Npc drop
        {
            Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OrcaFin"));         
        }

        public override float CanSpawn(NPCSpawnInfo spawnInfo)
        {     
                        int x = spawnInfo.spawnTileX;
                        int y = spawnInfo.spawnTileY;
                        int tile = (int)Main.tile[x, y].type;
                        return (spawnInfo) && (tile == 53 || tile == 112 || tile == 116 || tile == 234) && (spawnInfo) && spawnInfo.water) && y < Main.rockLayer && (x < 250 || x > Main.maxTilesX - 250);
        }       
    }
}
 
Can someone plz help i wanna make it so my killer whale npc spawns in ocean WITHOUT GETTING OVER 9000 ERRORS
that was a joke but i do get a ton of errors
error CS1002: ; expected
error CS1525: Invalid expression term ')'[/CODE]

In the future, please include the line number that is given with the error. It is a pain looking through all the code to try and find the problem. In this case, in the return line of the CanSpawn() method, you have one more ) character than you have ( characters.
Code:
spawnInfo.water)

I can't help you with your spawn code being right or not, someone else will have to help with that.
 
If you search the player class for '== 953', you will find the following code inside the VanillaUpdateAccessory function.
Code:
if (item.type == 953)
{
    this.spikedBoots++;
}
if (item.type == 975)
{
    this.spikedBoots++;
}
I'm guessing that 975 is the item ID of the climbing boots. I'm guessing that all you need to do is increase player.spikedBoots by one in your buff to get the effect that you want. I haven't tested it though...

Yup thats fixed it thanks for the help
 
Does it say anything else? Like a CS code, or an error message?
c:\Users\*****\Documents\My Games\Terraria\ModLoader\Mod Sources\ModdedGuns\Items\Weapons\ModdedGuns.cs(6,30) : error CS1002: ; expected
yes i know the file extension has to be a .cs but i can't upload a .cs
also i dont knnow where to put the ; cause of bad memory
also i fixed the first problem
 

Attachments

  • ModdedGuns (2).txt
    1,021 bytes · Views: 137
Last edited:
c:\Users\*****\Documents\My Games\Terraria\ModLoader\Mod Sources\ModdedGuns\Items\Weapons\ModdedGuns.cs(6,30) : error CS1002: ; expected
yes i know the file extension has to be a .cs but i can't upload a .cs
also i dont knnow where to put the ; cause of bad memory
also i fixed the first problem
You see the (6, 30) in front of your CS code? That's the place where the compiler encounters your error. In this case, line 6 and column 30 (usually you only need the line number). This is the line 6 in your code:
Code:
using Terraria.ModLoader.Mod Sources.ModdedGuns;
The error is caused by the whitespace between Mod and Sources. However, you don't seem to be using that namespace anyway, and I strongly doubt it exists at all, so you should just remove that entire line.
 
You see the (6, 30) in front of your CS code? That's the place where the compiler encounters your error. In this case, line 6 and column 30 (usually you only need the line number). This is the line 6 in your code:
Code:
using Terraria.ModLoader.Mod Sources.ModdedGuns;
The error is caused by the whitespace between Mod and Sources. However, you don't seem to be using that namespace anyway, and I strongly doubt it exists at all, so you should just remove that entire line.
I deleted that line but now it says
c:\Users\*****\Documents\My Games\Terraria\ModLoader\Mod Sources\ModdedGuns\Items\Weapons\ModdedGuns.cs(9,15) : error CS0146: Circular base class dependency involving 'ModdedGuns.Items.Weapons.ModdedGuns' and 'ModdedGuns.Items.Weapons.ModdedGuns'
 

Attachments

  • ModdedGuns (2).txt
    1,021 bytes · Views: 132
I deleted that line but now it says
c:\Users\*****\Documents\My Games\Terraria\ModLoader\Mod Sources\ModdedGuns\Items\Weapons\ModdedGuns.cs(9,15) : error CS0146: Circular base class dependency involving 'ModdedGuns.Items.Weapons.ModdedGuns' and 'ModdedGuns.Items.Weapons.ModdedGuns'
Okay, so your class is inheriting from itself. Replace the second ModdedGuns in line 9 by ModItem.
 
The process cannot access the file 'C:\Users\*****\Documents\My Games\Terraria\ModLoader\Mods\compile_temp\Ionic.Zip.Reduced.dll' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.IO.File.Create(String path, Int32 bufferSize)
at Terraria.ModLoader.ModCompile.CompileMod(BuildingMod mod, List`1 refMods, Boolean forWindows, Byte[]& dll, Byte[]& pdb)
at Terraria.ModLoader.ModCompile.Build(BuildingMod mod, IBuildStatus status)
at Terraria.ModLoader.ModCompile.Build(String modFolder, IBuildStatus status)
at Terraria.ModLoader.ModLoader.<>c.<BuildMod>b__44_0(Object _)
anyone know what this means because i dont know how to fix
 
Last edited:
im currently working on making an item that gives bonuses to players while at night or not in sunlight, but when in sunlight gives the player debuffs, i was looking at the code for the sun stone/moon stone but that effect occurs throughout the entire day/night, so even if the player is out of sunlight the item would still take effect during the day
 
im currently working on making an item that gives bonuses to players while at night or not in sunlight, but when in sunlight gives the player debuffs, i was looking at the code for the sun stone/moon stone but that effect occurs throughout the entire day/night, so even if the player is out of sunlight the item would still take effect during the day
What does in sunlight mean?
 
What does in sunlight mean?
basically if the player is outside during the day and while its not raining. so in direct view of the sky or in light created by the sun, sort of like the rules for vampires

E.G: a player on the surface of the world during day is in sunlight, where as a player inside a building or underground wouldnt be in sunlight
 
Last edited:
basically if the player is outside during the day and while its not raining. so in direct view of the sky or in light created by the sun, sort of like the rules for vampires

E.G: a player on the surface of the world during day is in sunlight, where as a player inside a building or underground wouldnt be in sunlight
Ok, my point is, you'll have to come up with an algorithm to check if the player is in sunlight. Maybe check the 20 or so tiles above for a solid tile
 
Ok, my point is, you'll have to come up with an algorithm to check if the player is in sunlight. Maybe check the 20 or so tiles above for a solid tile
alright ill have a look, would you say the rules for teh sunlight would be similar to the rules of were rain falls in the game and if that would be a good starting point?
 
I know everyone gets a crap ton of error reports thrown at their face. But this is my first time ever modding/creating an item. Upon watching a video tutorial and following it step by step i tried making a sword. Terarria is giving me an issue and saying

error CS0246: The type or namespace name 'Terarria' could not be found (are you missing a using directive or an assembly reference?)

And heres the code im currently using

using System;
using Microsoft.Xna.Framework;
using Terarria;
using Terarria.Graphics.Effects;
using Terarria.Graphics.Shaders;
using Terarria.ID;
using Terarria.ModLoader;

namespace Redsblade.Items.Weapons
{
public class Redsblade : ModItem
{
public override void SetDefaults()
{
item.name = "Redsblade";
item.damage = 75;
item.melee = true;
item.width = 32;
item.height = 32;
item.toolTip = "Hey it worked";
item.useTime = 35;
item.useAnimation = 25;
item.useStyle = 1;
item.knockback = 8;
item.value = 100;
item.rare = 10;
item.useSound = 1;
item.autoReuse = true;
item.useTurn = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddTile(tileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();

}
}
}

Figured id come here for some help. Please and thank you guys. merry christmas all if you celebrate it!
 
I know everyone gets a crap ton of error reports thrown at their face. But this is my first time ever modding/creating an item. Upon watching a video tutorial and following it step by step i tried making a sword. Terarria is giving me an issue and saying

error CS0246: The type or namespace name 'Terarria' could not be found (are you missing a using directive or an assembly reference?)

And heres the code im currently using

using System;
using Microsoft.Xna.Framework;
using Terarria;
using Terarria.Graphics.Effects;
using Terarria.Graphics.Shaders;
using Terarria.ID;
using Terarria.ModLoader;

namespace Redsblade.Items.Weapons
{
public class Redsblade : ModItem
{
public override void SetDefaults()
{
item.name = "Redsblade";
item.damage = 75;
item.melee = true;
item.width = 32;
item.height = 32;
item.toolTip = "Hey it worked";
item.useTime = 35;
item.useAnimation = 25;
item.useStyle = 1;
item.knockback = 8;
item.value = 100;
item.rare = 10;
item.useSound = 1;
item.autoReuse = true;
item.useTurn = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddTile(tileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();

}
}
}

Figured id come here for some help. Please and thank you guys. merry christmas all if you celebrate it!

In your using directives you wrote terarria instead of terraria.
[doublepost=1482677644,1482677345][/doublepost]
I have a mod for tmod 0.8.5.3 but my version of tmod is 0.9.0.3, and the mod developer hasn't released an update yet, is there anyway to fix this myself?

If you really want to, you can try to decompile the mod with tmodreader and replace the old hooks and functions with newer ones.
But not every modder makes his mod decompilable, so you need luck.
 
I'm currently updating a mod of mine to the new tmodloader Version.
Does the TagCompount class accept unsigned longs or can i only save signed longs?
 
I know everyone gets a crap ton of error reports thrown at their face. But this is my first time ever modding/creating an item. Upon watching a video tutorial and following it step by step i tried making a sword. Terarria is giving me an issue and saying

error CS0246: The type or namespace name 'Terarria' could not be found (are you missing a using directive or an assembly reference?)

And heres the code im currently using

using System;
using Microsoft.Xna.Framework;
using Terarria;
using Terarria.Graphics.Effects;
using Terarria.Graphics.Shaders;
using Terarria.ID;
using Terarria.ModLoader;

namespace Redsblade.Items.Weapons
{
public class Redsblade : ModItem
{
public override void SetDefaults()
{
item.name = "Redsblade";
item.damage = 75;
item.melee = true;
item.width = 32;
item.height = 32;
item.toolTip = "Hey it worked";
item.useTime = 35;
item.useAnimation = 25;
item.useStyle = 1;
item.knockback = 8;
item.value = 100;
item.rare = 10;
item.useSound = 1;
item.autoReuse = true;
item.useTurn = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddTile(tileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();

}
}
}

Figured id come here for some help. Please and thank you guys. merry christmas all if you celebrate it!
thank you man! :D!!
 
Back
Top Bottom