Standalone [1.3] tModLoader - A Modding API

"namesspace"
no SetDefaults method
"recipe.AddTile9TileID.WorkBenches);" -- 9?
"recipe.AddIngredient(ItemID.wood, 30);" -- wood doesn't exist, Wood does
"ModRecipe recipe = new ModRecipe(Mod);" -- Mod is the classname, not instance name, check the docs.
"item.usetime = 40;" -- spelled wrong
"item.useanimation = 20;" -- spelled wrong
"item.usesound = 1;" -- spelled wrong
[doublepost=1463602314,1463602176][/doublepost]
Well, it does exist. This error happens in game? I can't see why this error would happen, unless you didn't install correctly....
Well i understand most of what you said apart from a "no set defaults method" and "mod is class name not instance name"
help would be appreciated
 
Last edited:
Well i understand most of what you said apart from a "no set defaults method" and "mod is class name not instance name"
help would be appreciated
You can't have code in your class that isn't a part of a method. That's not how programming works. Mod is the name of the class. mod is the instance of your class that extends Mod.

Think of it like:
sayHelloTo(TerrariaModder)
rather thatn
sayHelloTo(M3G4)

(so change Mod to mod there.)

Edit: Look at ExampleMod for an item and see how it has a SetDefaults method.
 
Just starting to mess around with tModLoader, is it necessary to have a RecipeHelper class like the one in the ExampleMod or is it just a useful thing to have?
 
Hey guys. I'm trying to change some behaviour of the different tombstones in terraria. But I'm having troubles figuring out how to use GlobalTiles. How do I define a global tile to override the default tombstones? I can't seem to find a good example of a GlobalTile.
 
Hey guys. I'm trying to change some behaviour of the different tombstones in terraria. But I'm having troubles figuring out how to use GlobalTiles. How do I define a global tile to override the default tombstones? I can't seem to find a good example of a GlobalTile.
What are you trying to do? There's a lot going on, so it's not that easy to show all possibilities. And are you sure you aren't talking about the projectile?
 
Hey, hate dirtying up the thread with repeated questions, but do you have any insight into my question here? Any assistance would be immensely helpful as always.

Can you place player variables within your item/buff tooltips...? Like say I made a custom stat within ModPlayer, If I had equipment that increased that stat, could I have a weapons tooltip reflect that on the fly?

Maybe something like, AddTooltip("This item will heal ally life by " 4 + variable); is what I would be looking for?
 
What are you trying to do? There's a lot going on, so it's not that easy to show all possibilities. And are you sure you aren't talking about the projectile?

I'm actually talking about the tombstones that spawn when a player dies. They would be considered a Tile right? I'm trying to add some additional functionality when you right click them
 
Hey, hate dirtying up the thread with repeated questions, but do you have any insight into my question here? Any assistance would be immensely helpful as always.

Can you place player variables within your item/buff tooltips...? Like say I made a custom stat within ModPlayer, If I had equipment that increased that stat, could I have a weapons tooltip reflect that on the fly?

Maybe something like, AddTooltip("This item will heal ally life by " 4 + variable); is what I would be looking for?

You'd need to have a periodic update for the tooltip. I'd use UpdateInventory(), which runs every frame, and just set item.tooltip = "This item will heal ally life by " 4 + variable; in that.
 
Hey, hate dirtying up the thread with repeated questions, but do you have any insight into my question here? Any assistance would be immensely helpful as always.

Can you place player variables within your item/buff tooltips...? Like say I made a custom stat within ModPlayer, If I had equipment that increased that stat, could I have a weapons tooltip reflect that on the fly?

Maybe something like, AddTooltip("This item will heal ally life by " 4 + variable); is what I would be looking for?
For buff tooltips, you can use this: https://github.com/bluemagic123/tMo...void-modifybufftipref-string-tip-ref-int-rare
Item tooltips will become easier either in the next update or the one after (depends on how much gets done before 1.3.1 drops).

How long will it take for Tmod to update to 1.3.1
I'm hoping it will take one or two days. It's fortunate that it didn't come until my summer break started. Only time will tell though.
 
I'm actually talking about the tombstones that spawn when a player dies. They would be considered a Tile right? I'm trying to add some additional functionality when you right click them
I believe it is a projectile until it settles. Anyway, here is a simple example of checking the tile on right click:
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ExampleMod.Tiles
{
    public class AnimatedLoom : GlobalTile
    {
        public override void RightClick(int i, int j, int type)
        {
            if(type == TileID.Tombstones)
            {
                Main.NewText("What do you want on your Tombstone?");
            }
        }
    }
}

If you wanted to do specific things for each type of tombstone, you would check the texture file and Main.tile[i,j].frameX, see other tiles for some of that math.
 
You can't have code in your class that isn't a part of a method. That's not how programming works. Mod is the name of the class. mod is the instance of your class that extends Mod.

Think of it like:
sayHelloTo(TerrariaModder)
rather thatn
sayHelloTo(M3G4)

(so change Mod to mod there.)

Edit: Look at ExampleMod for an item and see how it has a SetDefaults method.
Heyy hello i have a question..
what do u use for spriting??
 
How do I create a walking minion that shoots projectiles in an arc, kinda like the pygmys? The issue with cloning them is the projectile and sheet.
 
I believe it is a projectile until it settles. Anyway, here is a simple example of checking the tile on right click:
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ExampleMod.Tiles
{
    public class AnimatedLoom : GlobalTile
    {
        public override void RightClick(int i, int j, int type)
        {
            if(type == TileID.Tombstones)
            {
                Main.NewText("What do you want on your Tombstone?");
            }
        }
    }
}

If you wanted to do specific things for each type of tombstone, you would check the texture file and Main.tile[i,j].frameX, see other tiles for some of that math.

Ah that makes a bit more sense. So Global Tile functions are called for every tile. I thought when you made a Global Tile you associated it to a specific tile. Well this might not be what I want then. I don't suppose I could also modify that tombstone projectile?

This might not be what I want to use then, I'm trying to take the player's inventory list and store it in the tombstone that gets generated, so that when that player right clicks it, it instantly reapplies that player's inventory to them (instead of you know, scattering it across the ground randomely).

I've figured out how to parse through the players inventory on death and read what's in it, but now I'm just trying to figure out how to modify the tombstone that gets created to store this info. Is there a better way to go about doing this?
 
System.DllNotFoundException: Unable to load DLL 'CSteamworks': 지정된 모듈을 찾을 수 없습니다. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args)
my crash
what happened?
[doublepost=1463664415,1463664096][/doublepost]2016-05-19 오후 10:14:47
System.DllNotFoundException: Unable to load DLL 'CSteamworks': 지정된 모듈을 찾을 수 없습니다. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args)
 
Is there any way to get player speed? I can find it in proyectiles but not in players.
Thanks

Found it: player.velocity (Instead of speed)
 
Last edited:
Back
Top Bottom