#### Michaelsoftman

##### Terrarian
Is there a way to check when a player has landed on the ground after falling / jumping? Would I just check for when the Y velocity is 0?

#### GreenTea

##### Terrarian
Hello! I am currently having a problem with a minion shooting a projectile. My minion Dunkleostasis(BonyFish in the code files) is planned to shoot out bones in all directions when it hits an NPC. So because I put a chunk of code intended for Shoot() into OnHitNPC() I had to define a lot of floats manually.
When I tested it out only one bone flies out of the minion. I do not know if this is a problem with me defining all of my floats manually or if I am missing something. Here is the part of the code that I am having problems with.
C#:
``````public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (Main.myPlayer == projectile.owner)
{
Vector2 targetPos = projectile.position;
Vector2 shootVel = targetPos - projectile.Center;

projectile.netUpdate = true;

Player player = Main.player[projectile.owner];
float speedX = projectile.velocity.X;
float speedY = projectile.velocity.Y;

float numberProjectiles = 8; // 3 shots
float rotation = MathHelper.ToRadians(180);//Shoots them in a 45 degree radius. (This is technically 90 degrees because it's 45 degrees up from your cursor and 45 degrees down)
targetPos += Vector2.Normalize(new Vector2(speedX, speedY)) * 180f; //45 should equal whatever number you had on the previous line
for (int i = 0; i < numberProjectiles; i++)
{
Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1))) * .2f; // Vector for spread. Watch out for dividing by 0 if there is only 1 projectile.
Projectile.NewProjectile(projectile.Center, Vector2.Normalize(shootVel) * 15f, ProjectileType<BonyFishBone>(), projectile.damage, projectile.knockBack, Main.myPlayer, 0f, 0f); //Creates a new projectile with our new vector for spread.
}

}

}``````
Thank You so much!

#### Creeper da Snek

##### Plantera
Hello! I am currently having a problem with a minion shooting a projectile. My minion Dunkleostasis(BonyFish in the code files) is planned to shoot out bones in all directions when it hits an NPC. So because I put a chunk of code intended for Shoot() into OnHitNPC() I had to define a lot of floats manually.
When I tested it out only one bone flies out of the minion. I do not know if this is a problem with me defining all of my floats manually or if I am missing something. Here is the part of the code that I am having problems with.
C#:
``````public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (Main.myPlayer == projectile.owner)
{
Vector2 targetPos = projectile.position;
Vector2 shootVel = targetPos - projectile.Center;

projectile.netUpdate = true;

Player player = Main.player[projectile.owner];
float speedX = projectile.velocity.X;
float speedY = projectile.velocity.Y;

float numberProjectiles = 8; // 3 shots
float rotation = MathHelper.ToRadians(180);//Shoots them in a 45 degree radius. (This is technically 90 degrees because it's 45 degrees up from your cursor and 45 degrees down)
targetPos += Vector2.Normalize(new Vector2(speedX, speedY)) * 180f; //45 should equal whatever number you had on the previous line
for (int i = 0; i < numberProjectiles; i++)
{
Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1))) * .2f; // Vector for spread. Watch out for dividing by 0 if there is only 1 projectile.
Projectile.NewProjectile(projectile.Center, Vector2.Normalize(shootVel) * 15f, ProjectileType<BonyFishBone>(), projectile.damage, projectile.knockBack, Main.myPlayer, 0f, 0f); //Creates a new projectile with our new vector for spread.
}

}

}``````
Thank You so much!
All the projectiles are spawning, but they’re stacked on top of one another. You need to use the perturbedSpeed you’re defining instead of what you currently have in NewProjectile.

#### GreenTea

##### Terrarian
Thank you so much, that seemed to fix it. Now all I need to worry about is the sprite offset because that is heckin wonky at the moment.

#### tifey

##### Terrarian
hi, does anyone know an open source mod with different weapons
I can't find up-to-date guides for creating various projectiles
most mod authors block access and it is very difficult to find a good reference

#### willcocobo

##### The Destroyer
hi, does anyone know an open source mod with different weapons
I can't find up-to-date guides for creating various projectiles
most mod authors block access and it is very difficult to find a good reference

the " Projectile Guide and Implementation " thread is very helpful for projectiles, there will be a lot of reading but its really helpfull

and the tModLoader ExampleMod on git hub has things like enemies and weapons and its showes all code

#### Goldblitzx

##### Skeletron
I'm trying to figure out how to add crit chance increases to an armor set I've tried player.Crit += x% however I don't know if it will exactly work

#### CDI

##### Terrarian
can you put links to discord on descriptinos

#### Goldblitzx

##### Skeletron
I'm having an issue with my code for armor more so with the line that says that when you equip it you gain stat bonuses
this is my code
public override void UpdateEquip(Player player) {
player.buffImmune[BuffID.Bleeding] = true;
player.thrownDamage += 2f;
}
and when I start to build my mod in the mod sources section it states that my mod failed to build with the term of 'Player" not being able to be found
any help at all would be nice

#### willcocobo

##### The Destroyer
I'm having an issue with my code for armor more so with the line that says that when you equip it you gain stat bonuses
this is my code
public override void UpdateEquip(Player player) {
player.buffImmune[BuffID.Bleeding] = true;
player.thrownDamage += 2f;
}
and when I start to build my mod in the mod sources section it states that my mod failed to build with the term of 'Player" not being able to be found
any help at all would be nice

could you post the full code of the armor? it may be a problem somewhere else

#### willcocobo

##### The Destroyer
I'm having an issue with my code for armor more so with the line that says that when you equip it you gain stat bonuses
this is my code
public override void UpdateEquip(Player player) {
player.buffImmune[BuffID.Bleeding] = true;
player.thrownDamage += 2f;
}
and when I start to build my mod in the mod sources section it states that my mod failed to build with the term of 'Player" not being able to be found
any help at all would be nice

use this

 public override void SetStaticDefaults() {
Tooltip.SetDefault(" adds throwing damage ");

you can change what it says. i dont know how to make it only show up when you have all the armor set equipted. so it will show up on the piece you put the code on

#### Goldblitzx

##### Skeletron
use this

 public override void SetStaticDefaults() {
Tooltip.SetDefault(" adds throwing damage ");

you can change what it says. i dont know how to make it only show up when you have all the armor set equipted. so it will show up on the piece you put the code on
I realised it was because I forgot to put using Terraria at the top

#### willcocobo

##### The Destroyer
I realised it was because I forgot to put using Terraria at the top

simple problems are the most annoying in my opinion. it also sucks when you forget a { or ;

#### kyaryx

##### Terrarian
i'm trying to make a consumable waffle item that gives you the well fed buff, please provide me with the holy waffle code

#### willcocobo

##### The Destroyer
i'm trying to make a consumable waffle item that gives you the well fed buff, please provide me with the holy waffle code

using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;

namespace Modding2.Items.Buffs
{
public class Waffle : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("holy Waffle");
Tooltip.SetDefault("Grants WellFed Buff");
}
public override void SetDefaults()
{

item.width = 12;
item.height = 26;
item.maxStack = 99;

item.value = 500;
item.rare = 3;
item.useAnimation = 30;
item.useTime = 30;
item.useStyle = 4;
item.consumable = true;
}

public override bool UseItem(Player player)
{
player.AddBuff(BuffID.WellFed, 7200); // this about 1 minute

return true;

}
}
}

you will have to change some stuff around to fit your mod

#### kyaryx

##### Terrarian
thank you fellow forum user

#### willcocobo

##### The Destroyer
you are welcome fellow forum user

#### Piercepotato

##### Terrarian
How would I go about creating custom grass seeds that replace a specific tile with another?

#### Peepachu

##### Terrarian
How would I go about increasing the swing style by 1 with every swing, then resetting it after the style = 3? This is the code I have so far, with no luck, any help would be greatly appreciated

using Terraria;
using Terraria.ID;

namespace testMod.Items
{
public class whyNot : ModItem
{
public int swing;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("chonkSword"); // 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("This is a basic modded sword.");
}

public override void SetDefaults()
{
item.damage = 2140;
item.melee = true;
item.width = 40;
item.height = 40;
item.useTime = 30;
item.useAnimation = 20;
item.useStyle = swing;
item.knockBack = 90;
item.value = 10000;
item.rare = ItemRarityID.Cyan;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.SetResult(this);
}
public override bool UseItem(Player player)
{
swing = swing + 1;
if (swing > 3)
{
swing = 0;
}
return true;
}
}
}

#### Solo-Ion

##### Dungeon Spirit
How would I go about increasing the swing style by 1 with every swing, then resetting it after the style = 3? This is the code I have so far, with no luck, any help would be greatly appreciated

using Terraria;
using Terraria.ID;

namespace testMod.Items
{
public class whyNot : ModItem
{
public int swing;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("chonkSword"); // 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("This is a basic modded sword.");
}

public override void SetDefaults()
{
item.damage = 2140;
item.melee = true;
item.width = 40;
item.height = 40;
item.useTime = 30;
item.useAnimation = 20;
item.useStyle = swing;
item.knockBack = 90;
item.value = 10000;
item.rare = ItemRarityID.Cyan;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.SetResult(this);
}
public override bool UseItem(Player player)
{
swing = swing + 1;
if (swing > 3)
{
swing = 0;
}
return true;
}
}
}
I'm not certain, but I think you would need to update item.useStyle directly. The SetDefault hook is only called once, so changing swing has no impact during gameplay.