PC Summoning Weapon; Couple of Points I'm unsure on

Howdy, I come with a question relating to the summoner weapon example from the ExampleMod provided in the TmodLoader thread. I went through ExampleMod to get it to work, and after a bit of trial and error, I managed to get it to work. Below is what I have (ignore my naming and descriptions, it was just a quick thing);

The summoning weapon;
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Harble_World_Spicer.Items.Weapons
{
  public class weapon_summon_01 : ModItem
  {
  public override void SetStaticDefaults()
  {
  DisplayName.SetDefault("???");
  Tooltip.SetDefault("It makes things appear!");
  }
   
  public override void SetDefaults()
  {
  item.damage = 30;
  item.summon = true;
  item.mana = 10;
  item.width = 26;
  item.height = 28;
  item.useTime = 36;
  item.useAnimation = 36;
  item.useStyle = 1;
  item.noMelee = true;
  item.knockBack = 2f;
  item.value = Item.buyPrice(0, 10, 0, 0);
  item.rare = 5;
  item.UseSound = SoundID.Item82;
  item.shoot = mod.ProjectileType("minion_minion_01");
  item.shootSpeed = 10f;
  item.buffType = mod.BuffType("weapon_summon_01");
  item.buffTime = 3600;
  }
   
  public override bool AltFunctionUse(Player player)
  {
  return true;
  }
   
  public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
  {
  return player.altFunctionUse != 2;
  }
   
  public override bool UseItem(Player player)
  {
  if(player.altFunctionUse == 2)
  {
  player.MinionNPCTargetAim();
  }
  return base.UseItem(player);
  }
   
  public override void AddRecipes()
  {
  ModRecipe recipe = new ModRecipe(mod);
  recipe.AddIngredient(mod.ItemType("weapon_summon_01"), 1);
  recipe.AddTile(TileID.WorkBenches);
  recipe.SetResult(this);
  recipe.AddRecipe();
  }
  }
}

The Projectile (Minion);
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;

namespace Harble_World_Spicer.Projectiles.Minions
{
  public class minion_minion_01 : HoverShooter
  {
  public override void SetStaticDefaults()
  {
  Main.projFrames[projectile.type] = 4;
  Main.projPet[projectile.type] = true;
  ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
  ProjectileID.Sets.Homing[projectile.type] = true;
  ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; //This is necessary for right-click targeting
  }

  public override void SetDefaults()
  {
  projectile.netImportant = true;
  projectile.width = 32;
  projectile.height = 24;
  projectile.friendly = true;
  projectile.minion = true;
  projectile.minionSlots = 1;
  projectile.penetrate = -1;
  projectile.timeLeft = 18000;
  projectile.tileCollide = false;
  projectile.ignoreWater = true;
  inertia = 20f;
  shoot = mod.ProjectileType("minion_minion_01_Proj");
  shootSpeed = 12f;
  }

  public override void CheckActive()
  {
  Player player = Main.player[projectile.owner];
  MyPlayer modPlayer = player.GetModPlayer<MyPlayer>(mod);
  if (player.dead)
  {
  modPlayer.minion_minion_01 = false;
  }
  if (modPlayer.minion_minion_01)
  {
  projectile.timeLeft = 2;
  }
  }

  public override void SelectFrame()
  {
  projectile.frameCounter++;
  if (projectile.frameCounter >= 8)
  {
  projectile.frameCounter = 0;
  projectile.frame = (projectile.frame + 1) % 3;
  }
  }
  }
}

The Projectile (Minion's Projectile);
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Harble_World_Spicer.Projectiles.Minions
{
  public class minion_minion_01_Proj : ModProjectile
  {
  public override void SetStaticDefaults()
  {
  ProjectileID.Sets.Homing[projectile.type] = true;
  ProjectileID.Sets.MinionShot[projectile.type] = true;
  }

  public override void SetDefaults()
  {
  projectile.width = 32;
  projectile.height = 18;
  projectile.alpha = 0;
  projectile.penetrate = 1;
  projectile.friendly = true;
  projectile.ignoreWater = true;
  }

  public override void AI()
  {
  if (projectile.localAI[0] == 0f)
  {
  Main.PlaySound(SoundID.Item1, projectile.position);
  projectile.localAI[0] = 1f;
  }
  }

  public override bool OnTileCollide(Vector2 oldVelocity)
  {
  projectile.penetrate = -1;
  projectile.maxPenetrate = -1;
  projectile.tileCollide = false;
  projectile.position += projectile.velocity;
  projectile.velocity = Vector2.Zero;
  projectile.timeLeft = 180;
  return false;
  }
  }
}

The Buff:
Code:
using Terraria;
using Terraria.ModLoader;

namespace Harble_World_Spicer.Buffs
{
  public class weapon_summon_01 : ModBuff
  {
  public override void SetDefaults()
  {
  DisplayName.SetDefault("???");
  Description.SetDefault("Cool!");
  Main.buffNoSave[Type] = true;
  Main.buffNoTimeDisplay[Type] = true;
  }

  public override void Update(Player player, ref int buffIndex)
  {
  MyPlayer modPlayer = player.GetModPlayer<MyPlayer>(mod);
  if (player.ownedProjectileCounts[mod.ProjectileType("weapon_summon_01")] > 0)
  {
  modPlayer.weapon_summon_01_minion = true;
  }
  if (!modPlayer.weapon_summon_01_minion)
  {
  player.DelBuff(buffIndex);
  buffIndex--;
  }
  else
  {
  player.buffTime[buffIndex] = 18000;
  }
  }
  }
}

Now, the above works for the most part. Here's everything I can't figure out;

- Frame count of the minion is supposed to be 4, but the game only renders 2. Why is this?
- I removed the dust lines on the minion's projectile, but is there a guide explaining how to do proper dust? The examplemod dust was...not to my liking.
- Nowhere in any of the files (that I could see) dictated how fast the minion projectile moves. How do I make it go faster or slower?
- "ProjectileID.Sets.Homing[projectile.type] = true;" doesn't make the minion projectile home in, neither does false. How do I fix that?
- Say I wanted to use a vanilla projectile for my minion's attack; how would I write that?
- Likewise, how would I make the minion do a melee attack like the Deadly Sphere and Optic Staff?
- How do I make the initial summon bring up multiple minions, like the Optic Staff?
- Finally, I'd like to be able to summon different types of minions, like the Pygmy Staff or Spider Staff. How do I do that?

I tried searching around for examples, but tutorials are all out of date and other mods are always hiding source code, so I can't find any examples to go by on figuring this sort of thing out. Pets and NPCs aren't hard, but this is a whole ballpark's difference. Help would be absolutely appreciated, and google really needs a result with working answers to things like this!
 
Back
Top Bottom