• Labor of Love is here! Visit our Labor of Love thread for a special message from the team, a look at brand new Labor of Love merch, and the changelog (minus a few surprises 😉)

Standalone [1.3] tModLoader - A Modding API

360Chadscope

Pixel Pirate
Is there a way to make a 2x2 tile piece of furniture that can be placed on a wall?
I tried
Code:
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2Wall);
But I guess there is no tiles like that in vanilla Terraria.
 

Cjay

Terrarian
DO ANYONE KNOW WHAT IS THE CODE FOR ADDING BUFF TO ACCESSORY / ARMOR ?
IT WILL REALLY HELP TO MAKE MY MOD BETTER.
 
Last edited:

squishy_biscuit

Official Terrarian
Anyone here know to make your custom worm-type enemy spawn? Naturally. I tried this:

Code:
            {
                return spawnInfo.spawnTileY < Main.rockLayer && !Main.dayTime ? 0.01f : 0.01f;
            }

It doesn't work. If anyone would be able to help, I would be grateful.
There probably is an obvious way to do this.
And I'm probably just being an idoit.
^-^
 

Xander

Terrarian
Sorry to ask such a demanding question, but would someone be able to give me an example of wings code that spawns dust when in use? Thanks in advance.
 

WolfHybrid23

Official Terrarian
Capture3.PNG
Your mod name in the code is wrong it shouldn't be ExampleMod but 551
No the actual name of the mod is ExampleMod but I changed the folder name to 511
[doublepost=1483110803,1483110556][/doublepost]
Capture3.PNG

No the actual name of the mod is ExampleMod but I changed the folder name to 511
Is the mod maker so case sensitive that it won't accept a different folder name than the mod name as its directory
[doublepost=1483111390][/doublepost]Oh. Well I changed the Directory name of the mod back to "ExampleMod" and I had no errors when building the mod thx so much Kreeperslayer11
 

ReedDaBoss12

Terrarian
Umm... i dont know if this happenes to any of you guys... but when i try to use a weapon, for example, a yoyo, nothing happens. i dont know if this is in the settings or something, but i need help!
 

Masawesome

Terrarian
I'm having a problem. Every time I launch terraria, I get an error for the WWIAFT mod that I installed in a different version. When I get this, the game freezes. Due to the game automatically loading mods, it always just crashes. I have deleted and re-downloaded terraria and Tmodlaoder about 3 times and it still does it.
upload_2016-12-30_11-51-36.png
 

Joost8910

Dungeon Spirit
DO ANYONE KNOW WHAT IS THE CODE FOR ADDING BUFF TO ACCESSORY / ARMOR ?
IT WILL REALLY HELP TO MAKE MY MOD BETTER.
Code:
 public override void UpdateEquip(Player player)
{
           player.AddBuff(9, 2); //first number is the buff id, next is how many frames(60th of a second) it lasts. for example, 9 is the id for spelunker
}
Code:
 public override void UpdateAccessory(Player player, bool hideVisual)
{
         player.AddBuff(9, 2); //first number is the buff id, next is how many frames(60th of a second) it lasts. for example, 9 is the id for spelunker
}
 

Le tromp du Jawa

Eye of Cthulhu
I'm having a problem. Every time I launch terraria, I get an error for the WWIAFT mod that I installed in a different version. When I get this, the game freezes. Due to the game automatically loading mods, it always just crashes. I have deleted and re-downloaded terraria and Tmodlaoder about 3 times and it still does it. View attachment 153361
documents /my games /terraria/modloader/mods here you can delete mods
 

Ivysaur

Official Terrarian
I've got a small request for tmodloader.
Could you add a parameter to the ChatInput function in the Mod class that contains the ID of the player that sent the message?
Or would that be impossible to implement due to terrarias source code?
 

DoYouEvenCookie

Terrarian
I have a small problem here

I want to animate my forge which has a frame sheet just like the animated loom in the example mod, and I can't seem to get it to work.
I have here code for it, which has the some of the voidMololith's animation code in the example mod. But it has a longer sprite sheet and I can't get it to even start animating, It comes with no error and places, but doesn't animate.

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

namespace NovaStar.Tiles
{
    public class KindilightForge : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileSolidTop[Type] = false;
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileTable[Type] = true;
            Main.tileLavaDeath[Type] = true;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2);
            TileObjectData.newTile.Height = 2;
            //TileObjectData.newTile.Origin = new Point16(1, 2); THIS BREAKS THE PLACEMENT OF IT
            TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 18 };
            AddMapEntry(new Color(9, 224, 188), "Kindiligiht Forge");
            animationFrameHeight = 33;
            disableSmartCursor = true;
            TileObjectData.addTile(Type);
        }

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

        public override void AnimateTile(ref int frame, ref int frameCounter)
        {
            frame = Main.tileFrame[4];
            frameCounter = Main.tileFrameCounter[4];
        }

        public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
        {
            Tile tile = Main.tile[i, j];
            Texture2D texture;
            if (Main.canDrawColorTile(i, j))
            {
                texture = Main.tileAltTexture[Type, (int)tile.color()];
            }
            else
            {
                texture = Main.tileTexture[Type];
            }
            Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange);
            if (Main.drawToScreen)
            {
                zero = Vector2.Zero;
            }
            int height = tile.frameY == 36 ? 18 : 16;
            int animate = 0;
            if (tile.frameY >= 56)
            {
                animate = Main.tileFrame[Type] * animationFrameHeight;
            }
            Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.frameX, tile.frameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
            return false;
        }
    }
}
 

Orion The Boundary Ryu

Skeletron Prime
So I am trying to make a new ranged weapon for my mod but I get an error in lines (79,4) which I do not have. It only goes into the 40s. Here is my code,
Code:
using Microsoft.Xna.Framework;

using Microsoft.Xna.Framework.Graphics;

using Terraria;

using Terraria.ID;

using Terraria.ModLoader;



namespace Tf2.Items.Weapons

{

    public class BlackBox : ModItem

    {

        public override void SetDefaults()

        {

            item.name = "Black Box";

            item.damage = 25;

            item.ranged = true;

            item.width = 40;

            item.height = 20;

            item.toolTip = "MAGGOT!";

            item.useTime = 20;

            item.useAnimation = 20;

            item.useStyle = 5;

            item.noMelee = true;

            item.knockBack = 4;

            item.value = 10000;

            item.rare = 2;

            item.UseSound = SoundID.Item11;

            item.autoReuse = true;

            item.shoot = 10;

            item.shootSpeed = 16f;

            item.useAmmo = AmmoID.Rocket;

        }



        public override void AddRecipes()

        {

            ModRecipe recipe = new ModRecipe(mod);

            recipe.AddIngredient(ItemID.LeadBar, 10);

            recipe.AddTile(TileID.Anvils);

            recipe.SetResult(this);

            recipe.AddRecipe();

        }
 

WolfHybrid23

Official Terrarian
So I am trying to make a new ranged weapon for my mod but I get an error in lines (79,4) which I do not have. It only goes into the 40s. Here is my code,
Code:
using Microsoft.Xna.Framework;

using Microsoft.Xna.Framework.Graphics;

using Terraria;

using Terraria.ID;

using Terraria.ModLoader;



namespace Tf2.Items.Weapons

{

    public class BlackBox : ModItem

    {

        public override void SetDefaults()

        {

            item.name = "Black Box";

            item.damage = 25;

            item.ranged = true;

            item.width = 40;

            item.height = 20;

            item.toolTip = "MAGGOT!";

            item.useTime = 20;

            item.useAnimation = 20;

            item.useStyle = 5;

            item.noMelee = true;

            item.knockBack = 4;

            item.value = 10000;

            item.rare = 2;

            item.UseSound = SoundID.Item11;

            item.autoReuse = true;

            item.shoot = 10;

            item.shootSpeed = 16f;

            item.useAmmo = AmmoID.Rocket;

        }



        public override void AddRecipes()

        {

            ModRecipe recipe = new ModRecipe(mod);

            recipe.AddIngredient(ItemID.LeadBar, 10);

            recipe.AddTile(TileID.Anvils);

            recipe.SetResult(this);

            recipe.AddRecipe();

        }
your missing 2 close Brackets at the end first off.
 
Top Bottom