Standalone [1.3] tModLoader - A Modding API

haha thanks. would you guys mind if i posed a WIP of the code I'm using here and have one of you see if I'm at-least not screwing it up terribly?
Everyone else does :) But really, if you try it, you should be able to tell if you are doing it right because it will work.
 
I get an error when trying to open the modded Terraria.exe after patch
"C:\Users\User\Desktop\ModLoader v0.5\tModLoader\Terraria.exe is not a valid win32 application."
 
Everyone else does :) But really, if you try it, you should be able to tell if you are doing it right because it will work.
True, however one of the features im using is flesh knuckle's targeting thing and i cant test it alone

(side note everyone here is WAY friendlier [and helpful] than the minecraft modding community)
 
Yeah so it would be ItemID.DirtBlock or whatever item you want.

So say the paladin's sheild would it be PaladinsSheild ?

And while im on the topic how would you write the recipie.AddTile for the Tinker's Workshop

Would the numerical IDs be sufficient? or does Terraria/C# not like that?
 
Last edited:
Yeah, Although I prefer TileID and the sorts. If you use visual studio and just type "TileID." you'll automatically get a list of all available items. It's a matter of preference, though.

im using Notepad++ i shouuuuuuld download visual studio but im really lazy.
[DOUBLEPOST=1442681761,1442681673][/DOUBLEPOST]Anyway here is my code so far..... im about to test it for the first time. please point out any errors. i started coding in C# for the first time literally last night so there is bound to be something a bit wonky.
Code:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Tinkermore.Items {
public class TankShield : ModItem
{
    public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
    {
        equips.Add(EquipType.Shield);
        return true;
    }

    public override void SetDefaults()
    {
        item.name = "Tank Shield";
        item.width = 24;
        item.height = 28;
        item.toolTip = "Absorbs 25% of damage done to players on your team when above 25% health";
        item.toolTip2 = "Enemies are more likely to target you";
        item.value = 65000;
        item.rare = 8;
        item.accessory = true;
        item.defense = 12;
    }

    public override void UpdateAccessory(Player player)
    {
        player.noKnockback = true;
                        if ((double)player.statLife > (double)player.statLifeMax2 * 0.25)
                        {
                            if (i == Main.myPlayer)
                            {
                                player.paladinGive = true;
                            }
                            else if (player.miscCounter % 5 == 0)
                            {
                                int num3 = Main.myPlayer;
                                if (Main.player[num3].team == player.team && player.team != 0)
                                {
                                    float single = player.position.X - Main.player[num3].position.X;
                                    float y1 = player.position.Y - Main.player[num3].position.Y;
                                    if ((float)Math.Sqrt((double)(single * single + y1 * y1)) < 800f)
                                    {
                                        Main.player[num3].AddBuff(43, 10, true);
                                    }
                                }
                            }
                        }
                  
          {
                        Player player297 = player;
                        player297.aggro = player297.aggro + 400;
                    }
    }

    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(mod);
        recipe.AddIngredient(Terraria.ID.ItemID.938);
        recipe.AddIngredient(Terraria.ID.ItemID.3016);
        recipe.AddTile(398);
        recipe.SetResult(this);
        recipe.AddRecipe();
    }
}}
[DOUBLEPOST=1442681796][/DOUBLEPOST]I have little to no idea what im doing
[DOUBLEPOST=1442681925][/DOUBLEPOST]and if i am to download VS what version do you recommend?
 
Last edited:
im using Notepad++ i shouuuuuuld download visual studio but im really lazy.
[DOUBLEPOST=1442681761,1442681673][/DOUBLEPOST]Anyway here is my code so far..... im about to test it for the first time. please point out any errors. i started coding in C# for the first time literally last night so there is bound to be something a bit wonky.

using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Tinkermore.Items {
public class TankShield : ModItem
{
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
equips.Add(EquipType.Shield);
return true;
}

public override void SetDefaults()
{
item.name = "Tank Shield";
item.width = 24;
item.height = 28;
item.toolTip = "Absorbs 25% of damage done to players on your team when above 25% health";
item.toolTip2 = "Enemies are more likely to target you";
item.value = 65000;
item.rare = 8;
item.accessory = true;
item.defense = 12;
}

public override void UpdateAccessory(Player player)
{
player.noKnockback = true;
if ((double)player.statLife > (double)player.statLifeMax2 * 0.25)
{
if (i == Main.myPlayer)
{
player.paladinGive = true;
}
else if (player.miscCounter % 5 == 0)
{
int num3 = Main.myPlayer;
if (Main.player[num3].team == player.team && player.team != 0)
{
float single = player.position.X - Main.player[num3].position.X;
float y1 = player.position.Y - Main.player[num3].position.Y;
if ((float)Math.Sqrt((double)(single * single + y1 * y1)) < 800f)
{
Main.player[num3].AddBuff(43, 10, true);
}
}
}
}

{
Player player297 = player;
player297.aggro = player297.aggro + 400;
}
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(Terraria.ID.ItemID.938);
recipe.AddIngredient(Terraria.ID.ItemID.3016);
recipe.AddTile(398);
recipe.SetResult(this);
recipe.AddRecipe();
}
}}
I think you really should download it! It might take some time getting started and used to, but it's more than worth it and will save you a lot (like really, a lot) of time. That autocomplete thing I was telling you about will also pop up with any other thing you try to reference. Things like the player class or the Main class. Really handy!
 
Back
Top Bottom