ALmaZss
Plantera
ModProjectileWhich class instance are we refering to? ModItem, ModNPC...?
ModProjectileWhich class instance are we refering to? ModItem, ModNPC...?
Allright, so you've got two drawOriginOffsets right? X and Y.ModProjectile
public override void SetDefaults()
{
// Name, width, height, etcetc.
// Now say the texture of your projectile is... 16x16 and you want the projectile to rotate around its center, you'll want to set the origin values to 8, since that will get the middle of the projectile to rotate or draw around.
drawOriginOffsetY = drawOriginOffsetY = 8;
}
How whould i add these MEssage? to what File i need to to add it and what Method etcWhat I have seen people do is use
upon entering a world. Kind of the same effect (I guess?).Code:Main.NewText("Using MyMod version 1.0");
I'm not sure if there's a general 'OnWorldJoin' kind of function, but one (not so optimal, but working) way of doing this is by using the following code in a class that derives from ModPlayer:How whould i add these MEssage? to what File i need to to add it and what Method etc
private bool loaded = false;
public override void PreUpdate()
{
if(!loaded)
{
Main.NewText("Display your message here.");
loaded = true;
}
}
Nope, I can't assign a value because drawOriginOffset is a group of methods.Allright, so you've got two drawOriginOffsets right? X and Y.
What you want to do with these values is set them in the SetDefaults function of your ModProjectile. Ex:
This is untested, but technically it should work.Code:public override void SetDefaults() { // Name, width, height, etcetc. // Now say the texture of your projectile is... 16x16 and you want the projectile to rotate around its center, you'll want to set the origin values to 8, since that will get the middle of the projectile to rotate or draw around. drawOriginOffsetY = drawOriginOffsetY = 8; }
Huh, now it is working...Nope, I can't assign a value because drawOriginOffset is a group of methods.
What did you change?Nope, I can't assign a value because drawOriginOffset is a group of methods.
[doublepost=1465732040,1465731925][/doublepost]
Huh, now it is working...
How do i change the Color of the Text?I'm not sure if there's a general 'OnWorldJoin' kind of function, but one (not so optimal, but working) way of doing this is by using the following code in a class that derives from ModPlayer:
Code:private bool loaded = false; public override void PreUpdate() { if(!loaded) { Main.NewText("Display your message here."); loaded = true; } }
Use the R,G,B parameters of the Main.NewText function. Ex:How do i change the Color of the Text?
Main.NewText("I'm Red", 255, 0, 0);
Main.NewText("I'm Green", 0, 255, 0);
Main.NewText("I'm Blue", 0, 0, 255);
Main.NewText("I'm... Yellow?", 255, 125, 40);
player.direction. If that variable is -1 the player is facing left. If it's 1, the player is facing right. Ex:How can I check player's facing?
if(player.direction == -1)
// Left
else
// Right
But I need to check this in SetDefaults to change drawOriginOffset and there is no "player"player.direction. If that variable is -1 the player is facing left. If it's 1, the player is facing right. Ex:
Code:if(player.direction == -1) // Left else // Right
Allright, in this case 'player' was just an example of a Player class instance.But I need to check this in SetDefaults to change drawOriginOffset and there is no "player"
public override SetDefaults()
{
Player p = Main.player[projectile.owner];
if(p.direction == -1)
// Do your left stuff.
else
// Do your right stuff.
}
if (downedDesertScourge)
{
for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 15E-05); k++)
{
int i2 = WorldGen.genRand.Next(0, Main.maxTilesX);
int j2 = WorldGen.genRand.Next((int)(Main.maxTilesY * .2f), (int)(Main.maxTilesY * .8f));
WorldGen.OreRunner(i2, j2, (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(3, 6), (ushort)mod.TileType("AerialiteOre"));
}
}
Yes, it works, thank youAllright, in this case 'player' was just an example of a Player class instance.
If you want to check the direction of the owner of the projectile in the SetDefaults function, something like this may work:
Code:public override SetDefaults() { Player p = Main.player[projectile.owner]; if(p.direction == -1) // Do your left stuff. else // Do your right stuff. }
I've been using OreRunner and never had the problem of ore spawning in trees so yeah, this should work (if there are no errors of course).Just so I don't have to test everything again, this should make it so ore can't spawn in trees right?
Because ore runner allows ore to spawn in only specified tiles.
Code:if (downedDesertScourge) { for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 15E-05); k++) { int i2 = WorldGen.genRand.Next(0, Main.maxTilesX); int j2 = WorldGen.genRand.Next((int)(Main.maxTilesY * .2f), (int)(Main.maxTilesY * .8f)); WorldGen.OreRunner(i2, j2, (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(3, 6), (ushort)mod.TileType("AerialiteOre")); } }
You could try something like the following:How can I make the projectile spin during flight?
public override bool PreUpdate()
{
projectile.rotation += 0.1F * projectile.direction;
return false;
}
where are enough tutorials on youtube for theseCan anyone help me on installation please?