tModLoader Official tModLoader Help Thread

You need to start it with
ModRecipe recipe = new ModRecipe(this);


I did that, still getting the same error when building the mod...

Capture.PNG


Capture2.PNG
 

Attachments

  • upload_2016-12-10_16-9-41.png
    upload_2016-12-10_16-9-41.png
    27.7 KB · Views: 160
Can Some one help me i got a Flying animation that got 4 frames and attack animation that go 4 frames how to make that only Flying animation play and if he shot a projectile he got a attack animation play ?
 
I'm having difficulty creating a workbench, whenever i place it it only puts down 2/6 pieces of it, I need help:sigh:

yhDpd


Here is my code:

Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;

namespace SwordsNStuff.Tiles
{
    public class AlloyFurnace : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileSolidTop[Type] = true;
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileTable[Type] = false;
            Main.tileLavaDeath[Type] = true;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2);
            TileObjectData.newTile.CoordinateHeights = new int[] { 18 };
            TileObjectData.addTile(Type);
            AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable);
            AddMapEntry(new Color(200, 200, 200), "Alloy Furnace");
            dustType = 0;
            disableSmartCursor = true;
            adjTiles = new int[] { TileID.WorkBenches };
        }

        public override void NumDust(int i, int j, bool fail, ref int num)
        {
            num = fail ? 1 : 3;
        }

        public override void KillMultiTile(int i, int j, int frameX, int frameY)
        {
            Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AlloyFunrace"));
        }
    }
}

and for the placable item:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;

namespace SwordsNStuff.Items.Placeable
{
    public class AlloyFurnace : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Alloy Furnace";
            item.width = 46;
            item.height = 34;
            item.maxStack = 99;
            AddTooltip("Use To Create New And Powerfull Alloys.");
            item.useTurn = true;
            item.autoReuse = true;
            item.useAnimation = 15;
            item.useTime = 10;
            item.useStyle = 1;
            item.consumable = true;
            item.value = 550;
            item.createTile = mod.TileType("AlloyFurnace");
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddTile(TileID.WorkBenches);
            recipe.AddIngredient(ItemID.Wood, 15);
            recipe.AddRecipeGroup("Wood");
            recipe.AddIngredient(ItemID.StoneBlock, 10);
            recipe.AddIngredient(ItemID.Campfire, 5);
            recipe.AddIngredient(ItemID.IronBar, 15);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
[doublepost=1481484596,1481484446][/doublepost]messed up my image...
 

Attachments

  • 20161211131008_1.jpg
    20161211131008_1.jpg
    622.4 KB · Views: 138
I'm having difficulty creating a workbench, whenever i place it it only puts down 2/6 pieces of it, I need help:sigh:

yhDpd


Here is my code:

Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;

namespace SwordsNStuff.Tiles
{
    public class AlloyFurnace : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileSolidTop[Type] = true;
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileTable[Type] = false;
            Main.tileLavaDeath[Type] = true;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2);
            TileObjectData.newTile.CoordinateHeights = new int[] { 18 };
            TileObjectData.addTile(Type);
            AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable);
            AddMapEntry(new Color(200, 200, 200), "Alloy Furnace");
            dustType = 0;
            disableSmartCursor = true;
            adjTiles = new int[] { TileID.WorkBenches };
        }

        public override void NumDust(int i, int j, bool fail, ref int num)
        {
            num = fail ? 1 : 3;
        }

        public override void KillMultiTile(int i, int j, int frameX, int frameY)
        {
            Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AlloyFunrace"));
        }
    }
}

and for the placable item:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;

namespace SwordsNStuff.Items.Placeable
{
    public class AlloyFurnace : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Alloy Furnace";
            item.width = 46;
            item.height = 34;
            item.maxStack = 99;
            AddTooltip("Use To Create New And Powerfull Alloys.");
            item.useTurn = true;
            item.autoReuse = true;
            item.useAnimation = 15;
            item.useTime = 10;
            item.useStyle = 1;
            item.consumable = true;
            item.value = 550;
            item.createTile = mod.TileType("AlloyFurnace");
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddTile(TileID.WorkBenches);
            recipe.AddIngredient(ItemID.Wood, 15);
            recipe.AddRecipeGroup("Wood");
            recipe.AddIngredient(ItemID.StoneBlock, 10);
            recipe.AddIngredient(ItemID.Campfire, 5);
            recipe.AddIngredient(ItemID.IronBar, 15);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
[doublepost=1481484596,1481484446][/doublepost]messed up my image...
Read the guide in my signature
 
Terraria just got updated guys, will the current version of tModLoader work with this new Terraria version? Would like to know before I do anything else.
 
when i tried to build my mod in terraria 1.3.4.4 and tmodloader v 0.9.0.2 it said Terraria.Item doesnt have a definition for useSound please help me
 
Okay, with this new update, all my weapons got kinda screwed up. Something about the sounds, apparently.

c:\Users\tehpootisman\Documents\My Games\Terraria\ModLoader\Mod Sources\Pootis\Items\Weapons\PathogenX.cs(28,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'useSound' and no extension method 'useSound' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)


Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;

namespace Pootis.Items.Weapons   //where is located
{
    public class PathogenX : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Pathogen X";     //Sword name
            item.damage = 500;            //Sword damage
            item.melee = true;            //if it's melee
            item.width = 90;              //Sword width
            item.height = 90;             //Sword height
            item.toolTip = "A Scythe wielded by the Fancy Reaper, Inti Croati. Also known as Rainbow Inti.";  //Item Description
            item.toolTip2 = "Take your hate, and turn it into the love you have for tearing your enemies apart at the seams!";
            item.useTime = 25;          //how fast
            item.useAnimation = 25;
            item.useStyle = 1;        //Style is how this item is used, 1 is the style of the sword
            item.knockBack = 5;      //Sword knockback
            item.value = Item.sellPrice(0, 50, 0, 0);
            item.rare = 11;
            item.useSound = 1;       //1 is the sound of the sword
            item.autoReuse = true;   //if it's capable of autoswing.
            item.useTurn = false;
        }
        public override void AddRecipes()  //How to craft this sword
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(mod.ItemType("PathogenY"));
            recipe.AddIngredient(mod.ItemType("NilSword"));//you need 1 DirtBlock
            recipe.AddTile(TileID.LunarCraftingStation);   //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("XBuff"), 2000);  //400 is the buff time
        }
        public override void MeleeEffects(Player player, Rectangle hitbox)
        {
            if (Main.rand.Next(1) == 0)
            {
                int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("XDust"));
            }
        }
    }
}

Figured i'd go ahead and ask just in case I wanted to try using custom sounds in the future.

Edit: Oh, I just found the link about the issue right after I posted this, lmao.
 
Can Some on help I got this but animation don't play
Code:
   public override void FindFrame(int frameHeight)
        {
            npc.frameCounter %= Main.npcFrameCount[npc.type];
            int frame = (int)npc.frameCounter;
            npc.frame.Y = frame * frameHeight;
            frame++;
            npc.spriteDirection = npc.direction;
        }
 
Can Some on help I got this but animation don't play
Code:
   public override void FindFrame(int frameHeight)
        {
            npc.frameCounter %= Main.npcFrameCount[npc.type];
            int frame = (int)npc.frameCounter;
            npc.frame.Y = frame * frameHeight;
            frame++;
            npc.spriteDirection = npc.direction;
        }
From what I can see, you are never changing npc.frameCounter, so npc.frame.Y never changes.
 
Hey guys, I got myself sorted out last time but I need some help for my armour, it's not returning any female values. All the files are there.
Example:
* divineBody.png
divineBodyFemale.png
* divineBody_Body.png
divineBody_FemaleBody.png
* divineBody_Arms.png
divineBody_FemaleArms.png
* divineLegs.png
divineLegsFemale.png
* divineLegs_Legs.png
divineLegs_FemaleLegs.png

*The only textures showing up ingame. Anyone has an easy fix? Thanks. :)
 
Last edited:
Back
Top Bottom