Standalone [1.3] tModLoader - A Modding API

Ill try it tomorrow! Ill tell you if there is something that should be changed or if there is a bug that needs to be fixed
 
can you help me figure out wha i fd up

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace GamingsMod.Items.Weapons
{
public class Beetana : ModItem
{
public override void SetDefaults()
{
item.name = "Beetana";
item.damage = 23;
item.melee = true;
item.width = 40;
item.height = 40;
item.toolTip = "Right click to summon bees.";
item.useTime = 30;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 4;
item.value = 10000;
item.rare = 4;
item.useSound = 1;
item.autoReuse = true;
item.shoot = ProjectileID.Bee;
item.shootSpeed = 5f;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID, "Katana", 1);
recipe.AddIngredient(ItemID, "HoneyComb", 1);
recipe.AddTile(ItemID, "Workbench");
recipe.SetResult(this);
recipe.AddRecipe();
}

public override bool AltFunctionUse(Player player)
{
return true;
}

public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2)
{
item.useStyle = 3;
item.useTime = 20;
item.useAnimation = 20;
item.damage = 9;
item.shoot = ProjectileID.Bee;
}
else
{
item.useStyle = 1;
item.useTime = 40;
item.useAnimation = 40;
item.damage = 10;
item.shoot = 0;
}
return base.CanUseItem(player);
}

public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
{
if (player.altFunctionUse == 2)
{
target.AddBuff(BuffID.Ichor, 60);
}
else
{
target.AddBuff(BuffID.OnFire, 60);
}
}

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
{
if (player.altFunctionUse == 2)
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 169, 0f, 0f, 100, default(Color), 2f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity.X += player.direction * 2f;
Main.dust[dust].velocity.Y += 0.2f;
}
else
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Fire, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 2.5f);
Main.dust[dust].noGravity = true;
}
}
}
}
}
}
[doublepost=1470875770,1470875486][/doublepost]btw next item is going to a WORKING GASTER BLASTER XD im not jking
 
Using
Item.NewItem(int X, int Y, int Width, int Height, int Type, int Stack = 1)
I can get my gems, would i just replace the Type with the ID of the gem?
 
i need help figuring out whats wrong with this

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace GamingsMod.Items.Weapons
{
public class Beetana : ModItem
{
public override void SetDefaults()
{
item.name = "Beetana";
item.damage = 23;
item.melee = true;
item.width = 40;
item.height = 40;
item.toolTip = "Right click to summon bees.";
item.useTime = 30;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 4;
item.value = 10000;
item.rare = 4;
item.useSound = 1;
item.autoReuse = true;
item.shoot = ProjectileID.Bee;
item.shootSpeed = 5f;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID, "Katana", 1);
recipe.AddIngredient(ItemID, "HoneyComb", 1);
recipe.AddTile(ItemID, "Workbench");
recipe.SetResult(this);
recipe.AddRecipe();
}

public override bool AltFunctionUse(Player player)
{
return true;
}

public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2)
{
item.useStyle = 3;
item.useTime = 20;
item.useAnimation = 20;
item.damage = 9;
item.shoot = ProjectileID.Bee;
}
else
{
item.useStyle = 1;
item.useTime = 40;
item.useAnimation = 40;
item.damage = 10;
item.shoot = 0;
}
return base.CanUseItem(player);
}

public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
{
if (player.altFunctionUse == 2)
{
target.AddBuff(BuffID.Ichor, 60);
}
else
{
target.AddBuff(BuffID.OnFire, 60);
}
}

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
{
if (player.altFunctionUse == 2)
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 169, 0f, 0f, 100, default(Color), 2f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity.X += player.direction * 2f;
Main.dust[dust].velocity.Y += 0.2f;
}
else
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Fire, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 2.5f);
Main.dust[dust].noGravity = true;
}
}
}
}
}
}
 
And 2 more things: 1. Would this work as an animated projectile? And 2. How would I go about making a weapon shoot 6 tracking projectiles? (I know the part about making it shoot 6 projectiles, but not how to make them all track down enemies)

133533-271a0160bc713eb8d55c0ea6f7c84391.jpg
<-- There is the projectile picture that I wanna know if it will animate or not
 

Attachments

  • BOVProj.png
    BOVProj.png
    1,020 bytes · Views: 112
(God I'm posting so much lol) I got an error, and here is the error code and my code:

c:\Users\nick\Documents\My Games\Terraria\ModLoader\Mod Sources\TheOmegaMod\Items\Weapons\BladeOfVictory.cs(32,30) : error CS0161: 'TheOmegaMod.Items.Weapons.BladeOfVictory.Shoot(Terraria.Player, ref Microsoft.Xna.Framework.Vector2, ref float, ref float, ref int, ref int, ref float)': not all code paths return a value


using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;

namespace TheOmegaMod.Items.Weapons
{
public class BladeOfVictory : ModItem
{
public override void SetDefaults()
{
item.name = "Blade of Victory";
item.damage = 99999999;
item.melee = true;
item.width = 900;
item.height = 900;
item.useTime = 3;
item.useAnimation = 4;
item.useStyle = 1;
item.knockBack = 100000;
item.value = 1000000000;
item.rare = 1000;
item.useSound = 1;
item.autoReuse = true;
item.useTurn = true;
item.crit = 75;
item.toolTip = "Congratularationses! You have officially won The Omega Mod!";
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
{
int numberProjectiles = 6;
for (int i = 0; i < numberProjectiles; i++)
{
Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedByRandom(MathHelper.ToRadians(5));
Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BOVProj"), damage, knockBack, player.whoAmI);
}
}
}
public override void UseStyle(Player player) //while the player is using this item
{
//add a light at the center of my player with a brightness of %50
Lighting.AddLight(player.Center, 1f, 1f, 1f);
}

public override void Update(ref float gravity, ref float maxFallSpeed) //when this item is lying in the world
{
//add a light at the center of this item with a brightness of %50
Lighting.AddLight(item.position + item.Size / 2, 1f, 1f, 1f);
}
}
}
[doublepost=1470890935,1470890774][/doublepost]Nevermind I got it :D I just forgot the return false; at the end of the shoot hook :p
I still don't know how to make the projectiles track down enemies though if anyone could tell me how
 
Back
Top Bottom