EvanKrusher948
Skeletron Prime
Remove the 'f' from the last line. Alternatively, you can do something like this: (int)("insert something with a 'float' value here").
Thanks
Remove the 'f' from the last line. Alternatively, you can do something like this: (int)("insert something with a 'float' value here").
using Terraria;
using Terraria.ModLoader;
namespace DarkestNightsMod.Projectiles
{
public class SpineBreakerProj : ModProjectile
{
public override void SetDefaults()
{
projectile.Name = "Spine Breaker";
projectile.width = 22;
projectile.height = 22;
projectile.aiStyle = 3;
projectile.friendly = true;
projectile.melee = true;
projectile.magic = false;
projectile.penetrate = -1;
projectile.maxPenetrate = -1;
projectile.timeLeft = 600;
projectile.extraUpdates = 1;
}
public const int Hits = 0;
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
Hits++;
if (Hits == 3) //number of enemies needed to be hit before the returns code runs and also i think you should add something to call it back if you don't hit anything.
{
projectile.velocity.X *= .5f;
projectile.velocity.Y *= .5f;
Hits = 0;
}
}
}
}
Ok.look at the ais code for said skeleton wizard
npc only has friendly, not hostile. Something that is !friendly is hostile. Projectiles are different, they have both friendly and hostile bools because some projectiles, like bombs, can damage both the player and enemies.for the homing projectiles, the "if (target.hostiles)" at the beginning says that NPC doesn't contain a definition for "hostiles." any reason why?
Greetings. Is anybody here ? I’m trying to learn how to make mods myself, but so far it’s going badly. I want to ask for help on several issues. I wanted to change the attack speed, but in addition to the change, an inscription was also added. -150 speed. I tried to change a couple of code lines. The inscription faded or changed. But the speed of the scythe also returned to its original one. I just wanted to make a very slow weapon, but this inscription is simply not needed at all.View attachment 236973 How can it be removed ? Here is the code :
using Terraria.ID;
using Terraria.ModLoader;
namespace Wares.Items
{
public class Basa : ModItem
{
public override void SetStaticDefaults()
{
Tooltip.SetDefault("Interesting scythe, crafted from diamonds and platinum bars. Brings some really sharp harvest");
}
public override void SetDefaults()
{
item.damage = 45;
item.melee = true;
item.width = 60;
item.height = 50;
item.useTime = 20;
item.useAnimation = 50;
item.useStyle = 1;
item.knockBack = 6;
item.value = 10000;
item.rare = 5;
item.UseSound = SoundID.Item71;
item.autoReuse = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
// TODO : Fix this!
namespace TechAndScalesMod.Projectiles
{
class LavaHighVelocity : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Lava High Velocity");
ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 136;
projectile.height = 2;
projectile.aiStyle = 1; // The AI this projectile has.
projectile.friendly = true;
projectile.hostile = false;
projectile.ranged = true; // Is this shot out of a ranged weapon?
projectile.penetrate = 1; // If this projectile has penetration. Set to 0 to disable.
projectile.timeLeft = 600; // Life of the projectile. 60 = 1 sec.
projectile.alpha = 255; // The alpha of the bullet.
projectile.light = 1f; // How bright the light this projectile emits. Set to 0 for none.
projectile.tileCollide = true; // Can this projectile hit tiles?
projectile.extraUpdates = 8; // How often the projectile checks for a movement update. Higher makes the projectile faster. Musket ball = 1, High Vel = 8.
aiType = ProjectileID.Bullet; // Makes the project act like a normal Bullet.
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (!target.HasBuff(BuffID.OnFire))
{
target.AddBuff(BuffID.OnFire, 60 * 3); // Inflict 'On Fire!' for 3 seconds
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
lightColor = new Color(1, 1, 0); // Seems to do nothing?
Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f);
for (int k = 0; k < projectile.oldPos.Length; k++)
{
Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY);
Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length);
spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f);
}
return true;
}
public override void Kill(int timeLeft)
{
Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height);
Main.PlaySound(SoundID.Item10, projectile.position);
}
}
}
Thank you friend. I hope this works. I'm sorry I couldn't say thank you for a long time . I have other questions (One of which I will ask now), but I will ask them if they turn into a big problem. Thanks again.Change item.useTime to match the useAnimation
Isnt it the shootspeed at the end?I need help whit my projectile, so:
How do i give a delay to the projectile?
To elaborate the question, notice how the enchanted sword doesn't shoot every time, it has a delay, and i want to do a delay too.
My script:
using Terraria.ID;
using Terraria.ModLoader;
namespace PossibleAdds.Items.Weapons
{
public class EnchantedFury : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Enchanted Fury"); // By default, capitalization in classnames will add spaces to the display name. You can customize the display name here by uncommenting this line.
Tooltip.SetDefault("The combination of magic!");
}
public override void SetDefaults()
{
item.damage = 46;
item.melee = true;
item.width = 40;
item.height = 40;
item.useTime = 18;
item.useAnimation = 18;
item.useStyle = 1;
item.knockBack = 5;
item.value = 150000;
item.rare = 3;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.shoot = 173;
item.shootSpeed = 6f;
}
}
}
nopeIsnt it the shootspeed at the end?
I have another question. How can I make ammunition ? I tried to make an infinite bag of ammo, but it produced 33 errors. How do I make an infinite bag for example with chlorophyte bullets ? I tried to find an example in other mods, but the files are patched into modloader files. The bullet example on Github also produced 30 errors. Maybe I can find a resource Bank somewhere ? Such codes as are written for mod items ?
Thanks a lotChange item.shoot = ProjectileType<Projectiles.ExampleBullet>(); to:
item.shoot = ProjectileID.ChlorophyteBullet;