Fandom

Surfpup's tConfig Mod Wiki

Biome Spawning Methods

124pages on
this wiki
Add New Page
Comments5 Share
Difficulty: noframe
Clock: N/A


Biome Spawning MethodsEdit

These codes are meant to make spawning NPCs in specific biomes easier.

  • bool nospecialbiome = !Main.player[Main.myPlayer].zoneJungle && !Main.player[Main.myPlayer].zoneEvil && !Main.player[Main.myPlayer].zoneHoly && !Main.player[Main.myPlayer].zoneMeteor && !Main.player[Main.myPlayer].zoneDungeon;

Will spawn if the player is in grassy land.

  • bool sky = nospecialbiome && ((double)y < Main.worldSurface * 0.44999998807907104);

Will spawn if the player is in the Sky at the limit where harpys can spawn.

  • bool surface = nospecialbiome && !sky && (y <= Main.worldSurface);

Will spawn if the player is on the surface in grassy lands.

  • bool underground = nospecialbiome && !surface && (y <= Main.rockLayer);

Will spawn if the player is underground.

  • bool underworld= (y > Main.maxTilesY-190);

Will spawn if the player is in hell.

  • bool cavern = nospecialbiome && !sky && !surface && !underground && !underworld && (y <= Main.rockLayer *25);

Will spawn in the cavern layer.

  • bool undergroundJungle = (y >= Main.rockLayer) && !underworld && (y <= Main.rockLayer *25) && Main.player[Main.myPlayer].zoneJungle;

Will spawn in the underground jungle.

  • bool undergroundEvil = (y >= Main.rockLayer) && !underworld && (y <= Main.rockLayer *25) && Main.player[Main.myPlayer].zoneEvil;

Will spawn in the underground corruption.

  • bool undergroundHoly = (y >= Main.rockLayer) && !underworld && (y <= Main.rockLayer *25) && Main.player[Main.myPlayer].zoneHoly;

Will spawn in the underground hallow.

  • bool desert = (Main.sandTiles >= 1001);

Will spawn in the desert.


A spawn code using these example would be:

bool nospecialbiome = !Main.player[Main.myPlayer].zoneJungle && !Main.player[Main.myPlayer].zoneEvil && !Main.player[Main.myPlayer].zoneHoly && !Main.player[Main.myPlayer].zoneMeteor && !Main.player[Main.myPlayer].zoneDungeon;

bool surface = nospecialbiome && !sky && (y <= Main.worldSurface);

public static bool SpawnNPC(int x, int y, int playerID) {

if (Main.dayTime && surface) {
if(Main.rand.Next(20)==0) {
return true;
}
} return false;
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.