tModLoader Modding Inquiry

thoense

Terrarian
So I am a novice coder in JavaScript, and I'm trying to pick up on C#, since I'm not too fond of JS. I have been browsing around and I cannot find whether or not it is possible to anchor two maps together, or somehow create a pocket of space that is inaccessible from the normal map without the means I want to create. I have a feeling I overlooked a thread or something and that it is not possible due to some hard coding.
 
I don't want to sound too defeatist, but if you are a novice coder, I wouldn't attempt anything like that, since there are hundreds of other things you'll have to get right to get it to work.

Fyi, I did this test a few months back, but it is absolutely not safe for multiplayer:

It is an alternate dimension map generated on the fly:
 
I don't want to sound too defeatist, but if you are a novice coder, I wouldn't attempt anything like that, since there are hundreds of other things you'll have to get right to get it to work.

Fyi, I did this test a few months back, but it is absolutely not safe for multiplayer:

It is an alternate dimension map generated on the fly

The difficulty is no problem, I just wanted to clear up whether it was possible or not, and you answered that for me, so thank you. Is there a way to make this multiplayer safe at all? Guess I better get to work if I want to figure this out... Any tips you can toss me would also be greatly appreciated.
 
The difficulty is no problem, I just wanted to clear up whether it was possible or not, and you answered that for me, so thank you. Is there a way to make this multiplayer safe at all? Guess I better get to work if I want to figure this out... Any tips you can toss me would also be greatly appreciated.
ummm, let's just say I have plans, but we need a new tmodloader first. Also, I'm wary to encourage anyone to attempt this, since if such a mod is released, chances are everyone would lose their world files.
 
ummm, let's just say I have plans, but we need a new tmodloader first. Also, I'm wary to encourage anyone to attempt this, since if such a mod is released, chances are everyone would lose their world files.

Alright, thanks for the warning. I will take a different route to accomplish what I am looking to do.
 
Another question. Is there a way to look into Terraria's already coded items? I looked around for it but I failed to locate it.
 
Another question. Is there a way to look into Terraria's already coded items? I looked around for it but I failed to locate it.
If you have decompiled Terraria, code is all over the place. Item.cs has the setdefaults and some other things. Player.cs has the accessory and armor effects I think. Usually you just want to search the whole project for the itemid to see all the places in code the item does things.
 
If you have decompiled Terraria, code is all over the place. Item.cs has the setdefaults and some other things. Player.cs has the accessory and armor effects I think. Usually you just want to search the whole project for the itemid to see all the places in code the item does things.

Awesome, thanks. I knew I had to of missed something. Not sure why decompiling slipped my mind though...
 
Having a bit of trouble getting a custom ore to drop. It generates at world creation just fine, but upon mining it, it doesn't yield any ore. Any suggestions or help is appreciated.
 
Having a bit of trouble getting a custom ore to drop. It generates at world creation just fine, but upon mining it, it doesn't yield any ore. Any suggestions or help is appreciated.
You have this in the ModTile's SetDefaults??

drop = mod.ItemType("ExampleBlock");
 
You have this in the ModTile's SetDefaults??

drop = mod.ItemType("ExampleBlock");

Thank you. I had drop = mod.ItemType("Bauxite Block");. You've been a huge help, keep it up. Now to get this to sound like you're mining ore and not dirt...
 
Sorry to keep bothering, but I have a more advanced question. I want to make a custom ore produce a few custom items by using a custom workbench. I understand I can use multiple items to create one item, but I want the opposite of that. I took a look into the Extractinator's code, but I failed to see a solution of to what I am trying to do.

Anyone can chime in on this, not just jopojelly, lol.
 
Sorry to keep bothering, but I have a more advanced question. I want to make a custom ore produce a few custom items by using a custom workbench. I understand I can use multiple items to create one item, but I want the opposite of that. I took a look into the Extractinator's code, but I failed to see a solution of to what I am trying to do.

Anyone can chime in on this, not just jopojelly, lol.
Recipes only have one result, but you can use the OnCraft to create other things if you'd like. player.QuickSpawnItem.
 
Recipes only have one result, but you can use the OnCraft to create other things if you'd like. player.QuickSpawnItem.

public virtual void OnCraft(Recipe recipe)
{
player.QuickSpawnItem(ModLoader.GetMod("TestMod").ItemType("GalliumSalt"));
}
"The name 'player' does not exist in the current context."

I know I am still learning, but I just don't see the problem.
 
override. Anyway, since the method doesn't pass in a Player, you can get the current player with Main.player[Main.myPlayer]
 
override. Anyway, since the method doesn't pass in a Player, you can get the current player with Main.player[Main.myPlayer]

Thanks for that fix the other day. I'm working on getting a debuff to work to my liking. I looked at the ExampleWeapon code and it's set up the same for the most part. When I attack, the chance seems to 100% to apply while doing 1 poison a second. Is there a way to alter the chance to apply and how much damage per second it can do? Below is the code:

public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Poisoned, 60); <--not sure what the 60 means
}
 
Thanks for that fix the other day. I'm working on getting a debuff to work to my liking. I looked at the ExampleWeapon code and it's set up the same for the most part. When I attack, the chance seems to 100% to apply while doing 1 poison a second. Is there a way to alter the chance to apply and how much damage per second it can do? Below is the code:

public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Poisoned, 60); <--not sure what the 60 means
}
60 is the number of frames the debuff should persist, so 1 second. If you want the poisoned debuff to do more damage, then it's not the poisoned debuff anymore, you get what I'm saying? You'll have to make your own debuff if you want a more damaging "poisoned" debuff
 
60 is the number of frames the debuff should persist, so 1 second. If you want the poisoned debuff to do more damage, then it's not the poisoned debuff anymore, you get what I'm saying? You'll have to make your own debuff if you want a more damaging "poisoned" debuff

I see, so the damage of the debuff itself is hard coded? Is it possible to change the apply chance per hit or is that also hard coded?
 
I see, so the damage of the debuff itself is hard coded? Is it possible to change the apply chance per hit or is that also hard coded?
Yeah, just surround it by an if statement:
if (Main.rand.Next(3) == 0)
{
target.AddBuff(BuffID.Poisoned, 60);
}
 
Not sure if this is a bug or not, but when I make the Martian Work Bench the required crafting station to craft items, the game no longer loads my UI, forcing me to Alt+F4. Changing it back to the regular Work Bench returns my UI to normal.
 
Back
Top Bottom