tModLoader Get when in modded biome

Ahndrek Li'Cyri

Skeletron Prime
Hello!
As the title suggests, i would like to figure out when a player is in a modded biome, like Calamity's Sulphurous Sea.
Any help is appreciated thanks!
 
Last edited:

-Q-

Terrarian
Mod World TileCountsAvailable[] lets you gather counts of nearby tiles.


Code:
public statis int NewBiomeTiles = 0;

 public virtual void TileCountsAvailable(int[] tileCounts)
    {
      ModWorld.NewBiomeTiles = tileCounts[ModContent.TileType<MyMod.Tiles.NewTile1>()] + tileCounts[ModContent.TileType<MyMod.Tiles.NewTile2>()] ;
}


Then you use mod player and set a flag that they're in the zone based on the tile count
Code:
public bool NewBiomeZone

public virtual void UpdateBiomes()
    {
      this.NewBiomeZone = ModWorld.NewBiomeTiles > 500;
}

I think that's the base, then you'd need to do background and music changes and stuff but then you just reference the boolean you set.
 

Ahndrek Li'Cyri

Skeletron Prime
Mod World TileCountsAvailable[] lets you gather counts of nearby tiles.


Code:
public statis int NewBiomeTiles = 0;

public virtual void TileCountsAvailable(int[] tileCounts)
    {
      ModWorld.NewBiomeTiles = tileCounts[ModContent.TileType<MyMod.Tiles.NewTile1>()] + tileCounts[ModContent.TileType<MyMod.Tiles.NewTile2>()] ;
}


Then you use mod player and set a flag that they're in the zone based on the tile count
Code:
public bool NewBiomeZone

public virtual void UpdateBiomes()
    {
      this.NewBiomeZone = ModWorld.NewBiomeTiles > 500;
}

I think that's the base, then you'd need to do background and music changes and stuff but then you just reference the boolean you set.
I see. I was meaning a bit more like how do i detect when a player is in a biome from a different mod, but thank you for the help anyways.
 

-Q-

Terrarian
I see. I was meaning a bit more like how do i detect when a player is in a biome from a different mod, but thank you for the help anyways.

Ahh, this might help:


The other mod would need to be a dependency. I haven't done anything like that. presumably if that mod already had the boolean set you could call into that mod's player object and check for the boolean.

Otherwise you'll need to do the tile checks on your own by referencing the other mod's tiles.
 

Ahndrek Li'Cyri

Skeletron Prime
Ahh, this might help:


The other mod would need to be a dependency. I haven't done anything like that. presumably if that mod already had the boolean set you could call into that mod's player object and check for the boolean.

Otherwise you'll need to do the tile checks on your own by referencing the other mod's tiles.
Ah i see. I'll check that. Thank you!
 
Top Bottom