How can i Fuse a 2nd Custom Ore into the World?

Discussion in 'PC' started by DraLUSAD, Dec 26, 2012.

  1. DraLUSAD Snow Flinx

    Trying to add a 2nd ore to Generate into the world, but when i tried the Tutorial, it keeps coming up with an Error


    This is what I've got for a Single Ore - And it works :)
    Code:
    public void ModifyWorld()
    {
        Main.statusText = "Adding Tin Ore..."; //feel free to tweak
        int Amount_Of_Spawns = 150+(int)(Main.maxTilesY/5); //feel free to tweak
        for(int i=0;i<Amount_Of_Spawns;i++) AddTinOre();
    }
    public void AddTinOre()
    {
        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; //feel free to tweak
        int OreMaximumSpread = 10; //feel free to tweak
     
        int OreMinimumFrequency = 3; //feel free to tweak
        int OreMaximumFrequency = 10; //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, Config.tileDefs.ID["Tin Ore"]);
    }

    This is what i was trying to do: :(
    Code:
    public void ModifyWorld()
    {
        Main.statusText = "Adding Tin Ore...";
        int Amount_Of_Spawns = 100+(int)(Main.maxTilesY/5);
        for(int i=0;i<Amount_Of_Spawns;i++) AddTinOre();
     
        Main.statusText = "Adding Coal..."; //feel free to tweak
        int Amount_Of_Spawns = 100+(int)(Main.maxTilesY/5);
        for(int i=0;i<Amount_Of_Spawns;i++) AddCoal();//notice how they both are different?? Good!!!
     
    }
    public void AddTinOre()
    {
        int LowX = 200;                   
        int HighX = Main.maxTilesX-200;   
        int LowY = (int)Main.worldSurface; 
        int HighY = Main.maxTilesY-200;   
       
        int X = WorldGen.genRand.Next(LowX,HighX);
        int Y = WorldGen.genRand.Next(LowY,HighY);
     
        int OreMinimumSpread = 5;
        int OreMaximumSpread = 8;
     
        int OreMinimumFrequency = 5;
        int OreMaximumFrequency = 8;
     
        int OreSpread = WorldGen.genRand.Next(OreMinimumSpread,OreMaximumSpread+1);
        int OreFrequency = WorldGen.genRand.Next(OreMinimumFrequency,OreMaximumFrequency+1);
     
        WorldGen.OreRunner(X, Y, (double)OreSpread, OreFrequency, Config.tileDefs.ID["Tin Ore"]);
    }
    public void AddCoal() //This once is different than the other. Different name = no error!!! Good!!!
    {
            int LowX = 200;                   
        int HighX = Main.maxTilesX-200;   
        int LowY = (int)Main.worldSurface; 
        int HighY = Main.maxTilesY-200;   
       
        int X = WorldGen.genRand.Next(LowX,HighX);
        int Y = WorldGen.genRand.Next(LowY,HighY);
     
        int OreMinimumSpread = 5;
        int OreMaximumSpread = 8;
     
        int OreMinimumFrequency = 5;
        int OreMaximumFrequency = 8;
     
        int OreSpread = WorldGen.genRand.Next(OreMinimumSpread,OreMaximumSpread+1);
        int OreFrequency = WorldGen.genRand.Next(OreMinimumFrequency,OreMaximumFrequency+1);
     
        WorldGen.OreRunner(X, Y, (double)OreSpread, OreFrequency, Config.tileDefs.ID["Coal"]);
    }
     
    }
    And this was my Error
    Code:
    Compiling all CS Files...
    Test Compiling C:\Users\<Account Name>\Documents\My Games\Terraria\ModPacks\Industrial_Age\Tile\Tile.CS
    Error Compiling C:\Users\<Account Name>\Documents\My Games\Terraria\ModPacks\Industrial_Age\Tile\Tile.CS
    System.Exception: Errors Building source code into C:\Users\<Account Name>\appData\Local\Temp\pzyzddfd.dll
      C:\Users\<Account Name>\Appdata\Local\Temop\Pzyzddfd.0.cs<61,1> : Error CS1022: Type or namespace difinition, or end-of-file expected
        at Terraria.Modpackbuilder.compileperm<String Classname, String SourceFile, String Type, Boolean Save>
        at Terraria.modpackbuilder.compileCSCheck<String Classname, String CodePath, String Type>
    Build Failed!
    Where did i go Wrong?
  2. Yoraiz0r The Wizard

    there's only two mere errors.

    the main one the compiler complains about is that you have one extra } in the end of your code , after you already closed everything..

    the second , is that inside ModifyWorld you 'defined' Amount_Of_Spawns twice , remove 'int ' from the second time it appears , when you set it for the amount of coal ores.

Share This Page