Standalone [1.3] tModLoader - A Modding API

How can you make worldgen do different things depending on world sizes?
You can check Main.maxTilesX or Main.maxTilesY. Usually you'd want to use those value and multiply it by a really small number and use that number in a for loop.

For example, the number of marble biomes is decided like this:

float scale = Main.maxTilesX * Main.maxTilesY / 5040000f;
int targetMarbleBiomeCound = (int)(WorldGen.genRand.Next(10, 15) * scale);
for loop from 0 to targetMarbleBiomeCound here

Basically, since we scale by the product of X and Y, marble biomes should always be pretty evenly distributed regardless of X or Y. The 10,15 thing is just some random variation.
 
hey i downloaded this mod and it removed all my characters and worlds?? i tried to delete the folder and it keeps popping back up in my folder? please help
 
everytime i open the mod browser, my game shuts down, can someone help?
Does it say anything? Can you check your logs, they are in %UserProfile%\Documents\My Games\Terraria\ModLoader\Logs for Windows.
i followed the guide and tried it again but same thing happened? oh well ill just start from scratch
Did you move your stuff to the cloud? Then you need to go back to vanilla and take it off the cloud
 
How to make an NPC change its display name while it is active? In the Calamity Mod, the Polterghast boss changes its display name when it has less than 50% life.
 
Hey.
Well, I made a swimming enemy that is supposed to act the same as the shark ('cause it has the same AI) but it doesn't: unlike the shark, this one just swims near the ground, it doesn't swim freely like the shark. What do I have to change to make it swim like the shark?
Yeah, I said "shark" too many times.
I have a problem with a mimic-type enemy, too. It doesn't appear like it should, It appears in parts. The amount of frames is 6 and the NPC's measures are 32x46px, like a mimic should have (I think).
i6tiQbJATKye5MbO6VnjYw.png

Sorry for my bad english, btw...
 
Last edited:
How to make an NPC change its display name while it is active? In the Calamity Mod, the Polterghast boss changes its display name when it has less than 50% life.
Pretty sure you can change npc.givenName or something like that

Hey.
Well, I made a swimming enemy that is supposed to act the same as the shark ('cause it has the same AI) but it doesn't: unlike the shark, this one just swims near the ground, it doesn't swim freely like the shark. What do I have to change to make it swim like the shark?
Yeah, I said "shark" too many times.
I have a problem with a mimic-type enemy, too. It doesn't appear like it should, It appears in parts. The amount of frames is 6 and the NPC's measures are 32x46px, like a mimic should have (I think).
i6tiQbJATKye5MbO6VnjYw.png

Sorry for my bad english, btw...
How did you copy the AI? Don't copy it if you don't intend on changing it, set the aiStyle, and aiType to the ID of shark then it will mimic it.
 
Pretty sure you can change npc.givenName or something like that


How did you copy the AI? Don't copy it if you don't intend on changing it, set the aiStyle, and aiType to the ID of shark then it will mimic it.
I only changed the stats (I mean, life points and others) and the aiStyle and aiType both have the Shark ID (I think)
FGXgJkylSzSQlPsowYJ1kQ.png
Is that ok?
And the mimic, is it ok too?
wxZc-4nwS7OZYZxuKigU6Q.png
 
Last edited:
plz help i had a crash saying
c:\Users\xXSol_000\Documents\My Games\Terraria\ModLoader\Mod Sources\Kage_no_mori\Items\Weapons\Seiji_sutaffu_Obu_kitsune.cs(41,70) : error CS0246: The type or namespace name 'IList' could not be found (are you missing a using directive or an assembly reference?)

plz help me thx
 
Hey I was working on a project and I currently don't have access to Terraria.
So I was wondering since with every boss when it spawns naturally the game says
"[boss name] has awakened" so if I used this code to modify the name of a boss:
public class MyGlobalNPC : GlobalNPC
{
public override void SetDefaults(NPC npc)
{
if (Name == "bossname")
{
Name = "newbossname";​
}​
}​
}
Will it automatically update the "[bossname] has awakened" to "newbossname has awakened"?
 
plz help i had a crash saying
c:\Users\xXSol_000\Documents\My Games\Terraria\ModLoader\Mod Sources\Kage_no_mori\Items\Weapons\Seiji_sutaffu_Obu_kitsune.cs(41,70) : error CS0246: The type or namespace name 'IList' could not be found (are you missing a using directive or an assembly reference?)

plz help me thx
You are missing a using directive (as it says, read the error)
Add using System.Collections.Generic;

Hey I was working on a project and I currently don't have access to Terraria.
So I was wondering since with every boss when it spawns naturally the game says
"[boss name] has awakened" so if I used this code to modify the name of a boss:
public class MyGlobalNPC : GlobalNPC
{
public override void SetDefaults(NPC npc)
{
if (Name == "bossname")
{
Name = "newbossname";​
}​
}​
}
Will it automatically update the "[bossname] has awakened" to "newbossname has awakened"?
You don't change the name like that, but yes in theory it would change the text unless those lines are hardcoded in translation files (which they might actually be)
[doublepost=1508674149,1508674063][/doublepost]
I only changed the stats (I mean, life points and others) and the aiStyle and aiType both have the Shark ID (I think)
FGXgJkylSzSQlPsowYJ1kQ.png
Is that ok?
And the mimic, is it ok too?
wxZc-4nwS7OZYZxuKigU6Q.png
First of all, the hell are you thinking with the editor looking like that, smh
Second of all, you don't set Main.npcFrameCount in SetDefaults, but in SetStaticDefaults because it is a static collection.
Last but not least, setting those ai fields looks fine
 
So this seems to now be a big problem that keeps happening all of the sudden...

Everyone knows that Calamity is a big mod, so is Thorium, plus Sacred Tools, right?
Well those are the only mods ive been using and i have lost 2 characters to a random Tmodloader thing.
The first was in rev mode and i just got into hardmode. Closed my game so the Memory wouldent cause a big problem, safely closed it though the game menus.
Then boom, game acts like the config.json file was deleted, starting up in windowed mode, asking which language, etc... my keybindings were the same though.
When i joined as that character, i saw no custom ore. Which makes progressing impossible.
I was pissed when this happen but got over it and tried again.
This time it just happened, but my character got corrupted too, and i was making good progress.
 
Back
Top Bottom