yesAm I right that NPC.downedBoss1 is Eye of Cthulhu, NPC.downedBoss2 is the Destroyer, and NPC.downedBoss3 is Skeletron?
yesAm I right that NPC.downedBoss1 is Eye of Cthulhu, NPC.downedBoss2 is the Destroyer, and NPC.downedBoss3 is Skeletron?
I'm too lazy to write some code, but it involves a for loop multiplying the speeds by 1f, .8f, and .6f for each projectile, respectively.im just full of questions, how can i shoot 3 projectiles, in the same direction, all projectile ID 145, but with different speeds?
that is like, no help whatso ever XD but thanks for tryingI'm too lazy to write some code, but it involves a for loop multiplying the speeds by 1f, .8f, and .6f for each projectile, respectively.
so no one has an answer yet?im just full of questions, how can i shoot 3 projectiles, in the same direction, all projectile ID 145, but with different speeds?
can you give me a link to the discord chat?ask on the discord chat. You might get better assistance there
thanksIts on the front page of this thread.
OK, so it seems that simply multiplying the projectile's velocity was a bad idea. Replace this:Code:using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; namespace Pack.Projectiles { public class PossessedTempliteHammerP : ModProjectile { public override void SetDefaults() { projectile.name = "Possessed Templite Hammer"; projectile.width = 52; projectile.height = 52; projectile.friendly = true; projectile.penetrate = -1; projectile.aiStyle = 3; projectile.melee = true; projectile.tileCollide = false; projectile.timeLeft = 60000; projectile.light = 1f; } public override void OnHitNPC(NPC n, int damage, float knockback, bool crit) { Player player = Main.player[projectile.owner]; player.statLife += 10; //Heals by 10; Can be changed of course player.HealEffect(10); //Shows a green 10 above your head to show you've been healed; Can be changed of course if (projectile.ai[1] > 0) projectile.ai[0] = 0; if (projectile.ai[0] == 0f) { projectile.velocity *= -1; } projectile.netUpdate = true; } public override void PostAI() { Main.NewText("ai[0]: " + projectile.ai[0] + ", ai[1]: " + projectile.ai[1]); if (projectile.ai[0] == 1) { projectile.velocity *= 2; } } } }
if (projectile.ai[0] == 1)
{
projectile.velocity *= 2;
}
if (projectile.ai[0] == 1)
{
Player myOwner = Main.player[projectile.owner]; //find the owner of this projectile
Vector2 toMe = Vector2.Normalize(myOwner.Center - projectile.Center); //find the distance from this projectile to it's owner and convert to a unit vector.
projectile.velocity += toMe * 1f; //add the above vector to this projectile's velocity -- change 1f to change the return speed
}
Am I right that NPC.downedBoss1 is Eye of Cthulhu, NPC.downedBoss2 is the Destroyer, and NPC.downedBoss3 is Skeletron?
Shouldn't that be Eater of Worlds instead of the Destroyer?
Shouldn't that be Eater of Worlds instead of the Destroyer?
Yes, there is.Is there boss summoning item in Example mod?
So does any one know how to make less amo consumption with accessory?Its an accessory, but I need that code for my next thing so thanks!
One of the harder, but more global ways is to create a variable in a ModPlayer class like so:So does any one know how to make less amo consumption with accessory?
public class MPlayer : ModPlayer
{
// Not too good of a naming.
// This variable should have a value from 0 to 100. 100 being a 100% not to use ammo.
public int ammoUsage;
public override void ResetEffects()
{
this.ammoUsage = 0;
}
}
public override void UpdateAccessory(Player player)
{
MPlayer mp = player.GetModPlayer<MPlayer>(mod);
// Here we give the player a 10% chance not to consume ammo.
mp.ammoUsage = 10;
}
public class GItem : GlobalItem
{
public override bool ConsumeAmmo(Item item, Player player)
{
MPlayer mp = player.GetModPlayer<MPlayer>(mod);
if(Main.rand.Next(0, 101) <= mp.ammoUsage)
return false;
return true;
}
}