Standalone [1.3] tModLoader - A Modding API

Ah okay :)
[DOUBLEPOST=1439059452,1439059281][/DOUBLEPOST]Hi @bluemagic123 ... i keep on asking questions but where do u find all of these codes or do u know them and is it possible to shoot a projectile thats not the vampire knives but like a terra blade but it still heals
Thanks in advance :)

For the projectile you can use item.shoot = ProjectileID.TerraBeam
A really easy way to heal would just be to add health manually, but that's really lame. I'd have to look how Vampire Knives work to tell you how to mimic it :O
 
Seems like you might be looking for this:

Code:
public void vampireHeal(int dmg, Vector2 Position)
{
    float num = (float)dmg * 0.075f;
    if ((int)num != 0)
    {
        if (Main.player[Main.myPlayer].lifeSteal > 0f)
        {
            Main.player[Main.myPlayer].lifeSteal -= num;
            int num2 = this.owner;
            Projectile.NewProjectile(Position.X, Position.Y, 0f, 0f, 305, 0, 0f, this.owner, (float)num2, num);
        }
    }
}
[DOUBLEPOST=1439060939,1439060807][/DOUBLEPOST]
Is it possible two shoot two different Projectiles ?
Because then i could have the vampknives and the terrabeam

Yes, you'd have to use the shoot method. You can spawn more than 1 projectile using that method.
 
Hmmm so you did that code for me a while back would that work

public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
float spread = 45f * 0.0174f;
float baseSpeed = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
double startAngle = Math.Atan2(speedX, speedY) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int i;
for (i = 0; i < 6; i++)
{
offsetAngle = startAngle + deltaAngle * i;
Projectile.NewProjectile(position.X, position.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), item.shoot, damage, knockBack, item.owner);
}
return false;
}
}}
 
Hmmm so you did that code for me a while back would that work

public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
float spread = 45f * 0.0174f;
float baseSpeed = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
double startAngle = Math.Atan2(speedX, speedY) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int i;
for (i = 0; i < 6; i++)
{
offsetAngle = startAngle + deltaAngle * i;
Projectile.NewProjectile(position.X, position.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), item.shoot, damage, knockBack, item.owner);
}
return false;
}
}}

That code will shoot 6 projectiles at a certain angle. Is that what you're looking for?
 
Yes that is how i would want it to be .. :)...:D @Gorateron
Then you could simply do:

Code:
                float spread = 45f * 0.0174f;
                float baseSpeed = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
                double startAngle = Math.Atan2(speedX, speedY) - spread / 2;
                double deltaAngle = spread / 8f;
                double offsetAngle;
                int i;
                for (i = 0; i < 3; i++)
                {
                    offsetAngle = startAngle + deltaAngle * i;
                    Projectile.NewProjectile(position.X, position.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ProjectileID.TerraBeam, damage, knockBack, item.owner);
                    Projectile.NewProjectile(position.X, position.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ProjectileID.VampireKnife, damage, knockBack, item.owner);
                }
                return false;
[DOUBLEPOST=1439062108,1439061992][/DOUBLEPOST]The difficult thing I find with that calculation is aiming. It seems very off.
 
Trying to create weapon that fires custom projectile...
Code:
    public class TestGun : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Test Gun";
            item.width = 38;
            item.height = 20;
            item.maxStack = 1;
            item.useStyle = 5;
            item.useAnimation = 7;
            item.damage = 2;
            item.knockBack = 1;
            item.noMelee = true;
            item.shoot = mod.ProjectileType("TestProj");
            item.shootSpeed = 15;
            item.magic = true;
            item.mana = 1;
            item.toolTip = "pew pew";
        }
    }

Code:
    public class TestProj : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.aiStyle = 0;
            projectile.timeLeft = 3600;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.height = 2;
            projectile.width = 42;
            projectile.tileCollide = true;
            projectile.damage = 2;
            projectile.magic = true;
            projectile.penetrate = -1;
            projectile.MaxUpdates = 2;

        }
    }
Снимок.PNG
Yerr, interface dissapear... Also, not shoot anything.
[DOUBLEPOST=1439065161,1439065092][/DOUBLEPOST]
But what exactly do you mean by races? I haven't played WoW; what exactly do races do and entail?
Just more customization for personages on creating, like ears, tails and others. Someone might be create a mod for this.
 
Looking at the current hooks available, it seems that the idea I'm trying to do will require a bit more in the projectile department, but I'm really excited. I've been looking at the code, and I'd bet the following would straightforward to implement but would really open up some great possibilities. I know it'd be going off your roadmap a bit, but if you could do the following anytime soon, it would help a lot.

Projectile needs a hook in Projectile.Damage(), Projectile.Update(int i), and Projectile.Kill().

Also, a quick hook in Projectile.AI() would be great, but I guess that would involve a ModAIStyle class as well, but it would only need one method, the doAI method. (I need my own custom aistyle for my project)
 
Trying to create weapon that fires custom projectile...
Code:
    public class TestGun : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Test Gun";
            item.width = 38;
            item.height = 20;
            item.maxStack = 1;
            item.useStyle = 5;
            item.useAnimation = 7;
            item.damage = 2;
            item.knockBack = 1;
            item.noMelee = true;
            item.shoot = mod.ProjectileType("TestProj");
            item.shootSpeed = 15;
            item.magic = true;
            item.mana = 1;
            item.toolTip = "pew pew";
        }
    }

Code:
    public class TestProj : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.aiStyle = 0;
            projectile.timeLeft = 3600;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.height = 2;
            projectile.width = 42;
            projectile.tileCollide = true;
            projectile.damage = 2;
            projectile.magic = true;
            projectile.penetrate = -1;
            projectile.MaxUpdates = 2;

        }
    }
Yerr, interface dissapear... Also, not shoot anything.
[DOUBLEPOST=1439065161,1439065092][/DOUBLEPOST]
Just more customization for personages on creating, like ears, tails and others. Someone might be create a mod for this.
Alright, I see, so it looks like an exception is being raised in between drawing the main inventory slots and the other inventory slots. This will help me look into that.

For that kind of player customization, it should be possible once I actually add in hooks for players.

Looking at the current hooks available, it seems that the idea I'm trying to do will require a bit more in the projectile department, but I'm really excited. I've been looking at the code, and I'd bet the following would straightforward to implement but would really open up some great possibilities. I know it'd be going off your roadmap a bit, but if you could do the following anytime soon, it would help a lot.

Projectile needs a hook in Projectile.Damage(), Projectile.Update(int i), and Projectile.Kill().

Also, a quick hook in Projectile.AI() would be great, but I guess that would involve a ModAIStyle class as well, but it would only need one method, the doAI method. (I need my own custom aistyle for my project)
I'm already planning ModProjectile.ModifyHit, ModProjectile.OnHit, ModProjectile.Kill, and ModProjectile.AI hooks. I might have to look into the source code a bit to see if an Update hook is actually needed, and if so how many are needed.
 
Back
Top Bottom