Standalone [1.3] tModLoader - A Modding API

140 / 5 is 28. If I enter 28, will it actually have 140? Or will it have 28 but the item says 140?
It will have 28 but the item will say 140. The same thing happens for all vanilla axes. I honestly don't know why they made it that way... but that's the way it is.
 
The problem with that is, that's the part where people are supposed to be skilled (not just knowledgeable) about programming.
Terraria modding is my only experience with C# programming. I guess I need to learn more about it.:happy:
I'm sure I'll find a way to have my bosses at a way I like.
 
Terraria modding is my only experience with C# programming. I guess I need to learn more about it.:happy:
I'm sure I'll find a way to have my bosses at a way I like.
You can take a look at the existing AI's of the bosses (by using IlSpy or a program of the sorts). This might give you a better understanding of how the actual vanilla AIs are handled.
I'd still recommend reading up on C# programming, though ;)
 
How do I make a weapon shoot arrows? (For the useAmmo property). I've tried ProjectileID.Arrow but it says there's no such thing. (In the example mod it has ProjectileID.Bullet).

EDIT: Just did 1 (1 is the proj ID for arrow)
 
Last edited:
How do I add strength to a block? (Requires certain pickaxe power.)
On a ModTile you can use 'minPick' and 'mineResist', where minPick is the minimum pickaxe strength that is required to mine the ModTile and mineResist is the time it takes to mine it (higher value means longer mining time).
 
I saw your planned list : server support. I asked the peps at Tshock slack to try and do a cross integration. (no guarantees though :) )
 
I doubt very well that would happen with TShock.
who knows!
ys9kJy1.png

There proof that I asked for integration
 
Last edited:
Ok. Weird bug. When I enter the world, the mouse, hotbar and inventory don't show up. I press F11, only hides the map. It's really annoying. I've wiped and reinstalled everything, restarted the game. This only happens with tModLoader, not vanilla Terraria. Help!

EDIT: Disabled all my mods, it came back.

EDIT2: When I enabled my mod, it disappeared.

EDIT3: When I loaded all the other mods (ExampleMod) its still there. There must be some weird problem with my mod.
 
Last edited:
Ok. Weird bug. When I enter the world, the mouse, hotbar and inventory don't show up. I press F11, only hides the map. It's really annoying. I've wiped and reinstalled everything, restarted the game. This only happens with tModLoader, not vanilla Terraria. Help!

EDIT: Disabled all my mods, it came back.

EDIT2: When I enabled my mod, it disappeared.

EDIT3: When I loaded all the other mods (ExampleMod) its still there. There must be some weird problem with my mod.
Most likely your code is throwing an exception that causes the update code to terminate early, hence everything disappears. If you can't figure it out after checking the logs, we could help if we see the code.
 
Most likely your code is throwing an exception that causes the update code to terminate early, hence everything disappears. If you can't figure it out after checking the logs, we could help if we see the code.
What code do I show you?
[DOUBLEPOST=1448668910,1448668698][/DOUBLEPOST]
Most likely your code is throwing an exception that causes the update code to terminate early, hence everything disappears. If you can't figure it out after checking the logs, we could help if we see the code.
Yolo. Here's all my code.
[DOUBLEPOST=1448669429][/DOUBLEPOST]
What code do I show you?
[DOUBLEPOST=1448668910,1448668698][/DOUBLEPOST]
Yolo. Here's all my code.
Oh.. my... god... I found it!
I did item.toolTip instead of AddToolTip() and it worked! (Some of my code was copied from the Example Mod!)
Why would that happen @jopojelly ?

EDIT: Wait, no it isn't. It says my mod is enabled, but I can't do anything from my mod. -_-
[DOUBLEPOST=1448669932][/DOUBLEPOST]
What code do I show you?
[DOUBLEPOST=1448668910,1448668698][/DOUBLEPOST]
Yolo. Here's all my code.
[DOUBLEPOST=1448669429][/DOUBLEPOST]
Oh.. my... god... I found it!
I did item.toolTip instead of AddToolTip() and it worked! (Some of my code was copied from the Example Mod!)
Why would that happen @jopojelly ?

EDIT: Wait, no it isn't. It says my mod is enabled, but I can't do anything from my mod. -_-
Got it this time, I think.
[DOUBLEPOST=1448670029][/DOUBLEPOST]Finally, it's all fixed.
 

Attachments

  • TerraMod.zip
    59.7 KB · Views: 131
Are you able to add a world gen task in tModLoader? (Make an ore generate).
There are no world hooks for tModLoader yet.
It would be possible if you were to put (a lot of) time into it, but I'd recommend waiting for the hooks (since those would probably make your life a lot easier).
 
Ok. Thanks.
Sorry for not being able to provide you with a satisfying answer.
I'll give you an example of some code that will (probably, untested) spawn some ore. You could call it when using an item (for testing purposes, of course).
Code:
public void GenOre()
{
    int lx = 200;
    int hx = Main.maxTilesX - 200;
    int ly = (int)Main.worldSurface;
    int hy = Main.maxTilesY - 200;

    int x = WorldGen.genRand.Next(lx, hx);
    int y = WorldGen.genRand.Next(ly, hy);

    int minSpread = 2;
    int maxSpread = 8;

    int minFreq = 6;
    int maxFreq = 8;

    int s = WorldGen.genRand.Next(minSpread, maxSpread + 1);
    int f = WorldGen.genRand.Next(minFreq, maxFreq + 1);

    WorldGen.OreRunner(x, y, s, f, (ushort)mod.TileType("YourOre"));
}
Like stated before, this is untested, so it might not work the way it's supposed to work (and I'm afraid I'm currently not in a setting to test it myself).
I hope it works, though (or that you can build from it at least).
 
Sorry for not being able to provide you with a satisfying answer.
I'll give you an example of some code that will (probably, untested) spawn some ore. You could call it when using an item (for testing purposes, of course).
Code:
public void GenOre()
{
    int lx = 200;
    int hx = Main.maxTilesX - 200;
    int ly = (int)Main.worldSurface;
    int hy = Main.maxTilesY - 200;

    int x = WorldGen.genRand.Next(lx, hx);
    int y = WorldGen.genRand.Next(ly, hy);

    int minSpread = 2;
    int maxSpread = 8;

    int minFreq = 6;
    int maxFreq = 8;

    int s = WorldGen.genRand.Next(minSpread, maxSpread + 1);
    int f = WorldGen.genRand.Next(minFreq, maxFreq + 1);

    WorldGen.OreRunner(x, y, s, f, (ushort)mod.TileType("YourOre"));
}
Like stated before, this is untested, so it might not work the way it's supposed to work (and I'm afraid I'm currently not in a setting to test it myself).
I hope it works, though (or that you can build from it at least).
Thanks. I'll test it.
 
Back
Top Bottom