• Journey's End on PC - Find info here and here. Please report bugs and issues for PC 1.4 and 1.4.1 to Re-Logic here.
  • Journey's End on Mobile - Find info here. Report bugs for Mobile 1.4 to DR Studios at this link and give as much detail as possible.
  • 1.4 will bring many changes to the PC version. We strongly advise making plans to back up your worlds and players prior to updating your game. More details here.
  • Console and Switch - The latest news can be found here. To report a bug, please use this link.

Standalone [1.3] tModLoader - A Modding API

Kazzymodus

Moderator
Staff member
Moderator
For my code, I cant get this ammo reduction to work.

player.ammoCost33 = true;

Help. What is the actually sentence.
There are no booleans to indicate non-consumability (I hereby patent that word). Thankfully, tModLoader has a very useful solution to that in the form of the ConsumeAmmo hook.

Put this in your ModItem class (if it is a weapon, that is. If it's something else, let me know).
Code:
public override bool ConsumeAmmo(Player player)
{
    if (Main.rand.Next(3) == 0) // Generates a random number between 0 and 3 (0, 1 or 2)
    {
        return false;
    }
    return true;
}

If that doesn't work, add using Microsoft.Xna.Framework; to the top of your code.
 

ALmaZss

Plantera
I guess it's dumb question and it was discussed a lot, but I can't find it. How can I change the direction of projectile when it collides the tile? Multiplying projectile.direction by -1 does not give the expected result.
 

xsol

Terrarian
Well my computer is telling me there is trojan virus in the files so i guess i cant play with mods anymore R.I.P modded terraria 13-06-2016
I just told my computer to ignore whatever was triggering it, works fine.. still pretty strange though, because it was the windows defender that triggered, not a random anti-virus i had installed myself
 

ALmaZss

Plantera
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.
 

Iriazul

Terrarian
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
 

DoYouEvenCookie

Terrarian
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;
            }

        }
    }
}
 

Kazzymodus

Moderator
Staff member
Moderator
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.
 

Odran

Steampunker
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!
 
Top Bottom