Standalone [1.3] tModLoader - A Modding API

And yet another question, I bet, was discussed here, how can I move drill to my hands? I guess something like draworiginoffset could help me, but if I place the drill further on X-axis, while I'm drilling the blocks on the left side of me the drill goes too far on X-axis. I can't find anything about it in example mod.
You can use the player.direction variable to set the offset correctly. Just multiply your offset by player.direction.
 
Best antivirus is no antivirus. Mostly because the only viruses on the Internet are in places you shouldn't be anyway.

Of course, people do have the right to be paranoid, but I've never gotten a single virus, even on Windows.

...I hope I'm not jinxing it
 
There must be something wrong there somewhere. I'll have to see all of your projectile's code to really see what's happening. If someone else spots the problem before I do, feel free to jump in with a solution.

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

namespace Pack.Projectiles
{
    public class PossessedTempliteHammerP : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Possessed Templite Hammer";
            projectile.width = 52;
            projectile.height = 52;
            projectile.friendly = true;
            projectile.penetrate = -1;
            projectile.aiStyle = 3;
            projectile.melee = true;
            projectile.tileCollide = false;
            projectile.timeLeft = 60000;
            projectile.light = 1f;
        }
        public override void OnHitNPC(NPC n, int damage, float knockback, bool crit)
        {
            Player player = Main.player[projectile.owner];
            player.statLife += 10; //Heals by 10; Can be changed of course
            player.HealEffect(10); //Shows a green 10 above your head to show you've been healed; Can be changed of course
            if (projectile.ai[1] > 0)
                projectile.ai[0] = 0;
            if (projectile.ai[0] == 0f)
            {
                projectile.velocity *= -1;
            }
            projectile.netUpdate = true;
        }
        public override void PostAI()
        {
            Main.NewText("ai[0]: " + projectile.ai[0] + ", ai[1]: " + projectile.ai[1]);
            if (projectile.ai[0] == 1)
            {
                projectile.velocity *= 2;
            }

        }
    }
}
 
Anybody know the Terraria.ID.ProjectileID for Rockets?

There are four, corresponding with their items: RocketI (134), RocketII (137), RocketIII (140) and Rocket IV (143).

Doesn't destroy tilesDestroys tiles
Small radiusRocket IRocket II
Large radiusRocket IIIIRocket IV
 
Last edited:
Anybody know the Terraria.ID.ProjectileID for Rockets?
I assume you're trying to make endless Rocket ammunition items for your Infinity mod, so I'll try to save you some headache (I've been trying to figure it out for a while in my own mod):
In the ammunition ModItem, you'll want to make item.ammo = 771; and item.shoot = 0, 3, 6, or 9 for Rockets I, II, III, and IV respectively. I tried it before using the projectile IDs for each of the rockets and ended up with a RL that shot Eye Springs .-.
However, I still can't figure out how to get the Snowman Cannon to properly fire the rockets, it doesn't fire a projectile when I use my endless Rocket item.
 
Hello!
I have a weapon that should be an "arm cannon", is there a way to do that when this item is selected it shows its sprite on player's arm witouth clicking (much like nebula blaze and nebula arcanum do)
Thanks for help!
 
What the code should be for this?
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace Randomod.Items.Equipables.Accessories
{
    class SpelunkerGlasses : ModItem
    {
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.Face);
            return true;
        }

        public override void SetDefaults()
        {
            item.name = "Spelunker Glasses";
            item.height = 14;
            item.width = 8;
            item.material = true;
            item.maxStack = 1;
            item.rare = 3;
            item.headSlot = 1;
        }

        public override void UpdateEquip(Player player)
        {
            player.AddBuff(BuffID.Spelunker, 1);
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "SpelunkerLens", 1);
            recipe.AddIngredient(ItemID.Wood, 5);
            recipe.AddTile(TileID.TinkerersWorkbench);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
 
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace Randomod.Items.Equipables.Accessories
{
    class SpelunkerGlasses : ModItem
    {
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.Face);
            return true;
        }

        public override void SetDefaults()
        {
            item.name = "Spelunker Glasses";
            item.height = 14;
            item.width = 8;
            item.material = true;
            item.maxStack = 1;
            item.rare = 3;
            item.headSlot = 1;
        }

        public override void UpdateEquip(Player player)
        {
            player.AddBuff(BuffID.Spelunker, 1);
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "SpelunkerLens", 1);
            recipe.AddIngredient(ItemID.Wood, 5);
            recipe.AddTile(TileID.TinkerersWorkbench);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
Could you try removing this line from your SetDefaults function:
Code:
item.headSlot = 1;
 
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace Randomod.Items.Equipables.Accessories
{
    class SpelunkerGlasses : ModItem
    {
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.Face);
            return true;
        }

        public override void SetDefaults()
        {
            item.name = "Spelunker Glasses";
            item.height = 14;
            item.width = 8;
            item.material = true;
            item.maxStack = 1;
            item.rare = 3;
            item.headSlot = 1;
        }

        public override void UpdateEquip(Player player)
        {
            player.AddBuff(BuffID.Spelunker, 1);
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "SpelunkerLens", 1);
            recipe.AddIngredient(ItemID.Wood, 5);
            recipe.AddTile(TileID.TinkerersWorkbench);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Do you want to use this as a vanity or to equip it on the helmet slot?
EDIT: nvm
EDIT 2: In wich slot do you want to equip this? In head slot or into accessories?
 
Back
Top Bottom