Sgt_Pugsly
Terrarian
Code?
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
// One of the problems you're encountering is that you're using the semicolon wrong.
// You only want to use the semicolon ( ; ) when closing a line of code, but if you look below, you're closing your namespace while you're trying to open it.
// Same goes for your class and SetDefaults method, so:
namespace ExampleMod.Items.Weapons // <-- Remove this semicolon
{
public class ExampleGun : ModItem
{
public override void SetDefaults() // <-- And this one this semicolon
{
item.name = ".55 Magnum";
item.damage = 5500;
item.ranged = true;
item.width = 28;
item.height = 20;
item.toolTip = "This magnum is MORE powerful?!";
item.toolTip2 = "I bet this shreds people with 1 shot.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true; //so the item's animation doesn't do damage
item.knockBack = 4;
item.value = 10000;
item.rare = 13;
item.useSound = 11;
item.autoReuse = false;
item.shoot = 18; //idk why but all the guns in the vanilla source have this
item.shootSpeed = 30f;
item.useAmmo = ProjectileID.Bullet;
}
{// The following code... What is it encapsulated in? There's no function call here!
Vector2[] speeds = ModHelper.Projectile.evenArc( 16f, 16f, 45, 5);
for (int i = 0; i < 5; ++i)
{
Terraria.Projectile.NewProjectile(Main.player[0].position.X, Main.player[0].position.Y, speeds.X, speeds.Y, 45, 45, 15f);
}
}
{// Same story here as above, no function is being called, so this code is just floating here...
{
if (Main.rand.Next(0, 4) == 0); // 50% chance not to consume ammo.
return false;
return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "ExampleItem", 10);
recipe.AddTile(null, "ExampleWorkbench");
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}