tModLoader Official tModLoader Help Thread

I have a question: on a mac, how would I quickly switch between modded and vanilla terraria? All descriptions of how to do this are made for windows. All of said descriptions (as far as I can tell) don't work on mac. If someone could help that'd be much appreciated. Thanks :D
 
I'm having a problem finishing this code for my custom vanity head. When I type item.Name I get an error saying "Property or indexer 'item.Name' cannot be assigned to -- it is read only." Also, Autoload says "Cannot find a suitable method to override." Can someone tell me what is wrong with my code?
To specify a name, you have to make it lowercase "item.name".
 
To specify a name, you have to make it lowercase "item.name".
What? No. Item names are defined in SetStaticDefaults().
Code:
public override void SetStaticDefaults()
{
   DisplayName.SetDefault("Item Name");
   Tooltip.SetDefault("Tooltip Description");
}
 
What? No. Item names are defined in SetStaticDefaults().
Code:
public override void SetStaticDefaults()
{
   DisplayName.SetDefault("Item Name");
   Tooltip.SetDefault("Tooltip Description");
}

Okay i fixed the item.name thing. I remember that now, thanks. I'm still having a problem with the autoload thing though.
[doublepost=1531593334,1531592947][/doublepost]
I have a question: on a mac, how would I quickly switch between modded and vanilla terraria? All descriptions of how to do this are made for windows. All of said descriptions (as far as I can tell) don't work on mac. If someone could help that'd be much appreciated. Thanks :D

You have to go into your files in your steam folder and just make a shortcut using both the Terraria.exe backup and the modded file. If you right click on the file there should be an option to make a shortcut.**Not sure if this works or not. I'm not very familiar with Mac but most computers are generally the same.
 
how would I make an NPC that targets the next closest NPC
 
Is there anyway to make tModLoader work for 1.3.5.3?
 
I didn't forget about that, at least not in my current version. Please note this is not in any way an up-to-date version. Here's an example of how you'd add a requiredTile
This is taken from a mod I'm currently working on ^^
Code:
Recipes.QuickRecipe(this, ItemID.SlimeStaff, 1, new int[,] { { ItemID.Gel, 200 }, { ModItems.OddStaff, 1 } }, TileID.TinkerersWorkbench);

If you want the above example, I can give you that snippet really quick,

Code:
        public static void QuickRecipe(Mod mod, int createItemType, int createItemStack, int[,] requiredItemsArray, int requiredTile)
        {
            ModRecipe recipe = new ModRecipe(mod);
            for (int i = 0; i < requiredItemsArray.Length / 2; i++)
            {
                recipe.AddIngredient(requiredItemsArray[i, 0], requiredItemsArray[i, 1]);
            }
            recipe.AddTile(requiredTile);
            recipe.SetResult(createItemType, createItemStack);
            recipe.AddRecipe();
        }
how did you do that little box you got for your replies and junk?
 
how did you do that little box you got for your replies and junk?
At the bottom right of someone's post, you can click the Reply link and it'll put it in your message as a quote block.

Or do you mean the code?
Press the Insert button next to the arrows and press Code
pQemoTE.png
 
I would like some help with a custom projectile, an animated one. All references I could find were outdated, and I've tried a lot. I have it in a gif and in a spritesheet png but neither shows up animated, but the projectile otherwise works fine. Here it is. Any help appreciated. Thanks.
 

Attachments

  • LenicusTome.cs
    LenicusTome.cs
    1.3 KB · Views: 183
  • Lenicus.png
    Lenicus.png
    3.2 KB · Views: 200
  • Lenicus.gif
    Lenicus.gif
    52.1 KB · Views: 171
  • Lenicus.cs
    Lenicus.cs
    2.5 KB · Views: 287
Returned to the forums to ask a quick question.

If I want to have different worlds with separate mod packs, how would I go about it? Could I potentially disable the mods I don't want, enable the ones I do, reload the game, and make sure to only use the characters & worlds I want with the new mod pack, or will there be any bleeding happening?

Essentially, can I have multiple different worlds running on different mods?
 
No, I've used several different modpacks and no profiles have been corrupted. As long as you use the right characters and disable each modpack when you do a new one, you'll be ok.
 
Hello, I want to make a projectile with an animation like the ghastly glaive,what I have to do?
I already made the png with the animation, but when i try to use the weapon it shoot the entire png (all frame)
 
I would like some help with a custom projectile, an animated one. All references I could find were outdated, and I've tried a lot. I have it in a gif and in a spritesheet png but neither shows up animated, but the projectile otherwise works fine. Here it is. Any help appreciated. Thanks.
Try this:
Code:
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Lenicus");
            Main.projFrames[projectile.type] = 7; //This is an animated projectile
        }

        public override void AI()
        {
                                                                //this is projectile dust
            int DustID2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 2f), projectile.width + 2, projectile.height + 2, mod.DustType("DustName"), projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 20, default(Color), 2.9f);
            Main.dust[DustID2].noGravity = true;
                                                          //this make that the projectile faces the right way
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
            projectile.localAI[0] += 1f;
            projectile.alpha = (int)projectile.localAI[0] * 2;
          
            if (projectile.localAI[0] > 130f) //projectile time left before disappears
            {
                projectile.Kill();
            }
                       // Loop through the 56 animation frames, spending 15 ticks on each.
            if (++projectile.frameCounter >= 15)
            {
                projectile.frameCounter = 0;
                if (++projectile.frame >= 56)
                {
                    projectile.frame = 0;
                }
            }
        }
You should look at ExampleMod, that would help you with this sort of stuff.

Make sure you use the spritesheet
 
Right, so I've created a custom shadowflame hex doll type weapon. Unfortunately, I have a problem. When my weapon fires my projectile, it just goes in a straight line, like when you fire the shadowflame tentacle with a custom weapon. I've looked at the source code and cannot figure it out. What I'm asking is: How do I make my projectile curve randomly, like the shadowflame tentacle?
Please help if you can :)
 
Try this:
Code:
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Lenicus");
            Main.projFrames[projectile.type] = 7; //This is an animated projectile
        }

        public override void AI()
        {
                                                                //this is projectile dust
            int DustID2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 2f), projectile.width + 2, projectile.height + 2, mod.DustType("DustName"), projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 20, default(Color), 2.9f);
            Main.dust[DustID2].noGravity = true;
                                                          //this make that the projectile faces the right way
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
            projectile.localAI[0] += 1f;
            projectile.alpha = (int)projectile.localAI[0] * 2;
        
            if (projectile.localAI[0] > 130f) //projectile time left before disappears
            {
                projectile.Kill();
            }
                       // Loop through the 56 animation frames, spending 15 ticks on each.
            if (++projectile.frameCounter >= 15)
            {
                projectile.frameCounter = 0;
                if (++projectile.frame >= 56)
                {
                    projectile.frame = 0;
                }
            }
        }
You should look at ExampleMod, that would help you with this sort of stuff.

Make sure you use the spritesheet
Thanks, but where are the animated projectiles in ExampleMod?
 
At the bottom right of someone's post, you can click the Reply link and it'll put it in your message as a quote block.

Or do you mean the code?
Press the Insert button next to the arrows and press Code
pQemoTE.png
no I meant for the junk like signatures etc.
 
I would like to add an image to the game at the cursor while the player is holding an item. Like how chairs and tables do when you hold them. But the image will not be the same as the item. Any help would be apreciated.
 
Hello, I am somewaht new to Modding with tModloader and I ran into a problem that I have not found a solution off yet.
Is there a way to make an Item's sprite bigger or am I always limited too the same size? At the moment I am working on an accessory and the sprite is 40 x 56 pixels, I would need it to be higher, but I can't do it. Tried to resize the sprite sheet accordingly or change item.height and width, but nothing work. So, any way to change this?
 
go to a sprite maker and you can change the size
 
Back
Top Bottom