Standalone [1.3] tModLoader - A Modding API

There are only a few things I would add if I could mod, mainly, every type of magic weapon for every tier. Like, the gem staff tier of sorts could have a AoE weapon to go with it.
[DOUBLEPOST=1438748220,1438748145][/DOUBLEPOST]
Yes it is. C# is the main coding language that is used to make mods using Tmodloader (I think you use something else for really really complicated scripts*don't quote me :p *) and is rather easy to understand with very little knowledge of coding. So just look up c# tutorials, theirs one on msdn(one of the top sites) and just look through to the versioning tutorial and you should have a good start to modding, then i would say jump in and look at the example mod, then slowly alter that until you feel comfortable with starting your own mod from scratch(don't post your altered example mod, that would be stealing)
Ok, ill give it a try. Thanks for the help!
 
There are only a few things I would add if I could mod, mainly, every type of magic weapon for every tier. Like, the gem staff tier of sorts could have a AoE weapon to go with it.
[DOUBLEPOST=1438748220,1438748145][/DOUBLEPOST]
Ok, ill give it a try. Thanks for the help!
Yup no problem, ask for help if you need it (but try not to ask too much :p, learning how to fix your problems by using the error logs will help with a lot of problems*and prevent evil glares from people you keep asking help from :D*)
 
The shield I added is not seeming to show up on the player. Any idea how I can fix this? Also this is the sprite I'm using for it.
 

Attachments

  • MagmaShield.png
    MagmaShield.png
    3.4 KB · Views: 221
Yup no problem, ask for help if you need it (but try not to ask too much :p, learning how to fix your problems by using the error logs will help with a lot of problems*and prevent evil glares from people you keep asking help from :D*)
Makes sense, one thing, do you think a Luminite "gem" staff using fragments would be a good idea? Or no?
 
Now I'm getting this (The tile is to the right of the character):
tPHlZ2s.png

I've set "animationFrameHeight = 3;" in setDefaults.
 
Can I see the texture file and the code?
BiWfc0x.png

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

namespace Tremor.Tiles {
public class BlastFurnace : ModTile
{
    public override void SetDefaults()
    {
        Main.tileSolidTop[Type] = true;
        Main.tileFrameImportant[Type] = true;
        Main.tileNoAttach[Type] = true;
        Main.tileTable[Type] = true;
        Main.tileLavaDeath[Type] = true;
        TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3);
        TileObjectData.newTile.CoordinateHeights = new int[]{18};
        TileObjectData.addTile(Type);
        animationFrameHeight = 3;
        AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable);
        mapColor = new Color(117, 117, 117);
        mapName = "Blast Furnace";
        adjTiles = new int[]{TileID.WorkBenches};
    }

public override void AnimateTile(ref int frame, ref int frameCounter)
{
    frameCounter++;
    if(frameCounter > 8)
    {
        frameCounter = 0;
        frame++;
        frame %= 8;
    }
}

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

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

namespace Tremor.Tiles {
public class BlastFurnace : ModTile
{
    public override void SetDefaults()
    {
        Main.tileSolidTop[Type] = true;
        Main.tileFrameImportant[Type] = true;
        Main.tileNoAttach[Type] = true;
        Main.tileTable[Type] = true;
        Main.tileLavaDeath[Type] = true;
        TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3);
        TileObjectData.newTile.CoordinateHeights = new int[]{18};
        TileObjectData.addTile(Type);
        animationFrameHeight = 3;
        AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable);
        mapColor = new Color(117, 117, 117);
        mapName = "Blast Furnace";
        adjTiles = new int[]{TileID.WorkBenches};
    }

public override void AnimateTile(ref int frame, ref int frameCounter)
{
    frameCounter++;
    if(frameCounter > 8)
    {
        frameCounter = 0;
        frame++;
        frame %= 8;
    }
}

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

First of all, you only need this line:
TileObjectData.newTile.CoordinateHeights = new int[]{18};
if each frame of your texture (without the purple lines) is 18 pixels tall.

As for the animationFrameHeight, try setting that to 3 times the pixel height of a single frame including the purple line.
 
First of all, you only need this line:
TileObjectData.newTile.CoordinateHeights = new int[]{18};
if each frame of your texture (without the purple lines) is 18 pixels tall.

As for the animationFrameHeight, try setting that to 3 times the pixel height of a single frame including the purple line.
So animationFrameHeight is this (highlighted by a dotted line)?:
e0uLU9K.png


Also I believe that each frame of texture of a tile is 16x16 (If I'm not mistaken).
 
I know, I've already did it. The problem is that only small piece of tile is showing.
try this
Code:
public override void SetDefaults()
{
Main.tileSolidTop[this.Type] = true;
Main.tileFrameImportant[this.Type] = true;
Main.tileNoAttach[this.Type] = true;
Main.tileTable[this.Type] = true;
Main.tileLavaDeath[this.Type] = true;
TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3);
TileObjectData.newTile.CoordinateHeights = new int[]{16,16,16};
TileObjectData.newTile.CoordinateWidths = new int[]{16,16,16};
TileObjectData.addTile(this.Type);
this.animationFrameHeight = 3;
this.animationFrameWidth = 3;
this.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable);
this.mapColor = new Color(117, 117, 117);
this.mapName = "Blast Furnace";
this.adjTiles = new int[]{TileID.WorkBenches};
}
 
So.. it's okay if you guys don't want to help me but I'm really confused >.< So.. I've been wrestling with this for about 2 days and I've gotten a little bit of nowhere. I've been looking through the tabs at other peoples codes to try and piece my own together but I simply can't get any of the examples to work at all. This is what I have so far and it's pretty much a copy of the Example Sword that was attached to the files. The client gives me back:

"\Terraria\ModLoader\Mod\Sources\ExampleSword\ExampleSword.cs\(31,9) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddIngredient(Terraria.ModLoader.Mod, string, int)' has some invalid arguments"

I've tried doing the code multiple ways on the recipes, and at one point I was able to get it to build with no errors, but nothing showed up in game at all. So I'm assuming that was wrong, but it also showed no errors so I'm a little lost. Thanks in advance and sorry >.<

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

namespace ExampleSword.Items {
public class ExampleSword : ModItem
{
    public override void SetDefaults()
    {
        item.name = "Example Sword";
        item.damage = 50;
        item.melee = true;
        item.width = 40;
        item.height = 40;
        item.toolTip = "This is a modded sword.";
        item.useTime = 20;
        item.useAnimation = 20;
        item.useStyle = 1;
        item.knockBack = 6;
        item.value = 10000;
        item.rare = 2;
        item.useSound = 1;
        item.autoReuse = true;
    }

    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(mod);
        recipe.AddIngredient(null, ItemID.Wood, 10);
        recipe.SetResult(this);
        recipe.AddRecipe();
    }

    public override void MeleeEffects(Player player, Rectangle hitbox)
    {
        if(Main.rand.Next(3) == 0)
        {
            int dust = ModDust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod, "Sparkle");
        }
    }

    public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
    {
        target.AddBuff(24, 60);
    }
}}
 
So I sorta worked on this, my idea is to spawn a mob here that has a chance to drop a new accessory that'll make Rod of Discord use mana // drop all sorts of 'funny' accessories. The mob will be sort of like a mini boss
Once biomes are working, this 'thing' will randomly spawn somewhere on the surface after killing xx boss
Capture 2015-08-05 13_49_25.png
 
try this
Code:
public override void SetDefaults()
{
Main.tileSolidTop[this.Type] = true;
Main.tileFrameImportant[this.Type] = true;
Main.tileNoAttach[this.Type] = true;
Main.tileTable[this.Type] = true;
Main.tileLavaDeath[this.Type] = true;
TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3);
TileObjectData.newTile.CoordinateHeights = new int[]{16,16,16};
TileObjectData.newTile.CoordinateWidths = new int[]{16,16,16};
TileObjectData.addTile(this.Type);
this.animationFrameHeight = 3;
this.animationFrameWidth = 3;
this.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable);
this.mapColor = new Color(117, 117, 117);
this.mapName = "Blast Furnace";
this.adjTiles = new int[]{TileID.WorkBenches};
}
Now getting 2much errors.
 
So.. it's okay if you guys don't want to help me but I'm really confused >.< So.. I've been wrestling with this for about 2 days and I've gotten a little bit of nowhere. I've been looking through the tabs at other peoples codes to try and piece my own together but I simply can't get any of the examples to work at all. This is what I have so far and it's pretty much a copy of the Example Sword that was attached to the files. The client gives me back:

"\Terraria\ModLoader\Mod\Sources\ExampleSword\ExampleSword.cs\(31,9) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddIngredient(Terraria.ModLoader.Mod, string, int)' has some invalid arguments"

I've tried doing the code multiple ways on the recipes, and at one point I was able to get it to build with no errors, but nothing showed up in game at all. So I'm assuming that was wrong, but it also showed no errors so I'm a little lost. Thanks in advance and sorry >.<

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

namespace ExampleSword.Items {
public class ExampleSword : ModItem
{
    public override void SetDefaults()
    {
        item.name = "Example Sword";
        item.damage = 50;
        item.melee = true;
        item.width = 40;
        item.height = 40;
        item.toolTip = "This is a modded sword.";
        item.useTime = 20;
        item.useAnimation = 20;
        item.useStyle = 1;
        item.knockBack = 6;
        item.value = 10000;
        item.rare = 2;
        item.useSound = 1;
        item.autoReuse = true;
    }

    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(mod);
        recipe.AddIngredient(null, ItemID.Wood, 10);
        recipe.SetResult(this);
        recipe.AddRecipe();
    }

    public override void MeleeEffects(Player player, Rectangle hitbox)
    {
        if(Main.rand.Next(3) == 0)
        {
            int dust = ModDust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod, "Sparkle");
        }
    }

    public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
    {
        target.AddBuff(24, 60);
    }
}}

remove the null in the recipe.AddIngredient line

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

namespace ExampleSword.Items {
public class ExampleSword : ModItem
{
    public override void SetDefaults()
    {
        item.name = "Example Sword";
        item.damage = 50;
        item.melee = true;
        item.width = 40;
        item.height = 40;
        item.toolTip = "This is a modded sword.";
        item.useTime = 20;
        item.useAnimation = 20;
        item.useStyle = 1;
        item.knockBack = 6;
        item.value = 10000;
        item.rare = 2;
        item.useSound = 1;
        item.autoReuse = true;
    }

    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(mod);
        recipe.AddIngredient(ItemID.Wood, 10);
        recipe.SetResult(this);
        recipe.AddRecipe();
    }

    public override void MeleeEffects(Player player, Rectangle hitbox)
    {
        if(Main.rand.Next(3) == 0)
        {
            int dust = ModDust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod, "Sparkle");
        }
    }

    public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
    {
        target.AddBuff(24, 60);
    }
}}
 
Back
Top Bottom