tAPI Scattered Void

TenshiHenshin

Terrarian
Hey all, I'm a new Mod Dev who is still learning how to Code Terraria Mods. I am making a mod called Scattered Void, containing several different features, Ores, Weapons, Tools, NPCs, Enemies, Bosses... Etc. However, like I said I am still learning so I am hoping I could get a little help with what I am working on.
So far, I have the Following Done:
Endite Bar - Image Created
Endite Ore - Image Created
Omnium Bar - Image & File Complete
Omnium Ore - Image Created & json made but still very W.I.P
Onimite Bar - Image Created
Onimite Ore - Image Created
Antionium Bar - Image Created
Antionium Ore - Image Created
 
Last edited:
Zoodle (maker of Necropolis Mod) may know. Not sure though.
hoping this turns out to be a success!
 
Well, to generate ores when the world starts, override WorldGenPostGen() with a function. So, for example, if you're ore is called Tintium (random name), then you would make a function like this:


Code:
public void AddTintium()
        {
            int LowX = 200;  //How far left in the world it's generated
            int HighX = Main.maxTilesX - 200;  //How far right in the world it's generated
            int LowY = Main.maxTilesY - 400; //Height in the world (uppermost)
            int HighY = Main.maxTilesY - 200;  //Height in the world (lowermost)

            int X = WorldGen.genRand.Next(LowX, HighX); //Picks a random position on the X axis
            int Y = WorldGen.genRand.Next(LowY, HighY); //Picks a random position on the Y axis

            int OreMinimumSize= 4;
            int OreMaximumSize = 6; // This is (from what I've found) the size of vein

            int OreMinimumStretch = 8;
            int OreMaximumStretch = 15; //This is how stretched out the vein is (from what I've found), so a higher variable would make a really elongated vein (mess around with this if you want)

            int OreSpread = WorldGen.genRand.Next(OreMinimumSpread, OreMaximumSpread + 1); //Randomized variable
            int OreFrequency = WorldGen.genRand.Next(OreMinimumFrequency, OreMaximumFrequency + 1); //Another randomized variable

            WorldGen.OreRunner(X, Y, (double)OreSpread, OreFrequency, TileDef.byName["InternalModName:TintiumOre"]);  //Ores tile name at the end, leave the rest.
        }

Presuming you've already made a file that extends the ModWorld class, in their, you would type this:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;

using TAPI;
using Terraria;

public class MWorld : ModWorld    //Replace MWorld with name of the .cs file
{
    public override void WorldGenPostGen()
    {
        Main.statusText = "Adding Tintium Ore..."; //Not necessary, but you can use it if you want to make it say something whilst generating the world.
        int amount = 400; //How many times you want the ore to be generated (how many veins)
        for (int x = 0; x < amount + 1; x++) AddTintium();
    }
}

I think that's everything you need, and If you want, I can sprite stuff but I wouldn't call myself an expert, your choice :D

EDIT: For your convenience, I'll just post the whole code:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;

using TAPI;
using Terraria;

namespace ModName  //Make this your mod name
{
    public class MWorld : ModWorld    //Replace MWorld with name of the .cs file
    {
        public override void WorldGenPostGen()
        {
            Main.statusText = "Adding Tintium Ore..."; //Not necessary, but you can use it if you want to make it say something whilst generating the world.
            int amount = 400; //How many times you want the ore to be generated (how many veins)
            for (int x = 0; x < amount + 1; x++) AddTintium();
        }
        public void AddTintium()
        {
            int LowX = 200;  //How far left in the world it's generated
            int HighX = Main.maxTilesX - 200;  //How far right in the world it's generated
            int LowY = Main.maxTilesY - 400; //Height in the world (uppermost)
            int HighY = Main.maxTilesY - 200;  //Height in the world (lowermost)

            int X = WorldGen.genRand.Next(LowX, HighX); //Picks a random position on the X axis
            int Y = WorldGen.genRand.Next(LowY, HighY); //Picks a random position on the Y axis

            int OreMinimumSize = 4;
            int OreMaximumSize = 6; // This is (from what I've found) the size of vein
           
            int OreMinimumStretch = 8;
            int OreMaximumStretch = 15; //This is how stretched out the vein is (from what I've found), so a higher variable would make a really elongated vein (mess around with this if you want)

            int OreSpread = WorldGen.genRand.Next(OreMinimumSpread, OreMaximumSpread + 1); //Randomized variable
            int OreFrequency = WorldGen.genRand.Next(OreMinimumFrequency, OreMaximumFrequency + 1); //Another randomized variable

             WorldGen.OreRunner(X, Y, (double)OreSpread, OreFrequency, TileDef.byName["InternalModName:TintiumOre"]);  //Ores tile name at the end, leave the rest.
        }
    }
}
 
Last edited:
Well, to generate ores when the world starts, override WorldGenPostGen() with a function. So, for example, if you're ore is called Tintium (random name), then you would make a function like this:


Code:
public void AddTintium()
        {
            int LowX = 200;  //How far left in the world it's generated
            int HighX = Main.maxTilesX - 200;  //How far right in the world it's generated
            int LowY = Main.maxTilesY - 400; //Height in the world (uppermost)
            int HighY = Main.maxTilesY - 200;  //Height in the world (lowermost)

            int X = WorldGen.genRand.Next(LowX, HighX); //Picks a random position on the X axis
            int Y = WorldGen.genRand.Next(LowY, HighY); //Picks a random position on the Y axis

            int OreMinimumSize= 4;
            int OreMaximumSize = 6; // This is (from what I've found) the size of vein

            int OreMinimumStretch = 8;
            int OreMaximumStretch = 15; //This is how stretched out the vein is (from what I've found), so a higher variable would make a really elongated vein (mess around with this if you want)

            int OreSpread = WorldGen.genRand.Next(OreMinimumSpread, OreMaximumSpread + 1); //Randomized variable
            int OreFrequency = WorldGen.genRand.Next(OreMinimumFrequency, OreMaximumFrequency + 1); //Another randomized variable

            WorldGen.OreRunner(X, Y, (double)OreSpread, OreFrequency, TileDef.byName["InternalModName:TintiumOre"]);  //Ores tile name at the end, leave the rest.
        }

Presuming you've already made a file that extends the ModWorld class, in their, you would type this:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;

using TAPI;
using Terraria;

public class MWorld : ModWorld    //Replace MWorld with name of the .cs file
{
    public override void WorldGenPostGen()
    {
        Main.statusText = "Adding Tintium Ore..."; //Not necessary, but you can use it if you want to make it say something whilst generating the world.
        int amount = 400; //How many times you want the ore to be generated (how many veins)
        for (int x = 0; x < amount + 1; x++) AddTintium();
    }
}

I think that's everything you need, and If you want, I can sprite stuff but I wouldn't call myself an expert, your choice :D

EDIT: For your convenience, I'll just post the whole code:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;

using TAPI;
using Terraria;

namespace ModName  //Make this your mod name
{
    public class MWorld : ModWorld    //Replace MWorld with name of the .cs file
    {
        public override void WorldGenPostGen()
        {
            Main.statusText = "Adding Tintium Ore..."; //Not necessary, but you can use it if you want to make it say something whilst generating the world.
            int amount = 400; //How many times you want the ore to be generated (how many veins)
            for (int x = 0; x < amount + 1; x++) AddTintium();
        }
        public void AddTintium()
        {
            int LowX = 200;  //How far left in the world it's generated
            int HighX = Main.maxTilesX - 200;  //How far right in the world it's generated
            int LowY = Main.maxTilesY - 400; //Height in the world (uppermost)
            int HighY = Main.maxTilesY - 200;  //Height in the world (lowermost)

            int X = WorldGen.genRand.Next(LowX, HighX); //Picks a random position on the X axis
            int Y = WorldGen.genRand.Next(LowY, HighY); //Picks a random position on the Y axis

            int OreMinimumSize = 4;
            int OreMaximumSize = 6; // This is (from what I've found) the size of vein
         
            int OreMinimumStretch = 8;
            int OreMaximumStretch = 15; //This is how stretched out the vein is (from what I've found), so a higher variable would make a really elongated vein (mess around with this if you want)

            int OreSpread = WorldGen.genRand.Next(OreMinimumSpread, OreMaximumSpread + 1); //Randomized variable
            int OreFrequency = WorldGen.genRand.Next(OreMinimumFrequency, OreMaximumFrequency + 1); //Another randomized variable

             WorldGen.OreRunner(X, Y, (double)OreSpread, OreFrequency, TileDef.byName["InternalModName:TintiumOre"]);  //Ores tile name at the end, leave the rest.
        }
    }
}
Thank you, I'll use it to generate the first Ore, Endite. And I'm not made a file that extends the ModWorld class. Also for the thing of sprites, I've no good with anything except for basics, so if you can sprite tools or weapons or mobs, any of those, then I'd appreciate the help.
 
Thank you, I'll use it to generate the first Ore, Endite. And I'm not made a file that extends the ModWorld class. Also for the thing of sprites, I've no good with anything except for basics, so if you can sprite tools or weapons or mobs, any of those, then I'd appreciate the help.

I'm probably better at tools and weapons anyway, :p

And for the ModWorld thing, just make a class called MWorld.cs and put that code in there, should work fine :D
 
Back
Top Bottom