S4l4kin
Steampunker
I can wait. But when are UI hooks coming, if some one know I would like to knowIf I were you, I'd wait with that untill proper UI hooks are implemented (or you must be willing to dive into the source of Terraria).
I can wait. But when are UI hooks coming, if some one know I would like to knowIf I were you, I'd wait with that untill proper UI hooks are implemented (or you must be willing to dive into the source of Terraria).
(In the OP):I can wait. But when are UI hooks coming, if some one know I would like to know
Li'll question:
Does anyone know how to prevent the drawing of wings on a player when (lets say) a certain buff is active?
I would be lazy and just set wings variable to 0. But then again that sounds a whole lot better than going through the player layer searching for the data value from vanilla code and use that data value to remove from the list. Setting wings to 0 may just end up making wings unusable.As per this post, I don't think there is a simple fix for this. Then again, I'd like to proven wrong on this account.
I suppose you could use WingUpdate to draw wings as an empty frame when said buff is active, but I don't think the trouble of overriding every single vanilla wing and adding an empty frame to their sprite sheets is worth it.
I'm glad I can prove you wrong then (no offense ). I've found a way to do it (just by trial and error):As per this post, I don't think there is a simple fix for this. Then again, I'd like to proven wrong on this account.
I suppose you could use WingUpdate to draw wings as an empty frame when said buff is active, but I don't think the trouble of overriding every single vanilla wing and adding an empty frame to their sprite sheets is worth it.
public override void ModifyDrawLayers(System.Collections.Generic.List<PlayerLayer> layers)
{
for (int i = 0; i < layers.Count; ++i)
{
if (layers[i].Name == "Wings" && this.myBuffActive)
{
layers[i].visible = false;
}
}
}
Li'll question:
Does anyone know how to prevent the drawing of wings on a player when (lets say) a certain buff is active?
Theoretically you should be able to set player.wings to 0 in this hook: https://github.com/bluemagic123/tModLoader/wiki/ModPlayer#public-virtual-void-frameeffectsAs per this post, I don't think there is a simple fix for this. Then again, I'd like to proven wrong on this account.
I suppose you could use WingUpdate to draw wings as an empty frame when said buff is active, but I don't think the trouble of overriding every single vanilla wing and adding an empty frame to their sprite sheets is worth it.
C# is pretty similar to Java and I already knew Java, so it was pretty easy to learn what exactly was different from Java.Out of interest, how do you (tModLoader Devs) learn how to code in C#?
We haven't worked on any UI stuff yet; although it is possible to hack something together using one of the drawing hooks and the XNA input states.(In the OP):
v0.7.5: Hooks for interface
You may not need to wait that long though, I've heard subtle whispers for the next update about some UI implementation...
I dont know how to do that...We haven't worked on any UI stuff yet; although it is possible to hack something together using one of the drawing hooks and the XNA input states.
Tmodloader saves are separate from your original saves. And you could do a global npc script that override the spawning of the monsters . If you dont know how to make that PM me and I can do the mod it for youHi! I'm new here. I apologize if either of my questions are already answered in the ~400 pages of this thread, I haven't managed to read all the posts.
I have a couple questions about modding Terraria that I hope you guys can answer for me.
1.) If I apply a mod to Terraria is every world automatically affected by it or is it only worlds created after the mod is applied? I want to create a mod for my kids to play while still having access to my regular vanilla characters and worlds.
2.) Is it possible to remove/hide items from vanilla Terraria? I'm trying to get my kids (3 and 5) into the game and they seem really into the building and mining aspects of the game so I would like to remove the monsters so they can dig and build uninterrupted in their play.
Thanks in advance!
- Aerlock
hello! I have a suggestion! after you download and install TModLoader there should be a mod in the "mod browser (beta)" called "creative mode" just download that..go to the "mods" section..enable it..reload mods..and then when the game starts press the enter key and type in "/godmode" without quotes of course..you will be immortal and deal EXTREME damage to all monsters..making them a non-issueHi! I'm new here. I apologize if either of my questions are already answered in the ~400 pages of this thread, I haven't managed to read all the posts.
I have a couple questions about modding Terraria that I hope you guys can answer for me.
1.) If I apply a mod to Terraria is every world automatically affected by it or is it only worlds created after the mod is applied? I want to create a mod for my kids to play while still having access to my regular vanilla characters and worlds.
2.) Is it possible to remove/hide items from vanilla Terraria? I'm trying to get my kids (3 and 5) into the game and they seem really into the building and mining aspects of the game so I would like to remove the monsters so they can dig and build uninterrupted in their play.
Thanks in advance!
- Aerlock
public void AI()
{
Projectile P = projectile;
Vector2 PC = P.position+new Vector2(P.width/2,P.height/2);
P.rotation = (float)Math.Atan2((double)P.velocity.Y, (double)P.velocity.X) + (float)(Math.PI/2);
if (P.ai[0] == 0f)
{
P.alpha -= 50;
if (P.alpha <= 0)
{
P.alpha = 0;
P.ai[0] = 1f;
if (P.ai[1] == 0f)
{
P.ai[1] += 1f;
P.position += P.velocity * 1f;
}
if (P.type == 7 && Main.myPlayer == P.owner)
{
int Projectile_Type = P.type;
if (P.ai[1] >= 8) // change for max parts
{
Projectile_Type = Config.projDefs.byName["RevoltingThorn2"].type;
}
else
Projectile_Type = Config.projDefs.byName["RevoltingThorn1"].type;
if((int)(P.ai[1])%3==0)
{
Vector2 MemoryUnit = new Vector2(P.velocity.X,P.velocity.Y);
float RotatoryAngle = (float)((Math.PI*1)/8f)*(float)Main.rand.NextDouble();
#region Projectile 1
P.velocity=RotateAboutOrigin(MemoryUnit,RotatoryAngle);
int Projectile_Index = Projectile.NewProjectile(
PC.X + P.velocity.X ,
PC.Y + P.velocity.Y,
P.velocity.X,
P.velocity.Y,
Projectile_Type,
P.damage,
P.knockBack,
P.owner
);
Projectile Inheritor = Main.projectile[Projectile_Index];
Inheritor.damage = P.damage;
Inheritor.ai[1] = P.ai[1] + 1f;
NetMessage.SendData(27, -1, -1, "", Projectile_Index, 0f, 0f, 0f, 0);
#endregion
#region Projectile 2
RotatoryAngle = (float)((Math.PI*1)/8f)*(float)Main.rand.NextDouble();
P.velocity=RotateAboutOrigin(MemoryUnit,-RotatoryAngle);
Projectile_Index = Projectile.NewProjectile(
PC.X + P.velocity.X ,
PC.Y + P.velocity.Y,
P.velocity.X,
P.velocity.Y,
Projectile_Type,
P.damage,
P.knockBack,
P.owner
);
Inheritor = Main.projectile[Projectile_Index];
Inheritor.damage = P.damage;
Inheritor.ai[1] = P.ai[1] + 1f;
NetMessage.SendData(27, -1, -1, "", Projectile_Index, 0f, 0f, 0f, 0);
#endregion
}
else
{
int Projectile_Index = Projectile.NewProjectile(
PC.X + P.velocity.X ,
PC.Y + P.velocity.Y,
P.velocity.X,
P.velocity.Y,
Projectile_Type,
P.damage,
P.knockBack,
P.owner
);
Projectile Inheritor = Main.projectile[Projectile_Index];
Inheritor.damage = P.damage;
Inheritor.ai[1] = P.ai[1] + 1f;
NetMessage.SendData(27, -1, -1, "", Projectile_Index, 0f, 0f, 0f, 0);
}
return;
}
}
}
else
{
if (P.alpha < 170 && P.alpha + 5 >= 170)
{
for (int j = 0; j < 3; j++)
{
Dust.NewDust(P.position, P.width, P.height, 18, P.velocity.X * 0.025f, P.velocity.Y * 0.025f, 170, default(Color), 1.2f);
}
Dust.NewDust(P.position, P.width, P.height, 14, 0f, 0f, 170, default(Color), 1.1f);
}
P.alpha += 5;
if (P.alpha >= 255)
{
P.Kill();
return;
}
}
}
#region Rotate by Angles
public Vector2 RotateByRightAngle(Vector2 vector)
{
return new Vector2(vector.Y, -vector.X);
}
public Vector2 RotateByLeftAngle(Vector2 vector)
{
return new Vector2(-vector.Y, vector.X);
}
#endregion
#region Rotate About Origin
public Vector2 RotateAboutOrigin(Vector2 point, float rotation)
{
if(rotation < 0)
rotation+=(float)(Math.PI*4);
Vector2 u = point; //point relative to origin
if (u == Vector2.Zero)
return point;
float a = (float)Math.Atan2(u.Y, u.X); //angle relative to origin
a += rotation; //rotate
//u is now the new point relative to origin
u = u.Length() * new Vector2((float)Math.Cos(a), (float)Math.Sin(a));
return u;
}
#endregion
I have zero experience with tConfig, but what you have right there is code that works with Terraria, so you should be able to plop that into tModLoader without much effort.I've got quite the request here... But Is it possible to get some info on how to better translate this from the ancient tConfig style, into tModLoader? If its too long or not very manageable, its cool. Basically the code is supposed to create vilethorn like entities, that branch at the ends.
Code:public void AI() { Projectile P = projectile; Vector2 PC = P.position+new Vector2(P.width/2,P.height/2); P.rotation = (float)Math.Atan2((double)P.velocity.Y, (double)P.velocity.X) + (float)(Math.PI/2); if (P.ai[0] == 0f) { P.alpha -= 50; if (P.alpha <= 0) { P.alpha = 0; P.ai[0] = 1f; if (P.ai[1] == 0f) { P.ai[1] += 1f; P.position += P.velocity * 1f; } if (P.type == 7 && Main.myPlayer == P.owner) { int Projectile_Type = P.type; if (P.ai[1] >= 8) // change for max parts { Projectile_Type = Config.projDefs.byName["RevoltingThorn2"].type; } else Projectile_Type = Config.projDefs.byName["RevoltingThorn1"].type; if((int)(P.ai[1])%3==0) { Vector2 MemoryUnit = new Vector2(P.velocity.X,P.velocity.Y); float RotatoryAngle = (float)((Math.PI*1)/8f)*(float)Main.rand.NextDouble(); #region Projectile 1 P.velocity=RotateAboutOrigin(MemoryUnit,RotatoryAngle); int Projectile_Index = Projectile.NewProjectile( PC.X + P.velocity.X , PC.Y + P.velocity.Y, P.velocity.X, P.velocity.Y, Projectile_Type, P.damage, P.knockBack, P.owner ); Projectile Inheritor = Main.projectile[Projectile_Index]; Inheritor.damage = P.damage; Inheritor.ai[1] = P.ai[1] + 1f; NetMessage.SendData(27, -1, -1, "", Projectile_Index, 0f, 0f, 0f, 0); #endregion #region Projectile 2 RotatoryAngle = (float)((Math.PI*1)/8f)*(float)Main.rand.NextDouble(); P.velocity=RotateAboutOrigin(MemoryUnit,-RotatoryAngle); Projectile_Index = Projectile.NewProjectile( PC.X + P.velocity.X , PC.Y + P.velocity.Y, P.velocity.X, P.velocity.Y, Projectile_Type, P.damage, P.knockBack, P.owner ); Inheritor = Main.projectile[Projectile_Index]; Inheritor.damage = P.damage; Inheritor.ai[1] = P.ai[1] + 1f; NetMessage.SendData(27, -1, -1, "", Projectile_Index, 0f, 0f, 0f, 0); #endregion } else { int Projectile_Index = Projectile.NewProjectile( PC.X + P.velocity.X , PC.Y + P.velocity.Y, P.velocity.X, P.velocity.Y, Projectile_Type, P.damage, P.knockBack, P.owner ); Projectile Inheritor = Main.projectile[Projectile_Index]; Inheritor.damage = P.damage; Inheritor.ai[1] = P.ai[1] + 1f; NetMessage.SendData(27, -1, -1, "", Projectile_Index, 0f, 0f, 0f, 0); } return; } } } else { if (P.alpha < 170 && P.alpha + 5 >= 170) { for (int j = 0; j < 3; j++) { Dust.NewDust(P.position, P.width, P.height, 18, P.velocity.X * 0.025f, P.velocity.Y * 0.025f, 170, default(Color), 1.2f); } Dust.NewDust(P.position, P.width, P.height, 14, 0f, 0f, 170, default(Color), 1.1f); } P.alpha += 5; if (P.alpha >= 255) { P.Kill(); return; } } } #region Rotate by Angles public Vector2 RotateByRightAngle(Vector2 vector) { return new Vector2(vector.Y, -vector.X); } public Vector2 RotateByLeftAngle(Vector2 vector) { return new Vector2(-vector.Y, vector.X); } #endregion #region Rotate About Origin public Vector2 RotateAboutOrigin(Vector2 point, float rotation) { if(rotation < 0) rotation+=(float)(Math.PI*4); Vector2 u = point; //point relative to origin if (u == Vector2.Zero) return point; float a = (float)Math.Atan2(u.Y, u.X); //angle relative to origin a += rotation; //rotate //u is now the new point relative to origin u = u.Length() * new Vector2((float)Math.Cos(a), (float)Math.Sin(a)); return u; } #endregion
I suppose the biggest problem I encountered was finding similar methods toI have zero experience with tConfig, but what you have right there is code that works with Terraria, so you should be able to plop that into tModLoader without much effort.
Those methods look like they should have been defined from wherever you got that code.I suppose the biggest problem I encountered was finding similar methods to
public Vector2 RotateAboutOrigin(Vector2 point, float rotation), public Vector2 RotateByRightAngle(Vector2 vector) and Public Vector2 RotateByLeftAngle(Vector2 vector). But maybe the problem is my lack of a necessary reference...
Thanks for the help!Tmodloader saves are separate from your original saves. And you could do a global npc script that override the spawning of the monsters . If you dont know how to make that PM me and I can do the mod it for you
Thanks for the suggestion, I'll try that if nothing else works. I'm trying to remove the fighting from the game so my wife won't object to the kids playing. Our 3 year old likes to "pretend" to fight zombies and has been hitting. He like the digging and building too so I'm trying to separate the two to keep him from trying to emulate the game.hello! I have a suggestion! after you download and install TModLoader there should be a mod in the "mod browser (beta)" called "creative mode" just download that..go to the "mods" section..enable it..reload mods..and then when the game starts press the enter key and type in "/godmode" without quotes of course..you will be immortal and deal EXTREME damage to all monsters..making them a non-issue