item.useTime is an integer, and is the number of frames/ticks between uses. You can't use something every half tick because half ticks don't exist, and the same applies to any other fraction of a tick.how do i use a float reference on the useTime on an item for an example
item.useTime = .4f; //or 0.4f, 0.4, .4, etc.
so.... i can't make it faster an 1?item.useTime is an integer, and is the number of frames/ticks between uses. You can't use something every half tick because half ticks don't exist, and the same applies to any other fraction of a tick.
No, you can’t. Terraria runs at 60, so you can’t use something more than 60 times per second.so.... i can't make it faster an 1?
I think you should show your code.When I got to Build & Reload I get the error "Make sure to have exactly one class extending mod". I know I'm being very vague so if you need more info tell me but I keep getting this error for some reason and I don't know why so I don't know how to fix it .
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace WayfaringMerchant.Projectiles
{
public class PDCube : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("TX06 Personal Defense Cube Prototype");
Main.projFrames[projectile.type] = 1;
Main.projPet[projectile.type] = true;
}
public override void SetDefaults()
{
projectile.CloneDefaults(ProjectileID.CompanionCube);
projectile.width = 34;
projectile.height = 34;
aiType = 26;
projectile.tileCollide = true;
}
public override bool PreAI()
{
Player player = Main.player[projectile.owner];
//player.turtle = false; // Relic from aiType
return true;
}
public override void AI()
{
Player player = Main.player[projectile.owner];
WMPlayer modPlayer = player.GetModPlayer<WMPlayer>();
if (player.dead)
{
modPlayer.ComradeCube = false;
}
if (modPlayer.ComradeCube)
{
projectile.timeLeft = 2;
}
for (int i = 0; i < 200; i++)
{
NPC target = Main.npc[i];
//Getting the shooting trajectory
float shootToX = target.position.X + (float)target.width * 0.5f - projectile.Center.X;
float shootToY = target.position.Y + (float)target.height * 0.5f - projectile.Center.Y;
float distance = (float)System.Math.Sqrt((double)(shootToX * shootToX + shootToY * shootToY));
//If the distance between the projectile and the live target is active
if (distance < 400f && !target.friendly && target.active) //distance < 520 this is the projectile1 distance from the target if the tarhet is in that range the this projectile1 will shot the projectile2
{
if (projectile.ai[0] > 10f)//this make so the projectile1 shoot a projectile every 2 seconds(60 = 1 second so 120 = 2 seconds)
{
//Dividing the factor of 2f which is the desired velocity by distance
distance = 1.6f / distance;
//Multiplying the shoot trajectory with distance times a multiplier if you so choose to
shootToX *= distance * 3;
shootToY *= distance * 3;
int damage = 30; //this is the projectile2 damage
//Shoot projectile and set ai back to 0
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootToX, shootToY, 88, damage, 0, Main.myPlayer, 0f, 0f); //Spawning a projectile mod.ProjectileType("FlamethrowerProj") is an example of how to spawn a modded projectile. if you want to shot a terraria prjectile add instead ProjectileID.Nameofterrariaprojectile
Main.PlaySound(SoundID.Item12, projectile.position);
projectile.ai[0] = 0f;
i = 0;
}
}
}
projectile.ai[0] += 1f;
}
}
}
Is there a way to edit mods before tmodloader loads them? Because I need to edit them but it tells me an error and closes my game in the middle of loading my modsBe sure to ask if you need help, I'll do my best!
Launch tModLoader, click in the Terraria/tModLoader window when it opens, and then hold (left?) Shift as the Re-Logic splash screen disappears. tModLoader will then not load mods, allowing you to go into the mod list to disable problematic mods before reloading the mods.Is there a way to edit mods before tmodloader loads them? Because I need to edit them but it tells me an error and closes my game in the middle of loading my mods
I could use some help making a pet that can attack, but is not a minion. I know that it should be possible cause I've seen other mods that do this, but I haven't found an example and have no experience with pets myself.
I tried making my pet projectile shoot another projectile to give it a damage value, but not only does nothing happen, it also makes the pet glitch out and fall through the floor. Here's my code:
I used that method for a sentry before, but it doesn't seem to work here. Any ideas?Code:using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace WayfaringMerchant.Projectiles { public class PDCube : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("TX06 Personal Defense Cube Prototype"); Main.projFrames[projectile.type] = 1; Main.projPet[projectile.type] = true; } public override void SetDefaults() { projectile.CloneDefaults(ProjectileID.CompanionCube); projectile.width = 34; projectile.height = 34; aiType = 26; projectile.tileCollide = true; } public override bool PreAI() { Player player = Main.player[projectile.owner]; //player.turtle = false; // Relic from aiType return true; } public override void AI() { Player player = Main.player[projectile.owner]; WMPlayer modPlayer = player.GetModPlayer<WMPlayer>(); if (player.dead) { modPlayer.ComradeCube = false; } if (modPlayer.ComradeCube) { projectile.timeLeft = 2; } for (int i = 0; i < 200; i++) { NPC target = Main.npc[i]; //Getting the shooting trajectory float shootToX = target.position.X + (float)target.width * 0.5f - projectile.Center.X; float shootToY = target.position.Y + (float)target.height * 0.5f - projectile.Center.Y; float distance = (float)System.Math.Sqrt((double)(shootToX * shootToX + shootToY * shootToY)); //If the distance between the projectile and the live target is active if (distance < 400f && !target.friendly && target.active) //distance < 520 this is the projectile1 distance from the target if the tarhet is in that range the this projectile1 will shot the projectile2 { if (projectile.ai[0] > 10f)//this make so the projectile1 shoot a projectile every 2 seconds(60 = 1 second so 120 = 2 seconds) { //Dividing the factor of 2f which is the desired velocity by distance distance = 1.6f / distance; //Multiplying the shoot trajectory with distance times a multiplier if you so choose to shootToX *= distance * 3; shootToY *= distance * 3; int damage = 30; //this is the projectile2 damage //Shoot projectile and set ai back to 0 Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootToX, shootToY, 88, damage, 0, Main.myPlayer, 0f, 0f); //Spawning a projectile mod.ProjectileType("FlamethrowerProj") is an example of how to spawn a modded projectile. if you want to shot a terraria prjectile add instead ProjectileID.Nameofterrariaprojectile Main.PlaySound(SoundID.Item12, projectile.position); projectile.ai[0] = 0f; i = 0; } } } projectile.ai[0] += 1f; } } }
Doesn't seem to work either, no matter what I try, either the minion doesn't shoot anything or falls through the floor at some point. Screw minions.Maybe try replacing projectile.ai[0] with a different global variable, because the aiType the projectile uses might use projectile.ai[0] for controlling movement
Go to Documents\My Games\Terraria\ModLoader\Mods and delete enabled.json.I need some help finding out how to disable mods without opening Terraria.
I pilled on too many mods, there isn't enough memory for me to load the game up, but the mods aren't disabling after the game crashes.
This leads into a loop where the game restarts and then tries to load up all of the mods, leading it into a crash again.
I tried completely wiping my local files (I use steam) and repairing to base game, then reinstalling Tmodloader, but it also reinstalled all of the game crashing mods.
I've been searching through the tmodloader files for about an hour now, but in essence I'm either at a loss or I'm afraid to touch anything.
Anyone have any advice?
Does anybody know how to make a custom grass draw properly, with tile merging and stuff? I would like it to draw like it does in vanilla: View attachment 224379
But it draws like this instead:
View attachment 224380
I've looked at the source, and can't find anything, or at least anything that works. I attempted to override PreDraw to draw it manually, but there must be a much more consise way of doing it. If you can help that'd be great
Go to Documents\My Games\Terraria\ModLoader\Mods and delete enabled.json.
There's a new release. 0.11.3 now, try that one. Also the installer may not work super well on linux, unfortunately. Manually install it, and use the kickstart script. You may have to grant file permissions (chmod +x) on the terraria file and server file.Um, i tried installing the latest version of tmodloader (0.11.2.2) in terraria, but when i try launching it, Steam shows that it's in initialisation for a second, then closes and Terraria dosen't launch. I made sure to delete teraria entierly and reinstalling it before putting it in, and i made sure that i took the same version as my system type (linux). Is there something i might have done wrong ? Also, your automatic installer dosen't work in said version.
else if (player.ZoneBeach && liquidType == 0 && Main.rand.Next(5) == 0 && !WMWorld.fishedHat)
{
caughtType = mod.ItemType("MerchantHat");
WMWorld.fishedHat = true;
}
public class WMWorld : ModWorld
{
public static bool gaveHat;
public static bool fishedHat;
public override void Initialize()
{
gaveHat = false;
fishedHat = false;
}
public override TagCompound Save()
{
return new TagCompound
{
{"gaveHat", gaveHat},
{"fishedHat", fishedHat},
};
}
public override void Load(TagCompound tag)
{
gaveHat = tag.GetBool("gaveHat");
gaveHat = tag.GetBool("fishedHat");
}
public override void NetSend(BinaryWriter writer)
{
BitsByte flags = new BitsByte();
flags[0] = gaveHat;
flags[1] = fishedHat;
}
public override void NetReceive(BinaryReader reader)
{
BitsByte flags = reader.ReadByte();
gaveHat = flags[0];
fishedHat = flags[1];
}
}