slade3501
Terrarian
Hey! Well, I've got a working ore spawning code, and it works great and such. But, anyone mind helping me out on making it spawn MULTIPLE ores.
My Code: [Works]
using Terraria;
using TAPI;
namespace SK
{
public class SK : ModWorld
{
public override void WorldGenPostGen()
{
ModifyWorld();
}
public void ModifyWorld()
{
Main.statusText = "Adding Crodian Ore..."; //This is what displays as your ore is being generated. feel free to tweak
int Amount_Of_Spawns = 100+(int)(Main.maxTilesY/5); //feel free to tweak
for(int i=0;i<Amount_Of_Spawns;i++) AddMyOres();
}
public void AddMyOres()
{
int LowX = 200; //after ocean on left edge of map
int HighX = Main.maxTilesX-200; //before ocean on right edge of map
int LowY = (int)Main.worldSurface; //where the brown background and the sky background meets
int HighY = Main.maxTilesY-200; //where hell and the grey background meets
int X = WorldGen.genRand.Next(LowX,HighX); //don't touch
int Y = WorldGen.genRand.Next(LowY,HighY); //don't touch
int OreMinimumSpread = 3; //minimum amount of ore in a vein. feel free to tweak
int OreMaximumSpread = 20; //Maximum amount of ore in a vein. feel free to tweak
int OreMinimumFrequency = 3; //feel free to tweak, this and the next line mean how frequent your ore spawns.
int OreMaximumFrequency = 30; //feel free to tweak
int OreSpread = WorldGen.genRand.Next(OreMinimumSpread,OreMaximumSpread+1); //don't touch
int OreFrequency = WorldGen.genRand.Next(OreMinimumFrequency,OreMaximumFrequency+1); //don't touch
WorldGen.OreRunner(X, Y, (double)OreSpread, OreFrequency, TileDef.byName["SK:CrodianOre"]);
}
}
}
Anyway I can make it spawn multiple? Please note I can't make it by making another .cs file as SK is already used here...
My Code: [Works]
using Terraria;
using TAPI;
namespace SK
{
public class SK : ModWorld
{
public override void WorldGenPostGen()
{
ModifyWorld();
}
public void ModifyWorld()
{
Main.statusText = "Adding Crodian Ore..."; //This is what displays as your ore is being generated. feel free to tweak
int Amount_Of_Spawns = 100+(int)(Main.maxTilesY/5); //feel free to tweak
for(int i=0;i<Amount_Of_Spawns;i++) AddMyOres();
}
public void AddMyOres()
{
int LowX = 200; //after ocean on left edge of map
int HighX = Main.maxTilesX-200; //before ocean on right edge of map
int LowY = (int)Main.worldSurface; //where the brown background and the sky background meets
int HighY = Main.maxTilesY-200; //where hell and the grey background meets
int X = WorldGen.genRand.Next(LowX,HighX); //don't touch
int Y = WorldGen.genRand.Next(LowY,HighY); //don't touch
int OreMinimumSpread = 3; //minimum amount of ore in a vein. feel free to tweak
int OreMaximumSpread = 20; //Maximum amount of ore in a vein. feel free to tweak
int OreMinimumFrequency = 3; //feel free to tweak, this and the next line mean how frequent your ore spawns.
int OreMaximumFrequency = 30; //feel free to tweak
int OreSpread = WorldGen.genRand.Next(OreMinimumSpread,OreMaximumSpread+1); //don't touch
int OreFrequency = WorldGen.genRand.Next(OreMinimumFrequency,OreMaximumFrequency+1); //don't touch
WorldGen.OreRunner(X, Y, (double)OreSpread, OreFrequency, TileDef.byName["SK:CrodianOre"]);
}
}
}
Anyway I can make it spawn multiple? Please note I can't make it by making another .cs file as SK is already used here...