Hi everyone, I'm new here. I've been lurking this forum gathering some really cool mods to play with. I downloaded some mods that have new ore types, but I want to be able to use my old worlds instead of generating a new one. My question is how can I spawn a type of ore in my old worlds? In this case, carbon ore from warmaster949's awesome CoD mod. http://www.terrariaonline.com/threads/wip-nazi-zombies-weapon-mod.63352/ I have basic coding knowledge (VERY basic) but am good with instructions. Thank you all in advance! Best, Arkoth
you CAN, but it is very risky Code: //add ores (from Mechanica) if (y >= hellLevel + Main.rand.Next(135, 140)) { if (Main.rand.Next(0, 30) == 5) //copper { WorldGen.OreRunner(x, y, (double)Main.rand.Next(5, 10), Main.rand.Next(5, 9), 7); } else if (Main.rand.Next(0, 50) == 5) //iron { WorldGen.OreRunner(x, y, (double)Main.rand.Next(5, 10), Main.rand.Next(5, 9), 6); } else if (Main.rand.Next(0, 65) == 5) //silver { WorldGen.OreRunner(x, y, (double)Main.rand.Next(5, 10), Main.rand.Next(5, 9), 9); } else if (Main.rand.Next(0, 100) == 5) //gold { WorldGen.OreRunner(x, y, (double)Main.rand.Next(5, 10), Main.rand.Next(5, 9), 8); } } just try and run a check for manmade structures
Thanks for the replies. It makes sense to me that there should be a way to spawn ore since the code essentially exists with Demon Altars. I'm not particularly worried about ores destroying my structures since all are above ground and the hellavator is very easy to make. Thank you Bobrocket for the code there. If it's not too much trouble, can someone break down what some of those parameters mean and the steps on how I can get to the point where I can put in that code? Thanks again.
Use what Classikly said, and add something like this: Code: for (int x = 0; x < Main.MaxTilesX; x++) { for (int y = Main.MaxTilesY / 2; y < Main.MaxTilesY; y++) //start halfway down the map, less processing involved { if (Main.tile[x, y].active == false) //air else WorldGen.OreRunner(x, y, (double)Main.rand.Next(1, 4), Main.rand.Next(2, 5), Config.tileDefs.ID["Carbon Ore"]); //x position, y position, strength/spread, frequency, tile ID } }
If the guy has no experience with this stuff, I think it's better if we make the item and send it to him.
So I attempted to make a tome that spawns carbon ore but failed miserably. Here is what I created: Carbon_Ore_Spawn_Tome.png a Carbone_Ore_Spawn_Tome.ini : based off a spellbook [Stats] stack=1 prefixType=272 height=10 knockBack=4 maxStack=1 rare=2 scale=1 magic=True noMelee=True pretendType=65 mana=10 type=-1 useSound=21 useStyle=5 useTime=10 useAnimation=10 value=1 width=34 toolTip=A Tome that spawns Ore. Do not use often! [Recipe] Amount=1 needWater=False Items=1 wood and then the Carbon_Ore_Spawn_Tome.cs : public void UseItem(Player player, int playerID) for (int x = 0; x < Main.MaxTilesX; x++) { for (int y = Main.MaxTilesY / 2; y < Main.MaxTilesY; y++) //start halfway down the map, less processing involved { if (Main.tile[x, y].active == false) //air else WorldGen.OreRunner(x, y, (double)Main.rand.Next(1, 4), Main.rand.Next(2, 5), Config.tileDefs.ID["Carbon Ore"]); //x position, y position, strength/spread, frequency, tile ID } } I used ModPackBuilder to build the .obj file. I can load it up fine but when I actually get in the game I can't craft it. Not sure exactly where the problem is since I'm obviously quite new to this. Am I on the right track? Thanks! -Arkoth
After some more experimentation, I forgot to have an "Item" folder to build the obj. However once I fixed that, the ModPackBuilder gave me a huge error with system exception messages. Anyways, here is the obj as a zip file. Thanks for looking over it.
Fixed syntax errors (captilized W in wood and removed e from "Carnbone" in ini name). the CS file is what gives me errors.
Finally got this to work, I used code from Atomsk's Onyx Ore Spawn mod for the cs file. I don't actually know if it reeaaally worked because when I used the item the game froze, presumably from all the ore spawning in the world. It was pretty hilarious though since I heard a bunch of block place sounds and a lot of vases / jars breaking. Anyhoo, for anyone interested here is my source. This was mostly an experiment to see if it could be done but I highly doubt I will actually be using it. Best to just create a new world and dig the ore there. Cheers. Arkoth