tModLoader Official tModLoader Help Thread

I can't see the picture, but the createtile refers to a tile that doesn't exist.
Screenshot (13).png


and this is the ExamplePrinter
ExamplePrinter.png

This is the ExamplePrinterSprite
ExamplePrinterSprite.png
 
So this is what you're talking about.
Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace NikIsSikYoyoMod.Items.Placeable
{
    public class ExamplePrinterSprite : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "3D Printer";
            item.width = 28;
            item.height = 14;
            item.maxStack = 1;
            AddTooltip("");
            item.useTurn = true;
            item.autoReuse = true;
            item.useAnimation = 15;
            item.useTime = 10;
            item.useStyle = 1;
            item.consumable = true;
            item.value = 150;
            item.createTile = mod.TileType("ExamplePrinter");
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
 
So... I am making a mod with a friend but we have 1 problem. It gives us an error at titleID. or ItemID.

This is our code :

using Terraria;
using Terraria.ModLoader;

namespace Terradorium.Items.Weapons
{
public class flowerofwater : ModItem
{
public override void SetDefaults()
{
item.name = "Flower of water";
item.damage = 23;
item.magic = true;
item.mana = 4;
item.width = 40;
item.height = 40;
item.toolTip = "So quick for such little damage";
item.useTime = 12;
item.useAnimation = 25;
item.useStyle = 5;
Item.staff[item.type] = true; //this makes the useStyle animate as a staff instead of as a gun
item.noMelee = true; //so the item's animation doesn't do damage
item.knockBack = 14;
item.value = 5400;
item.rare = 4;
item.useSound = 25;
item.autoReuse = true;
item.shoot = mod.ProjectileType("WaterRocket");
item.shootSpeed = 10f;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.WaterBolt);
recipe.AddIngredient(ItemID.Aquascepter);
ModRecipe.AddTile(tileID.WorkBenches); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();
}


}
}


And this is the error :

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\Terradorium\Items\Weapons\FlowerOfWater.cs(34,31) : error CS0103: The name 'tileID' does not exist in the current context

I need help...
 
Install VisualStudio. This is TileID

ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.MartianConduitPlating, 40);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this);
recipe.AddRecipe();

Why ModRecipe.AddTile(tileID.WorkBenches); ?
 
Man... Install visual studio, you have just put TileID. and visualstudio give you a list of all thing after. You can go without my help for that ^^'

And other answer: google, i have your answer directly after write: Terraria TileID wiki.
 
No matter what I try I can't get my mechworm minion's Tail and Head to despawn after the player has been killed. The body segments despawn fine.

Anybody know what I could use to force them to despawn when the player is no longer active?
I tried this on all of the segments:
Code:
Player player = Main.player[projectile.owner];
 if (!player.active)
 {
 projectile.Kill();
 }
But it didn't work.
 
when mechworm left(or not, but he can check, maybe? :x ), you have try?
Code:
          if (Main.player[npc.target].dead)
            {
                npc.TargetClosest(true);
                if (Main.player[npc.target].dead)
                {
                    npc.velocity = new Vector2(0f, 10f);
                    if (npc.timeLeft > 10)
                    {
                        npc.timeLeft = 10;
                      for (int index = 0; index < 200; ++index)
                     {
                      if (Main.projectile[index].type == mod.ProjectileType("nameminion"))
                      {
                     Main.projectile[index].Kill()
                     }
            }
                    }
                    return;
                }
            }
 
when mechworm left(or not, but he can check, maybe? :x ), you have try?
Code:
          if (Main.player[npc.target].dead)
            {
                npc.TargetClosest(true);
                if (Main.player[npc.target].dead)
                {
                    npc.velocity = new Vector2(0f, 10f);
                    if (npc.timeLeft > 10)
                    {
                        npc.timeLeft = 10;
                      for (int index = 0; index < 200; ++index)
                     {
                      if (Main.projectile[index].type == mod.ProjectileType("nameminion"))
                      {
                     Main.projectile[index].Kill()
                     }
            }
                    }
                    return;
                }
            }

I believe that is mostly for NPCs and if they have a player target. If the player target is dead then the NPC will despawn.

It doesn't quite work for projectiles. I'll keep trying more things until it eventually works out.
 
Alright, fixed the despawning the minion issue by adding a buff for it like in the Example Mod and using some Stardust Dragon code.

Only issue I have now is this:
105600_screenshots_20160628153546_1.jpg

Would anyone know how to stop a separate Tail segment from spawning every time the summoning weapon is used?
 
Back
Top Bottom