Standalone [1.3] tModLoader - A Modding API

Umm...?
Code:
error CS1703: An assembly with the same identity 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' has already been imported. Try removing one of the duplicate references.
Help??
 
I put these files in, probably doing something stupid
They didnt show up in mymods area of tmod
I did put them in the mods folder.
This is the code of it
{
"displayName": "Test Weapon",
"texture": "Item/TestWeapon",
"size": [64, 64],
"maxStack": 1,
"value": [100, 0, 0, 0],
"rare": 7,
"tooltip": "My sword for testing, in mint condition.",
"useStyle": 1,
"useAnimation": 50,
"useTime": 50,
"damage": 100,
"knockback": 10,
"useSound": 1,
"autoReuse": true,
"useTurn": true,
"melee": true,
"recipes":[{
"items": { "Dirt Block": 1 },
"tiles": [ "Work Bench" ],
"creates": 1
}]
}
Can someone go through and find out why it doesnt show up in my mods folder? It has an .enable file, and it is a .tmod file.
 
I put these files in, probably doing something stupid
They didnt show up in mymods area of tmod
I did put them in the mods folder.
This is the code of it
{
"displayName": "Test Weapon",
"texture": "Item/TestWeapon",
"size": [64, 64],
"maxStack": 1,
"value": [100, 0, 0, 0],
"rare": 7,
"tooltip": "My sword for testing, in mint condition.",
"useStyle": 1,
"useAnimation": 50,
"useTime": 50,
"damage": 100,
"knockback": 10,
"useSound": 1,
"autoReuse": true,
"useTurn": true,
"melee": true,
"recipes":[{
"items": { "Dirt Block": 1 },
"tiles": [ "Work Bench" ],
"creates": 1
}]
}
Can someone go through and find out why it doesnt show up in my mods folder? It has an .enable file, and it is a .tmod file.
Your code is't right, as far as I can tell. It should look something more like this:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;

namespace MOD.Items.Weapons   //where is located
{
    public class Test : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Test";     //Sword name
            item.damage = 9999;            //Sword damage
            item.melee = true;            //if it's melee
            item.width = 200;              //Sword width
            item.height = 200;             //Sword height
            item.toolTip = "Tooltip";  //Item Description
            item.useTime = 100;          //how fast
            item.useAnimation = 25;  
            item.useStyle = 1;        //Style is how this item is used, 1 is the style of the sword
            item.knockBack = 100;      //Sword knockback
            item.value = 100;     
            item.rare = 10;
            item.useSound = 1;       //1 is the sound of the sword
            item.autoReuse = true;   //if it's capable of autoswing.
            item.useTurn = true;          
        }
        public override void AddRecipes()  //How to craft this sword
        {
            ModRecipe recipe = new ModRecipe(mod);   
            recipe.AddIngredient(ItemID.DirtBlock, 1);   //you need 1 DirtBlock
            recipe.AddTile(TileID.WorkBenches);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();

        }
        public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
        {
            player.AddBuff(mod.BuffType("BuffName"), 400);  //400 is the buff time
        }
        public override void MeleeEffects(Player player, Rectangle hitbox)
        {
            if (Main.rand.Next(1) == 0)
            {
            
            }
        }
    }
}
 
Your code is't right, as far as I can tell. It should look something more like this:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;

namespace MOD.Items.Weapons   //where is located
{
    public class Test : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Test";     //Sword name
            item.damage = 9999;            //Sword damage
            item.melee = true;            //if it's melee
            item.width = 200;              //Sword width
            item.height = 200;             //Sword height
            item.toolTip = "Tooltip";  //Item Description
            item.useTime = 100;          //how fast
            item.useAnimation = 25; 
            item.useStyle = 1;        //Style is how this item is used, 1 is the style of the sword
            item.knockBack = 100;      //Sword knockback
            item.value = 100;    
            item.rare = 10;
            item.useSound = 1;       //1 is the sound of the sword
            item.autoReuse = true;   //if it's capable of autoswing.
            item.useTurn = true;         
        }
        public override void AddRecipes()  //How to craft this sword
        {
            ModRecipe recipe = new ModRecipe(mod);  
            recipe.AddIngredient(ItemID.DirtBlock, 1);   //you need 1 DirtBlock
            recipe.AddTile(TileID.WorkBenches);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();

        }
        public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
        {
            player.AddBuff(mod.BuffType("BuffName"), 400);  //400 is the buff time
        }
        public override void MeleeEffects(Player player, Rectangle hitbox)
        {
            if (Main.rand.Next(1) == 0)
            {
           
            }
        }
    }
}
May i borrow this as a template?
 
I wonder if it would be possible to make a mod to make a Piranha gun summoner weapon?
like, it flies around, but when it attacks an opponent it latches on, then shoots to another enemy?
like the spider staff, but better?
 
Thanks! Time to start making it.
[doublepost=1480101413,1480101271][/doublepost]
Another question, do i have to delete the things that say //before them

before the // you need that. Those are all statements. Anything that starts with // is a comment and will be ignored when compiled. Each statement ends with a semicolon ;
 
Umm...?
Code:
error CS1703: An assembly with the same identity 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' has already been imported. Try removing one of the duplicate references.
Help??
Can anyone help me with my little problem?
[doublepost=1480103881,1480103585][/doublepost]@Kid Gaara may I suggest, Al0n37 has tutorials on their youtube channel, and they may help you out :D He/She has a lot of modding tutorials on their channel for terraria, covering everything.
 
Can anyone help me with my little problem?
To do that, you have to find out what a reference is, and delete the duplicate reference. Atleast thats how it seems when I read the error report.

Where did you put your file? I put mine in the mods folder, it is a .cs file, but it didnt show up.
[doublepost=1480103957,1480103893][/doublepost]
Can anyone help me with my little problem?
[doublepost=1480103881,1480103585][/doublepost]@Kid Gaara may I suggest, Al0n37 has tutorials on their youtube channel, and they may help you out :D He/She has a lot of modding tutorials on their channel for terraria, covering everything.
Thats where i got my original coding, the one that didnt work.
[doublepost=1480104030][/doublepost]
Can anyone help me with my little problem?
[doublepost=1480103881,1480103585][/doublepost]@Kid Gaara may I suggest, Al0n37 has tutorials on their youtube channel, and they may help you out :D He/She has a lot of modding tutorials on their channel for terraria, covering everything.
I got it from there because i am a noob at coding, and i am trying to learn the basics.
 
To do that, you have to find out what a reference is, and delete the duplicate reference. Atleast thats how it seems when I read the error report.

Where did you put your file? I put mine in the mods folder, it is a .cs file, but it didnt show up.
[doublepost=1480103957,1480103893][/doublepost]
Thats where i got my original coding, the one that didnt work.
Oh, you just put it in your mods folder? Actually, there is a lot more than that. You have to have a folder with a whole bunch of stuff, and put it into mod sources. In Al0n37's newer videos, they include a link for where you can download the whole tutorial mod folder. Put it in Mod Sources, then go into the Terraria main screen >mod sources > Build and reload the mod
 
Oh, you just put it in your mods folder? Actually, there is a lot more than that. You have to have a folder with a whole bunch of stuff, and put it into mod sources. In Al0n37's newer videos, they include a link for where you can download the whole tutorial mod folder. Put it in Mod Sources, then go into the Terraria main screen >mod sources > Build and reload the mod
Never mind. I got it in Mod sources as necassary.Just one more thing. An error report.
The type or namespace name 'MOD' could not be found (are you missing a using directive or an assembly reference?)
EDIT: Checked over the coding and noticed the mistake.
 
Last edited:
Back
Top Bottom