Standalone [1.3] tModLoader - A Modding API

Okay, Thanks a lot! :)
And one last thing, How do I make a tile similar to a placed Iron bar? One that can only be placed on top of a tile or another Iron bar and once the tile under it is removed, it will as well will be removed. :eek:
 
Okay, Thanks a lot! :)
And one last thing, How do I make a tile similar to a placed Iron bar? One that can only be placed on top of a tile or another Iron bar and once the tile under it is removed, it will as well will be removed. :eek:
For that, I would recommend decompiling the source code and getting familiar with TileObjectData.

I really need to ask, Is it already possible to create lasers(Last prism, charged blaster, lunar vortex)?
Yes, that's possible. The example mod has an example of a laser, actually. Most things are possible with some programming experience.
 
Is the octopus's arms are the example?
And yeah, actually I just started C++ when I first ask you about the animation thing (that was when tAPI is still being developed ;P)
Edit: just to inform you that I'm not as awesome as you are, I am way less into coding so far, but spriting yes. Peace :)
 
Last edited:
Is the octopus's arms are the example?
And yeah, actually I just started C++ when I first ask you about the animation thing (that was when tAPI is still being developed ;P)
Oh yeah, the Octopus Arm is another example of a laser-like projectile. I was originally thinking the Elemental Laser.

In terms of actually shooting the projectile from a weapon, I think people might have been talking about that recently a few pages back.
 
Oh you mean the graphics that sometimes appear between the center and the captives. Okay I'll check.
I am really grateful that you helped me. :)

I hope I did not disturbed, annoyed or bothered you. :(
 
You can use the following code for that:
Code:
public override bool CanUseItem(Player player)
{
    if (!NPC.downedMoonlord)
        return false;
}
This will do exactly what you want it to do.


The only code I can find regarding the flamethrower and Dusts is the following:
Code:
if (num297 == 6 || Main.rand.Next(2) == 0)
                        {
                            for (int num298 = 0; num298 < 1; num298++)
                            {
                                int num299 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num297, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 1f);
                                if (Main.rand.Next(3) != 0 || (num297 == 75 && Main.rand.Next(3) == 0))
                                {
                                    Main.dust[num299].noGravity = true;
                                    Main.dust[num299].scale *= 3f;
                                    Dust dust50 = Main.dust[num299];
                                    dust50.velocity.X = dust50.velocity.X * 2f;
                                    Dust dust51 = Main.dust[num299];
                                    dust51.velocity.Y = dust51.velocity.Y * 2f;
                                }
                                if (this.type == 188)
                                {
                                    Main.dust[num299].scale *= 1.25f;
                                }
                                else
                                {
                                    Main.dust[num299].scale *= 1.5f;
                                }
                                Dust dust52 = Main.dust[num299];
                                dust52.velocity.X = dust52.velocity.X * 1.2f;
                                Dust dust53 = Main.dust[num299];
                                dust53.velocity.Y = dust53.velocity.Y * 1.2f;
                                Main.dust[num299].scale *= num296;
                                if (num297 == 75)
                                {
                                    Main.dust[num299].velocity += this.velocity;
                                    if (!Main.dust[num299].noGravity)
                                    {
                                        Main.dust[num299].velocity *= 0.5f;
                                    }
                                }
                            }
                        }
You'll have to spit through that yourself, though. Note that 'num297 = 6' in this case.
As for your second question: Where are you applying the light? On your projectile or on your Dust?
Okay, it looks now like this:
http://giant.gfycat.com/FantasticAlarmedHorse.webm

But as you see in the video/gif, it is spawing very rarely, and I already changed the randoms in the code, but this doesnt help

And I changed the code to:
Code:
int unVar = 6;
            if (unVar == 6 || Main.rand.Next(2) == 0)
            {
                for (int num298 = 0; num298 < 1; num298++)
                {
                    int num299 = Dust.NewDust(new Vector2(dust.position.X, dust.position.Y), 10, 30, unVar, dust.velocity.X * 0.2f, dust.velocity.Y * 0.2f, 100, default(Color), 1f);
                    if (Main.rand.Next(3) != 0 || (unVar == 75 && Main.rand.Next(3) == 0))
                    {
                        Main.dust[num299].noGravity = true;
                        Main.dust[num299].scale *= 3f;
                        Dust dust50 = Main.dust[num299];
                        dust50.velocity.X = dust50.velocity.X * 2f;
                        Dust dust51 = Main.dust[num299];
                        dust51.velocity.Y = dust51.velocity.Y * 2f;
                    }
                    if (dust.type == mod.DustType("Flames"))
                    {
                        Main.dust[num299].scale *= 1.25f;
                    }
                    else
                    {
                        Main.dust[num299].scale *= 1.5f;
                    }
                    Dust dust52 = Main.dust[num299];
                    dust52.velocity.X = dust52.velocity.X * 1.2f;
                    Dust dust53 = Main.dust[num299];
                    dust53.velocity.Y = dust53.velocity.Y * 1.2f;
                    Main.dust[num299].scale *= unVar;
                    if (unVar == 75)
                    {
                        Main.dust[num299].velocity += dust.velocity;
                        if (!Main.dust[num299].noGravity)
                        {
                            Main.dust[num299].velocity *= 0.5f;
                        }
                    }
                }
            }
 
You can use the following code for that:
Code:
public override bool CanUseItem(Player player)
{
    if (!NPC.downedMoonlord)
        return false;
}
This will do exactly what you want it to do.


The only code I can find regarding the flamethrower and Dusts is the following:
Code:
if (num297 == 6 || Main.rand.Next(2) == 0)
                        {
                            for (int num298 = 0; num298 < 1; num298++)
                            {
                                int num299 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num297, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 1f);
                                if (Main.rand.Next(3) != 0 || (num297 == 75 && Main.rand.Next(3) == 0))
                                {
                                    Main.dust[num299].noGravity = true;
                                    Main.dust[num299].scale *= 3f;
                                    Dust dust50 = Main.dust[num299];
                                    dust50.velocity.X = dust50.velocity.X * 2f;
                                    Dust dust51 = Main.dust[num299];
                                    dust51.velocity.Y = dust51.velocity.Y * 2f;
                                }
                                if (this.type == 188)
                                {
                                    Main.dust[num299].scale *= 1.25f;
                                }
                                else
                                {
                                    Main.dust[num299].scale *= 1.5f;
                                }
                                Dust dust52 = Main.dust[num299];
                                dust52.velocity.X = dust52.velocity.X * 1.2f;
                                Dust dust53 = Main.dust[num299];
                                dust53.velocity.Y = dust53.velocity.Y * 1.2f;
                                Main.dust[num299].scale *= num296;
                                if (num297 == 75)
                                {
                                    Main.dust[num299].velocity += this.velocity;
                                    if (!Main.dust[num299].noGravity)
                                    {
                                        Main.dust[num299].velocity *= 0.5f;
                                    }
                                }
                            }
                        }
You'll have to spit through that yourself, though. Note that 'num297 = 6' in this case.
As for your second question: Where are you applying the light? On your projectile or on your Dust?
I managed to use the AddLight command, but where do I change the brightness?
void LighningAddLight(int i, int j, float R, float G, float B)
the RGB Floats stand for the rgb value, and Int I and J for the position, right?
FzwaoEf.png
 
I managed to use the AddLight command, but where do I change the brightness?
void LighningAddLight(int i, int j, float R, float G, float B)
the RGB Floats stand for the rgb value, and Int I and J for the position, right?
If I understand this correctly, that method normally takes values from 0 to 1, so try dividing R, G and B by 255 maybe?
 
I managed to use the AddLight command, but where do I change the brightness?
void LighningAddLight(int i, int j, float R, float G, float B)
the RGB Floats stand for the rgb value, and Int I and J for the position, right?
FzwaoEf.png
Yup, what GoldenApple said is probably one of the things you can do.
Those values (R,G,B - 1,1,1) are full on brightness. You'll need to lower these values for a less intense light. So 1,1,1 is a very large, white light, while 0.2,0.2,0.2 is a smaller white light.
 
Yup, what GoldenApple said is probably one of the things you can do.
Those values (R,G,B - 1,1,1) are full on brightness. You'll need to lower these values for a less intense light. So 1,1,1 is a very large, white light, while 0.2,0.2,0.2 is a smaller white light.
Alright, one last thing.
No shooting through blocks
ECjZTX0.gif
 
Alright, one last thing.
No shooting through blocks
ECjZTX0.gif
You can either have the bullets spawn NOT at the tip of the weapon (which is the easiest) or you can use the 'Collision.CanHitLine' function to check if there's any obstacle in the way before spawning the projectile... I'm not sure how the vanilla does it, and I don't really have time to look it up atm ;)
 
You can either have the bullets spawn NOT at the tip of the weapon (which is the easiest) or you can use the 'Collision.CanHitLine' function to check if there's any obstacle in the way before spawning the projectile... I'm not sure how the vanilla does it, and I don't really have time to look it up atm ;)
Ok, I could spawn the projectiles in the middle of the weapon, but I would have to make them invisible for a short time, is this possible? Working with alpha maybe?
 
Ok, I could spawn the projectiles in the middle of the weapon, but I would have to make them invisible for a short time, is this possible? Working with alpha maybe?
I think there's a projectile.hide parameter which you can toggle (true/false).
Maybe you can work with that? ;)
 
I think there's a projectile.hide parameter which you can toggle (true/false).
Maybe you can work with that? ;)
One thing prevents me.
How do I check for position ?
Everytime I try to check for it in a bool parameter (if, while) it says it can not apply on 2 operands, vector2 and int. What should I use then?
That creates another question for me, what is a vector? or vector2?
We are still learning the basics in physics, but my teacher once mentioned something about vectors in the horizontal union(?) or
horizontal throw (dont know how to translate this correctly), when calculating with the x and y speed.
My first idea was, to check for the position, and if its <= 56 (my item width) it should projectile.hide = true, but yeah, how i said, it prevents me because of the checking, and i dont know how to solve it
 
Help,
error CS0006: Metadata file 'TerrariaMac.exe' could not be found

error CS0006: Metadata file 'FNA.dll' could not be found
 
how do i down loud?
Why would you want to down a loud? :p

I would recommend reading the instructions in the first post.

One thing prevents me.
How do I check for position ?
Everytime I try to check for it in a bool parameter (if, while) it says it can not apply on 2 operands, vector2 and int. What should I use then?
That creates another question for me, what is a vector? or vector2?
We are still learning the basics in physics, but my teacher once mentioned something about vectors in the horizontal union(?) or
horizontal throw (dont know how to translate this correctly), when calculating with the x and y speed.
My first idea was, to check for the position, and if its <= 56 (my item width) it should projectile.hide = true, but yeah, how i said, it prevents me because of the checking, and i dont know how to solve it
A Vector2 is basically a convenient way to store two floats in the same object. (A float is a decimal number.)
To get the position of your projectile, you can use projectile.position.X and projectile.position.Y.

Help,
error CS0006: Metadata file 'TerrariaMac.exe' could not be found

error CS0006: Metadata file 'FNA.dll' could not be found
Did you remember to click the "Setup Dev Environment" button on the installer?
 
Back
Top Bottom