ALmaZss
Plantera
Oh, well. I still can't find any ai codeYeah, I have just posted this and wanted to check 410 page and found it. Anyway, thanks
Oh, well. I still can't find any ai codeYeah, I have just posted this and wanted to check 410 page and found it. Anyway, thanks
To find codes you must download program iLSpy and watch a source code of terrariawhat is Terraria. and where can you find codes of stuff in game
Check in Projectile and NPC classes in ilSpy, all of the AI should be under "VanillaAI()". It goes by style first and then by type within the styles. If you can't find them that way, go into the classes, find something like aiStyle, right click and then click on "Analyze". This will tell you where that variable or method is called or what it uses.Oh, well. I still can't find any ai code
What he is talking about is using a program called ilSpy, which allows you to see the source of Terraria. This means that you can see how the developers of Terraria made complicated things like projectile AI and npc AI.what is Terraria. and where can you find codes of stuff in game
Create new projectile.k i need help with my sword since it shoots Rune Blast witch is unfriendly so how do you make it friendly? like to me cause it hurt my player
It is NPChow come your sword shoots chaos balls?
[doublepost=1458910257,1458910140][/doublepost]witch is a projectile form the game
You can manually spawn your Projectile using Projectile.NewProjectile, save the value you get back from that function to call back the new projectile from Main.projectile and set friendly to true.oh ya
[doublepost=1458910390,1458910369][/doublepost]there must be a way do
It's real to shoot NPC, but it will hurt you and will fly down always. so easier to make new projectileoh ya
[doublepost=1458910390,1458910369][/doublepost]there must be a way do
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace ModName.Projectiles
{
public class ChaosBall : ModProjectile
{
public override void SetDefaults()
{
projectile.name = "Chaos Ball";
projectile.width = 16;
projectile.height = 16;
projectile.friendly = true;
projectile.penetrate = 3;
projectile.tileCollide = false;
}
public override void AI()
{
float minDistance = 300;
float dX = 0;
float dY = 0;
float distance = 0;
int target = -1;
int num272 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 2f), projectile.width, projectile.height, 27, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 2f);
Main.dust[num272].noGravity = true;
Main.dust[num272].velocity *= 0.3f;
Dust dust26 = Main.dust[num272];
dust26.velocity.X = dust26.velocity.X - projectile.velocity.X * 0.2f;
Dust dust27 = Main.dust[num272];
dust27.velocity.Y = dust27.velocity.Y - projectile.velocity.Y * 0.2f;
for (int i = 0; i < 200; i++)
{
NPC n = Main.npc[i];
if (n.active && n.life > 1)
{
Vector2 center = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
dX = n.position.X + (float)(n.width / 2) - center.X;
dY = n.position.Y + (float)(n.height / 2) - center.Y;
distance = (float)Math.Sqrt((double)(dX * 1.25 + dY * 1.25));
if (distance < minDistance)
{
minDistance = distance;
target = i;
}
}
}
}
}
}
Is there any way that I can use the time on the players computer? (basically, account for timezones, NOT GMT or UNIX)
I wonder why this thing doesn't work