Standalone [1.3] tModLoader - A Modding API

Hey, can someone help me? I got "...\Documents\my games\Terraria\ModLoader\Mod Sources\VanillaExpansion\Items\Weapons\PurifyStaff.cs(41,3) : error CS1513: } expected" error, checked the code for this missing "}" and haven't found it. Here's the code.
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace VanillaExpansion.Items.Weapons
{
public class PurityStaff : ModItem
{
public override void SetDefaults()
{
item.name = "Purity Staff";
item.damage = 20;
item.magic = true;
item.mana = 10;
item.width = 32;
item.height = 32;
item.toolTip = "Pure the evil!";
item.useTime = 25;
item.useAnimation = 25;
item.useStyle = 5;
Item.staff[item.type] = true;
item.noMelee = true;
item.knockBack = 5;
item.value = 10000;
item.rare = 2;
item.useSound = 20;
item.autoReuse = true;
item.shoot = mod.ProjectileType("PurityProj");
item.shootSpeed = 16f;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "PurifedOre", 20);
recipe.AddTile(null, "Workbench");
recipe.SetResult(this);
recipe.AddRecipe();
}
}
Please, tell me what I did wrong. :)
 
Hey,does anyone know how to fix this error?
Yesterday i was playing fine with my friend but now every time i join his server it crashes when i get "found server",we tried re-installing everything from the mod to the whole game and still crashes everytime i try to join his server.
Anything i can do to fix this?
 
Check here to see how to setup your project in Visual Studio, that may get you going.
Hey, I did everything what you said. I set up a VS project and all. But it still won't show me all available methods and variables via '.'. It also highlights all Terraria-related existing methods and libraries. The mod itself has only one item so far, and Terraria managed to compile it without errors, but nothing is working. (I added a simple recipe: a helm (6 wood). It doesn't appear as a craftable item)
 
Hey, I did everything what you said. I set up a VS project and all. But it still won't show me all available methods and variables via '.'. It also highlights all Terraria-related existing methods and libraries. The mod itself has only one item so far, and Terraria managed to compile it without errors, but nothing is working. (I added a simple recipe: a helm (6 wood). It doesn't appear as a craftable item)
Did you reference vanilla or tmodloader. Do you have a class that extends mod. Did you override setmodinfo and set autoload to true. Did you make sure to override virtual methods.
[doublepost=1457909927,1457909689][/doublepost]
Hey, I can't get back to non-modded Terraria because when I launch Terraria from Steam, it says that it's the tModLoader version. The only thing I could think of was to rename the program (the one named Terraria with the jungle tree, right?), but that didn't help. Do you know something I could do to fix it?
EDIT: Fixed it!
Apparently I had to move the tModLoader files out of the Terraria folder and add specifically the Terraria executable (just to make sure it can't run something else) and play it from the exe!
SECOND EDIT: but now I can't get back to the tModLoader
:/ w/e
All you need to understand is that steam will launch "Terraria.exe". You can rename one or the other. If you want to switch between them, you could just directly open the exe instead of launching through steam. Maybe you'll want to make a desktop shortcut to the one that isn't named Terraria.exe for your convenience
 
Hey, I did everything what you said. I set up a VS project and all. But it still won't show me all available methods and variables via '.'. It also highlights all Terraria-related existing methods and libraries. The mod itself has only one item so far, and Terraria managed to compile it without errors, but nothing is working. (I added a simple recipe: a helm (6 wood). It doesn't appear as a craftable item)
For the autocompletion: If all's well, you should have some sort of folder in your mod project called 'References...' Right-click that, select 'Add Reference...' and select browse. Now look for the tModLoader Terraria.exe file (inside your steam folder and all) and add that as a reference (now autocomplete should work).

As for your code, check the things jopojelly mentioned. If that still doesn't work, could you show me your code?
 
Have you found an if statement like 'if(this.aisStyle == 6)'?
In that if statement is the code you'll want to work with.
This small thing?
if (this.aiStyle == 6)
{
for (int k = (int)this.ai[0]; k > 0; k = (int)Main.npc[k].ai[0])
{
if (Main.npc[k].active)
{
Main.npc[k].active = false;
if (Main.netMode == 2)
{
Main.npc[k].life = 0;
Main.npc[k].netSkip = -1;
NetMessage.SendData(23, -1, -1, "", k, 0f, 0f, 0f, 0, 0, 0);
}
}
}
}
 
This small thing?
if (this.aiStyle == 6)
{
for (int k = (int)this.ai[0]; k > 0; k = (int)Main.npc[k].ai[0])
{
if (Main.npc[k].active)
{
Main.npc[k].active = false;
if (Main.netMode == 2)
{
Main.npc[k].life = 0;
Main.npc[k].netSkip = -1;
NetMessage.SendData(23, -1, -1, "", k, 0f, 0f, 0f, 0, 0, 0);
}
}
}
}
I'm afraid not...
You'll want to look for this line first: public void VanillaAI() and inside that function look for that if statement.
 
DO I REALLY HAVE TO DECOMPILE EVERY SINGLE TIME!?
That should not be necessary.
After decompiling the NPC class, I just copied it all and put it in a seperate .cs file to look through using notepad++ (which is waaaay faster than decompiling again).
 
That should not be necessary.
After decompiling the NPC class, I just copied it all and put it in a seperate .cs file to look through using notepad++ (which is waaaay faster than decompiling again).
Screw it, Im not going to do it again. My computer overheats and i really dont want to damage it.
 
Back
Top Bottom