Zman350x
Steampunker
I made a custom grenade but when I threw it at a zombie, it did no damage, but when it blew up on me, it did 1 damage, how do I increase the damage of the explosion and not make it hurt me?
here is my code for the projectile:
Here is my item code:
here is my code for the projectile:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Ranged.Projectiles
{
public class SyrupProj : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Syrup-nade");
}
public override void SetDefaults()
{
projectile.width = 14;
projectile.height = 18;
projectile.aiStyle = 16;
projectile.friendly = true;
projectile.penetrate = -1;
projectile.timeLeft = 200;
}
public override void Kill(int timeLeft)
{
Vector2 position = projectile.Center;
Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);
int radius = 40;
for (int x = -radius; x <= radius; x++)
{
for (int y = -radius; y <= radius; y++)
{
int xPosition = (int)(x + position.X / 16.0f);
int yPosition = (int)(y + position.Y / 16.0f);
if (Math.Sqrt(x * x + y * y) <= radius + 0.5)
{
Dust.NewDust(position, 22, 22, DustID.Smoke, 0.0f, 0.0f, 120, new Color(), 1f);
}
}
}
}
}
}
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Ranged.Items.Projectiles
{
public class Syrupnade : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Syrup-nade");
}
public override void SetDefaults()
{
item.damage = 0;
item.width = 14;
item.height = 18;
item.maxStack = 99;
item.consumable = true;
item.useStyle = 1;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.useTime = 20;
item.useAnimation = 20;
item.value = 10000;
item.noUseGraphic = true;
item.noMelee = true;
item.shoot = mod.ProjectileType("SyrupProj");
item.shootSpeed = 7f;
}
}
}