Standalone [1.3] tModLoader - A Modding API

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)

I don't see anything unique to the flesh knuckles except this line "this.aggro += 400;" in it's UpdateEquips method, so you should be fine if you include that too. There is no multiplayer support yet anyway....so just hope for the best for now.

Um, I guess we're nice. Personally I'm just bored and I like helping people and I've always wanted to get involved in a project.

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?

While guessing might work, the best option would be to check the documentation because it's not always according to pattern.

You can find the correct tile for the Tinker's Workshop in the documentation as well.

Just using numbers is fine, but for your sanity, I'd recommend doing stuff like "ItemID.DirtBlock" since it is so much easier to understand than "2". Just make sure to include "using Terraria.ID;" at the top if you use this method.

and if i am to download VS what version do you recommend?
Download Visual Studio 2015 Community edition. It's completely free. See a post a page back about setting it up for a mod.
[DOUBLEPOST=1442696642,1442696216][/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();
    }
}}

"recipe.AddIngredient(Terraria.ID.ItemID.938);" is wrong. These is no variable in the Terraria.ID.ItemID class called 938. There is, however, a variable called "PaladinsShield" with the VALUE of 938. Either use "Terraria.ID.ItemID.PaladinsShield" or "938". They both resolve to the value of 938. Do the same for 3016.

Also, " if (i == Main.myPlayer)" will give you a compile error because "i" doesn't exist. It should probably be replaced with "player.whoAmI"
 
I am trying to make recipes for the unimplemented Luminite drills, axes, chainsaws, and hammers but no matter what I have tried, I can't get them to work. Even manually spawning them doesn't work. Looking at the code, all the tools are completely setup and they should work, but instead, it drops a mostly blank item with red rarity. I tried manually setting them to have a name but that doesn't work. Any ideas of how I could get them to work?
 
It didn't work
This is troubling to me as a contributor to the tModLoader project. Some others have had this problem but I don't know why. Do you mind running running a checksum so that we know we are on the same page? Also, what is your operating system.

Vanilla 1.3.0.8 Steam version Terraria.exe MD5 checksum: fc400855d28d7c5cd501e8665ce29807
tModLoader v 0.5 Terraria.exe MD5 checksum: e0900da46e5e7d4c25075ce75f0e501d

I have this installed for Checksums, but any program should give the same sum.

If you could tell me your values, that will help us figure out where to look for a solution.
[DOUBLEPOST=1442697752,1442697585][/DOUBLEPOST]
I am trying to make recipes for the unimplemented Luminite drills, axes, chainsaws, and hammers but no matter what I have tried, I can't get them to work. Even manually spawning them doesn't work. Looking at the code, all the tools are completely setup and they should work, but instead, it drops a mostly blank item with red rarity. I tried manually setting them to have a name but that doesn't work. Any ideas of how I could get them to work?
That sounds weird. Wanna zip up your folder and post it here so I can check it? I've never see a "mostly blank item", but I'm sure I can figure it out.
 
That sounds weird. Wanna zip up your folder and post it here so I can check it? I've never see a "mostly blank item", but I'm sure I can figure it out.
There isn't really that much code. This is the code I was using to drop one of the drills. I just used this inside of a test item I have.

public override bool UseItem(Player player)
{
Item.NewItem((int)player.position.X,(int)player.position.Y,player.width,player.height,ItemID.VortexDrill);
return true;
}

The white box is the test item that I used the drop code with. You can hear the sound of the "drill" being picked up and it will show a quantity if you use it multiple times. The reason I said "mostly blank" is because it still has a red rarity.
Mostly blank item with red rarity.jpg
 
I don't see anything unique to the flesh knuckles except this line "this.aggro += 400;" in it's UpdateEquips method, so you should be fine if you include that too. There is no multiplayer support yet anyway....so just hope for the best for now.

Um, I guess we're nice. Personally I'm just bored and I like helping people and I've always wanted to get involved in a project.



While guessing might work, the best option would be to check the documentation because it's not always according to pattern.

You can find the correct tile for the Tinker's Workshop in the documentation as well.

Just using numbers is fine, but for your sanity, I'd recommend doing stuff like "ItemID.DirtBlock" since it is so much easier to understand than "2". Just make sure to include "using Terraria.ID;" at the top if you use this method.


Download Visual Studio 2015 Community edition. It's completely free. See a post a page back about setting it up for a mod.
[DOUBLEPOST=1442696642,1442696216][/DOUBLEPOST]

"recipe.AddIngredient(Terraria.ID.ItemID.938);" is wrong. These is no variable in the Terraria.ID.ItemID class called 938. There is, however, a variable called "PaladinsShield" with the VALUE of 938. Either use "Terraria.ID.ItemID.PaladinsShield" or "938". They both resolve to the value of 938. Do the same for 3016.

Also, " if (i == Main.myPlayer)" will give you a compile error because "i" doesn't exist. It should probably be replaced with "player.whoAmI"


Thanks for all the help ^^ and this doesn't support multiplayer? even if all players have the mod and its hosted not using steam?
 
There isn't really that much code. This is the code I was using to drop one of the drills. I just used this inside of a test item I have.

public override bool UseItem(Player player)
{
Item.NewItem((int)player.position.X,(int)player.position.Y,player.width,player.height,ItemID.VortexDrill);
return true;
}

The white box is the test item that I used the drop code with. You can hear the sound of the "drill" being picked up and it will show a quantity if you use it multiple times. The reason I said "mostly blank" is because it still has a red rarity.
View attachment 78446

Oh, I get i now. These items are specifically listed as deprecated in "ItemID.Sets.Deprecated", preventing them from doing anything. I added " Terraria.ID.ItemID.Sets.Deprecated[2774] = false;" to Mod.Load and it worked: (Not sure if it is the best place for this...but it worked.)
Untitled.png


But wait, why are you having an item spawn it? A recipe should work and should be much easier.
 
Oh, I get i now. These items are specifically listed as deprecated in "ItemID.Sets.Deprecated", preventing them from doing anything. I added " Terraria.ID.ItemID.Sets.Deprecated[2774] = false;" to Mod.Load and it worked: (Not sure if it is the best place for this...but it worked.)
View attachment 78453

But wait, why are you having an item spawn it? A recipe should work and should be much easier.
I was only trying to spawn it because the recipe I added for it wasn't working and I wanted to be sure that is wasn't just a problem with the recipe. Thank you so much for find that! Everything is working now.
 
Hi I am making a mod right now, it keeps giving me the error "The name 'ItemID' Does not exist in the current context"
Here is my code for the recipe, please help :):

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "ExampleItem", 10);
recipe.AddTile(null, ItemID.WorkBench);
recipe.SetResult(this);
recipe.AddRecipe();
}
 
Hi I am making a mod right now, it keeps giving me the error "The name 'ItemID' Does not exist in the current context"
Here is my code for the recipe, please help :):

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "ExampleItem", 10);
recipe.AddTile(null, ItemID.WorkBench);
recipe.SetResult(this);
recipe.AddRecipe();
}
needs "using Terraria.ID;" at top
 
needs "using Terraria.ID;" at top
Still doesn't work, it fixed the first part, now it is giving a different error though:

"The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddTile(Terraria.ModLoader.Mod, string)' has some invalid arguments"
 
I'm using the OnTileCollide method to spawn FeatherDust when FeatherKnifeProj collides with a tile.
How can I spawn the dust?
 
Hmmmmmmmm how do i make a fresh new copy of terraria? I've been wanting to make a mod for a while but im still trying to find out how to make them and i cant find out how to get the mod loader to work and how to load it.
 
Still doesn't work, it fixed the first part, now it is giving a different error though:

"The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddTile(Terraria.ModLoader.Mod, string)' has some invalid arguments"

Use this method signature: https://github.com/bluemagic123/tModLoader/wiki/ModRecipe#public-void-addtileint-tileid
That method signature is expecting a mod and a string, but you are trying to use a vanilla tile, so use the method signature with just the int.

I'm using the OnTileCollide method to spawn FeatherDust when FeatherKnifeProj collides with a tile.
How can I spawn the dust?

Look at this example and it should be clear: https://github.com/bluemagic123/tModLoader/blob/master/ExampleMod/Items/Weapons/ExampleSword.cs#L41

Hmmmmmmmm how do i make a fresh new copy of terraria? I've been wanting to make a mod for a while but im still trying to find out how to make them and i cant find out how to get the mod loader to work and how to load it.

In Steam, I think you can reinstall by clicking some button called "Delete Local Content" or something (right click Terraria, find it in there somewhere, you'll find it.). Then you reinstall it again from steam. If you want to keep your characters and worlds, be sure to back them up by copying them somewhere else before deleting it.

When installing tModLoader, FOLLOW the directions! Launch terraria as usual once you've completely installed it.
 
a few things..
is there a DustType method for getting the id of modded dust? Theres ItemType and TileType, but nothing for dusts.
Light pets seem to vanish when mounted on a custom mount, but the buffs for the light pets doesn't go away. The light pets do come back once you've dismounted.
and is there a IRC channel for this?
 
a few things..
is there a DustType method for getting the id of modded dust? Theres ItemType and TileType, but nothing for dusts.
Light pets seem to vanish when mounted on a custom mount, but the buffs for the light pets doesn't go away. The light pets do come back once you've dismounted.
and is there a IRC channel for this?
There isn't any DustType or GetDust method. There's no DustType method since modded dusts don't actually have their own ID's (you can give them any ID in OnSpawn to customize their behavior), and there's no GetDust since I didn't think it would be that useful since ModDust only represents a type of dust and not an actual Dust object.

Hm, I'll try to look into that light pet problem. I'm not sure if I'll be able to do anything about it in the next update, but for sure it will be fixed in the update after that at latest.

There isn't any IRC channel for this. I mostly hang out in #tapi, although a lot of Prism people also hang out there.
 
can someone confirm/deny this for me?
There is no official support for multiplayer. You could try it if you want, but it is not guaranteed to work properly.

I remember in one of the early updates it did work, except other players' custom armor wouldn't update properly across the server. In a more recent update trying to run a server flat-out doesn't work iirc.

I have official server support in my plans before full-release, but it will be one of the last things I add, since I want to work on all the actual features first.
 
There is no official support for multiplayer. You could try it if you want, but it is not guaranteed to work properly.

I remember in one of the early updates it did work, except other players' custom armor wouldn't update properly across the server. In a more recent update trying to run a server flat-out doesn't work iirc.

I have official server support in my plans before full-release, but it will be one of the last things I add, since I want to work on all the actual features first.

oh ok. thanks. hopefully it works at-least well enough for me and my friend.
 
Back
Top Bottom