tModLoader Official tModLoader Help Thread

you should post the code of the projectile its self, it could be a problem there
Here it is:

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Fmod.Projectiles.WeaponProjectiles.Ranged
{
class HarpyBowProjectile : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Feather");
}
public override void SetDefaults()
{
projectile.width = 16;
projectile.height = 12;
projectile.ranged = true;
projectile.aiStyle = 0;
aiType = ProjectileID.HarpyFeather;
projectile.timeLeft = 1200;
}
}
}
 
Here it is:

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Fmod.Projectiles.WeaponProjectiles.Ranged
{
class HarpyBowProjectile : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Feather");
}
public override void SetDefaults()
{
projectile.width = 16;
projectile.height = 12;
projectile.ranged = true;
projectile.aiStyle = 0;
aiType = ProjectileID.HarpyFeather;
projectile.timeLeft = 1200;
}
}
}
I think you need to set projectile.friendly to true
 
Here it is:

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Fmod.Projectiles.WeaponProjectiles.Ranged
{
class HarpyBowProjectile : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Feather");
}
public override void SetDefaults()
{
projectile.width = 16;
projectile.height = 12;
projectile.ranged = true;
projectile.aiStyle = 0;
aiType = ProjectileID.HarpyFeather;
projectile.timeLeft = 1200;
}
}
}
aight so there are a few thing. first of the problem you were having was because of you not having

projectile.friendly = true;

that will hopfully fix the problem.
depending on what you want it to do you might want to add it so it stops when it hits a block like for example an arrow

projectile.tileCollide = true; ( or if you want it to go through blocks you dont have to)

and finally all projectiles go away if they touch water to change this you type

projectile.ignoreWater = true;

all of the things i showed go under
public override void SetStatic Defaults

which is where you had your other code.
i hope this helps
 
Hello, I'm trying to make an NPC, and I don't know how I would make the actual hitbox of the NPC smaller than the sprite?
I know I can change npc.width and npc.height, but I'm hesitant to in case that breaks the animation. Plus I'm wanting the hitbox offset from (0, 0) on the sprite anyway.
Help would be greatly appreciated, thanks

im not to wise on the subject. but if you are scared of it breaking the animation, you could make an exact copy of the npc ( add a "1" or something at the end of the name or it will override the pre-existing npc)
then you can mess around with it and not worry about it breaking. if it does break swap the file out with the back-up.

sorry i could not give a straight answere
 
ok so I have a projectile that is shot out of a staff. once the projectile hits the ground, it disappears and spawns in a consumable heart. I tried this in singleplayer, it works just fine, the consumable spawns in and you can use it to heal yourself. However, I wanted to test this with a friend, but for some reason although the projectile spawns, the consumable does NOT spawn after the projectile hits the ground. This issue only occurs in a multiplayer world. Any ideas on what's wrong here?
 
ok so I have a projectile that is shot out of a staff. once the projectile hits the ground, it disappears and spawns in a consumable heart. I tried this in singleplayer, it works just fine, the consumable spawns in and you can use it to heal yourself. However, I wanted to test this with a friend, but for some reason although the projectile spawns, the consumable does NOT spawn after the projectile hits the ground. This issue only occurs in a multiplayer world. Any ideas on what's wrong here?
Look a this example in the projectiles Kill hook: tModLoader/tModLoader and look at line 89 onwards, it shows how to spawn items
 
im not to wise on the subject. but if you are scared of it breaking the animation, you could make an exact copy of the npc ( add a "1" or something at the end of the name or it will override the pre-existing npc)
then you can mess around with it and not worry about it breaking. if it does break swap the file out with the back-up.

sorry i could not give a straight answere
I'm using git, so I can always revert if things go badly.
Thanks though
 
Can someone please help me wit how to make a bow split arrows into several more arrows, sort of the tsunami?
Thanks in advance!
 
greetings from linux debian ubuntu 20.04!
the mods work naticelt with steam launcher and tmod after running terraria once..

but the mods cant be found throught the browser or autodownloaded using the modpacks json file

it lists all the mods old and new on the mod browser
info button works

but when you click the download button it literally does nothing.

can someone fix this please?
 
i dont know why but the worlds in tmodloader wont load, this is the error im getting

Load Failed!
No back-up found

ive never had this problem before, if anyone knows how to fix this, help would be appreciated
 
i dont know why but the worlds in tmodloader wont load, this is the error im getting

Load Failed!
No back-up found

ive never had this problem before, if anyone knows how to fix this, help would be appreciated

so apparently an enemy npc i added screwed up the game
fixed now though
 
Question, how can you modify a enemies name? I am making a mod where certain enemies can become Elite enemies, having higher stats and inflict different effects. So far everything works alright, color change, stat up. Other than 2 problems being spiders when switching gaining new elite affixes and regenning health and the name. I want to have elite enemies have a slightly changed name, like "Overloading Blue Slime" and "Blazing Eye of Cthulhu." I know this is possible with "Prefixes for Enemies" existing, but have no idea how to do it.
 
Hello, i've recently been getting really bad framerate on modded multiplayer terraria and i have no idea why. I was doing fine, and then i played using fargo's soul mod and my fps was really bad during boss fights, only on multiplayer. Even after disabling the mod i continued to get bad frames. my game runs fine on singleplayer, but is bad in multiplayer whether i am hosting or joining another person's world. I would get around 40-50 fps just chilling at my base, and tank to 10-20 during most bossfights (some fights are fine, but plaugebringer goliath was especially bad). I can gather more info on this if needed. thanks in advance.
 
Hey, i'm working on a weapon for my mod and i'm having trouble finding a way to do this.
Basically, my weapon has 3 modes that can be changed by right clicking.
I also want to change the weapon's sprite when the mode changes.
Is there something like "item.texture = (texture path)"?
If not, how should i go about doing this?
Thanks
 
Did anyone know how to create Custom Grass seed? It's because i want to do a Biome whit the Grass seed like Hallow and Curroption/Crimson, but just appear in Post-Moon Lord.
 
Last edited:
having a very weird problem. everything worked fine and out of nowhere it isnt anymore.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Modding2.Items.TrustDamagePlayer;
using Modding2.Projectiles.SpearProjectiles;


namespace Modding2.Items.Spears.PreHardMode
{
// This class handles everything for our custom damage class
// Any class that we wish to be using our custom damage class will derive from this class, instead of ModItem
public abstract class CopperSpear : ModItem
{
public virtual void SafeSetDefaults()
{
item.melee = false;
item.ranged = false;
item.magic = false;
item.thrown = false;
item.summon = false;
}
public sealed override void SetStaticDefaults()
{
}
public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat)
{
add += TrustDamagePlayer.TrustDamagePlayer.ModPlayer(player).TrustDamageAdd;
mult *= TrustDamagePlayer.TrustDamagePlayer.ModPlayer(player).TrustDamageMult;
}
public override void GetWeaponKnockback(Player player, ref float knockback)
{
knockback += TrustDamagePlayer.TrustDamagePlayer.ModPlayer(player).TrustKnockback;
}
public override void ModifyTooltips(List<TooltipLine> tooltips) the red is the part that is working
{
TooltipLine tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria");
if (tt != null)
{
string[] splitText = tt.text.Split(' ');
string damageValue = splitText.First();
string damageWord = splitText.Last();
tt.text = damageValue + " Trust " + damageWord;
}
}
public override void SetDefaults()
{
item.damage = 12;
item.width = 28;
item.height = 28;
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = ItemUseStyleID.HoldingOut;
item.shootSpeed = 2.9f;
item.knockBack = 3;
item.value = 10000;
item.rare = 3;
item.UseSound = SoundID.Item1;

item.noMelee = true;
item.noUseGraphic = true;
item.shoot = ModContent.ProjectileType<CopperSpearProjectile>();
}
}
}

it is on every spear that ive made. never had this problem until now.
i highlighted the part thats not working in red.
i have no idea how to fix it
 
Last edited:
1606578952668.png
what i do wrong? anybody can help me? im trying to make custom yoyo
1606579112749.png
 
Hello, I'd like to know how one would go about making accessories that function similar to the Fire Gauntlet. The idea I have in mind is an item that makes all projectiles the wearer shoots explode on contact with an entity or block. However, despite my best efforts I cannot find any code for such things with which to reference.
 
Back
Top Bottom