Hi, I have a problem I made a weapon and its projectile.
Its a pot with darts in it but when I attack it's just like I'm throwing the darts.
So i set graphics to false and throwing animation.
But when I'm ingame, the projectile just deletes when I'm near blocks but the other weapon with exactly the same code doesn't do that.
I fire that projectile and it dissappear even before it appear!?
When I want to shoot backwards, forwards and down, but the projectile isnt too long its even smaller then the working one.. So I don't know.. When I put nocollide true it just works and it appears and fly through walls, but wtf, its not that long to dissappear even when i want to shot it forwards..
Projectile Code(ignore the // they could be wrong because its already edited
Also its pretty basic but i dont want to continue when i cant even solve this problem
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Projectiles
{
public class tikis : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Tiki Dart"); //The English name of the projectile
}
public override void SetDefaults()
{
projectile.width = 10; //Set the hitbox width
projectile.height = 61; //Set the hitbox height
projectile.aiStyle = 1; //How the projectile works
projectile.friendly = true; //Tells the game whether it is friendly to players/friendly npcs or not
projectile.hostile = false; //Tells the game whether it is hostile to players or not
projectile.tileCollide = true; //Tells the game whether or not it can collide with a tile
projectile.ignoreWater = true; //Tells the game whether or not projectile will be affected by water
projectile.thrown = true; //Tells the game whether it is a ranged projectile or not
projectile.penetrate = 1; //Tells the game how many enemies it can hit before being destroyed
projectile.timeLeft = 75; //The amount of time the projectile is alive for
aiType = 1; // this is the projectile ai style . 1 is for arrows style
}
}
}
And the item code
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Items
{
public class tikispear : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mahagony Tiki Holder");
Tooltip.SetDefault("Can be fired without any ammo");
}
public override void SetDefaults()
{
item.damage = 22;
item.thrown = true; //this make the item do magic damage
item.width = 30;
item.height = 34;
item.useTime = 17;
item.useAnimation = 20;
item.useStyle = 1; //this is how the item is holded5knizka
item.noMelee = true;
item.knockBack = 2;
item.value = 300;
item.rare = 1; //mana use
item.UseSound = SoundID.Item1; //this is the sound when you use the item20good
item.shoot = mod.ProjectileType("tikis"); //this make the item shoot your projectile PainterPaintballPainterPaintballPainterPaintballPainterPaintball
item.shootSpeed = 8f; //projectile speed when shoot
item.autoReuse = true;
item.noUseGraphic = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Hook, 2);
recipe.AddIngredient(ItemID.RichMahogany, 14);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
The working one: item:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Items
{
public class harpyknives : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sharp Harpy Fan");
}
public override void SetDefaults()
{
item.damage = 22;
item.ranged = true; //this make the item do magic damage
item.width = 32;
item.height = 32;
item.useTime = 17;
item.useAnimation = 20;
item.useStyle = 1; //this is how the item is holded5knizka
item.noMelee = true;
item.knockBack = 2;
item.value = 300;
item.rare = 1; //mana use
item.UseSound = SoundID.Item1; //this is the sound when you use the item20good
item.shoot = mod.ProjectileType("harpyf"); //this make the item shoot your projectile PainterPaintballPainterPaintballPainterPaintballPainterPaintball
item.shootSpeed = 8f; //projectile speed when shoot
item.autoReuse = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Feather, 15);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
projectile:
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Projectiles
{
public class harpyf : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sharp Feather"); //The English name of the projectile
}
public override void SetDefaults()
{
projectile.width = 7; //Set the hitbox width
projectile.height = 7; //Set the hitbox height
projectile.aiStyle = 1; //How the projectile works
projectile.friendly = true; //Tells the game whether it is friendly to players/friendly npcs or not
projectile.hostile = false; //Tells the game whether it is hostile to players or not
projectile.tileCollide = true; //Tells the game whether or not it can collide with a tile
projectile.ignoreWater = true; //Tells the game whether or not projectile will be affected by water
projectile.ranged = true; //Tells the game whether it is a ranged projectile or not
projectile.penetrate = 1; //Tells the game how many enemies it can hit before being destroyed
projectile.timeLeft = 350; //The amount of time the projectile is alive for
aiType = 1; // this is the projectile ai style . 1 is for arrows style
}
}
}