• Journey's End on PC - Find info here and here. Please report bugs and issues for PC 1.4 and 1.4.1 to Re-Logic here.
  • Journey's End on Mobile - Find info here. Report bugs for Mobile 1.4 to DR Studios at this link and give as much detail as possible.
  • 1.4 will bring many changes to the PC version. We strongly advise making plans to back up your worlds and players prior to updating your game. More details here.
  • Console and Switch - The latest news can be found here. To report a bug, please use this link.

Standalone [1.3] tModLoader - A Modding API

Lukas04

Official Terrarian
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;
    }
}
How do i change the Color of the Text?
 

ALmaZss

Plantera
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
But I need to check this in SetDefaults to change drawOriginOffset and there is no "player"
 

Iriazul

Terrarian
But I need to check this in SetDefaults to change drawOriginOffset and there is no "player"
Allright, 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.
}
 

Fabsol

The Destroyer
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"));
 }
 }
 

ALmaZss

Plantera
Allright, 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.
}
Yes, it works, thank you
 

Iriazul

Terrarian
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"));
}
}
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).
 

Iriazul

Terrarian
Just a quick question to confirm my assumption:
A method when placing a tile is absent, right? I want to use the coordinates of the newly placed tile, so if my assumption is correct, I'm guessing I'll have to do the tile placement manually and go from there?
How can I make the projectile spin during flight?
You could try something like the following:
Code:
public override bool PreUpdate()
{
    projectile.rotation += 0.1F * projectile.direction;
    return false;
}
<<< EDIT >>>
Nevermind my question, I think the placement of Chests has answered it.
 
Last edited:

ALmaZss

Plantera
Just a quick question to confirm my assumption:
A method when placing a tile is absent, right? I want to use the coordinates of the newly placed tile, so if my assumption is correct, I'm guessing I'll have to do the tile placement manually and go from there?

You could try something like the following:
Code:
public override bool PreUpdate()
{
    projectile.rotation += 0.1F * projectile.direction;
    return false;
}
Doesn't work
 
So I suppose the real question here is: is it possible to change the color of an armor piece without changing the color of nearby accessories? It feels like it should, since the game already seems to do that with dressers.
I really, really want to know this. I even tried messing with Main.playerDrawData and no luck.
[doublepost=1465738044,1465738004][/doublepost]
I should have known...
[doublepost=1465737970,1465737795][/doublepost]Is there way to change properties of existing item?
Check the documentation for GlobalItem.
 
Top Bottom