Standalone [1.3] tModLoader - A Modding API

I've given this a try. Seems easy enough. I tried following your example however, but even your example doesn't work. I've done the steps correctly, but the recipes don't show up in-game. And no, I'm not getting compiling errors either.
 
So, in this API you can connect .json and .cs? Looks conveniently.
 
tell me what i did wrong
I ran the file in the download and got terraria and terraria backup (this was after i put in there vanilla terraria), then i put terraria in my folder where i got terraria. don't currently have any mods installed
 
tell me what i did wrong
I ran the file in the download and got terraria and terraria backup (this was after i put in there vanilla terraria), then i put terraria in my folder where i got terraria. don't currently have any mods installed

What is the problem?
 
tell me what i did wrong
I ran the file in the download and got terraria and terraria backup (this was after i put in there vanilla terraria), then i put terraria in my folder where i got terraria. don't currently have any mods installed
And what is wrong with that?

----------------------------------

Where can i see which methods i can override?
 
Forgot to mention, when i did that it didn't work, steam didn't let me start it and i couldn't start it from the application
 
I managed to get the .dll files and it does actually build my mod now. But now there's some new errors, not my code:
error CS0103: The name 'recipe' does not exist in the current context
error CS0103: The name 'recipe' does not exist in the current context
error CS0103: The name 'recipe' does not exist in the current context
error CS0103: The name 'recipe' does not exist in the current context

Giving it a capital (Recipe) gives these errors:

error CS0117: 'Terraria.Recipe' does not contain a definition for 'AddTile'
error CS0117: 'Terraria.Recipe' does not contain a definition for 'AddIngredient'
error CS0117: 'Terraria.Recipe' does not contain a definition for 'SetResult'
error CS0117: 'Terraria.Recipe' does not contain a definition for 'AddRecipe'

For the .dll files:

Goto: "C:\Windows\Microsoft.NET\assembly\GAC_32"
In there search for the following folders:
"Microsoft.Xna.Framework"
"Microsoft.Xna.Framework.Game"
"Microsoft.Xna.Framework.Graphics"
"Microsoft.Xna.Framework.Xact"

COPY (do not cut/delete it) the .dll file inside each folder to your Terraria folder (C:\Program Files (x86)\Steam\SteamApps\common\Terraria)
 
I managed to get the .dll files and it does actually build my mod now. But now there's some new errors, not my code:
error CS0103: The name 'recipe' does not exist in the current context
error CS0103: The name 'recipe' does not exist in the current context
error CS0103: The name 'recipe' does not exist in the current context
error CS0103: The name 'recipe' does not exist in the current context

Giving it a capital (Recipe) gives these errors:

error CS0117: 'Terraria.Recipe' does not contain a definition for 'AddTile'
error CS0117: 'Terraria.Recipe' does not contain a definition for 'AddIngredient'
error CS0117: 'Terraria.Recipe' does not contain a definition for 'SetResult'
error CS0117: 'Terraria.Recipe' does not contain a definition for 'AddRecipe'

For the .dll files:

Goto: "C:\Windows\Microsoft.NET\assembly\GAC_32"
In there search for the following folders:
"Microsoft.Xna.Framework"
"Microsoft.Xna.Framework.Game"
"Microsoft.Xna.Framework.Graphics"
"Microsoft.Xna.Framework.Xact"

COPY (do not cut/delete it) the .dll file inside each folder to your Terraria folder (C:\Program Files (x86)\Steam\SteamApps\common\Terraria)

Post some source if you need help, but it seems like you didn´t use the Recipe method right.

ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.DirtBlock);
recipe.SetResult(ItemID.LifeCrystal, 15);
recipe.AddRecipe();
 
Post some source if you need help, but it seems like you didn´t use the Recipe method right.

ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.DirtBlock);
recipe.SetResult(ItemID.LifeCrystal, 15);
recipe.AddRecipe();

Oooh, I forgot ModRecipe recipe = new ModRecipe(this);
Guess what happened when I added that... RUNTIME ERROR.
Check the picture.
The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.Load()
at Terraria.ModLoader.ModLoader.Reload()
at Terraria.ModLoader.Interface.AddMenuButtons(Main main, Int32 selectedMenu, String[] buttonNames, Single[] buttonScales, Int32& offY, Int32& spacing, Int32& buttonIndex, Int32& numButtons)
at Terraria.Main.DrawMenu(GameTime gameTime)
at Terraria.Main.do_Draw(GameTime gameTime)
at Terraria.Main.Draw(GameTime gameTime)
Screenshot_1.png
 
Do you have added an Textur.png for your item?
It must be named EXACTLY like the .cs
 
Do you have added an Textur.png for your item?
It must be named EXACTLY like the .cs

Sorry this is the first time I've attempted modding Terraria. I just copied his 'tutorial'.. And it gives me these errors.
I have an image for the sword, but not exactly sure where to put it.
 
Do you have added an Textur.png for your item?
It must be named EXACTLY like the .cs

I can get recipe to work with existing items but not custom items.. they won't show up when crafting.. but custom recipe for existing items do.

Nevermind I got it to work now, I guess I messed up somehow.
 
Woah everyone replied while I was sleeping

When the next update comes out, can i make a template mod for this?
Sure, there isn't anything stopping you from making one.

And what is wrong with that?

----------------------------------

Where can i see which methods i can override?
For now, you can look at the documentation and see which methods are virtual or abstract. Abstract methods must be overridden, and virtual methods can be overridden if you want to.

I managed to get the .dll files and it does actually build my mod now. But now there's some new errors, not my code:
error CS0103: The name 'recipe' does not exist in the current context
error CS0103: The name 'recipe' does not exist in the current context
error CS0103: The name 'recipe' does not exist in the current context
error CS0103: The name 'recipe' does not exist in the current context

Giving it a capital (Recipe) gives these errors:

error CS0117: 'Terraria.Recipe' does not contain a definition for 'AddTile'
error CS0117: 'Terraria.Recipe' does not contain a definition for 'AddIngredient'
error CS0117: 'Terraria.Recipe' does not contain a definition for 'SetResult'
error CS0117: 'Terraria.Recipe' does not contain a definition for 'AddRecipe'

For the .dll files:

Goto: "C:\Windows\Microsoft.NET\assembly\GAC_32"
In there search for the following folders:
"Microsoft.Xna.Framework"
"Microsoft.Xna.Framework.Game"
"Microsoft.Xna.Framework.Graphics"
"Microsoft.Xna.Framework.Xact"

COPY (do not cut/delete it) the .dll file inside each folder to your Terraria folder (C:\Program Files (x86)\Steam\SteamApps\common\Terraria)
For the dll problem, I have it fixed so that it automatically finds the right directories for you in the next version.
For the texture problem, it looks like you've already got it fixed but I'll say it here for everyone else: when you call GetTexture you're essentially passing in the path of the texture as a parameter, starting with the mod's directory and not including the extension. For example, the ExampleMod folder contained all the files in the temporary tutorial, and it also had a folder called Items, which contained ExampleSword.png. So I used "ExampleMod/Items/ExampleSword".
 
Woah everyone replied while I was sleeping


Sure, there isn't anything stopping you from making one.


For now, you can look at the documentation and see which methods are virtual or abstract. Abstract methods must be overridden, and virtual methods can be overridden if you want to.


For the dll problem, I have it fixed so that it automatically finds the right directories for you in the next version.
For the texture problem, it looks like you've already got it fixed but I'll say it here for everyone else: when you call GetTexture you're essentially passing in the path of the texture as a parameter, starting with the mod's directory and not including the extension. For example, the ExampleMod folder contained all the files in the temporary tutorial, and it also had a folder called Items, which contained ExampleSword.png. So I used "ExampleMod/Items/ExampleSword".

So I'm trying to create my own 'soul' as an item.. but it gives me this error.
Screenshot_2.png


My code for GetTexture is valid.. I'm trying .gif it gave me an error.. I tried .png and it gives me an error still..
Now it is simply giving me this:
c:\Users\Daniel\Documents\My Games\Terraria\ModLoader\Mod Sources\ItemOverhaulOverpower\Items\SoulOfPower.cs(17,8) : error CS1061: 'Terraria.Item' does not contain a definition for 'GetTexture' and no extension method 'GetTexture' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

My cs file is there.. I checked code and thats all ok.
'item.GetTexture = "ItemOverhaulOverpower/Items/SoulOfPower";'

(SoulOfPower.gif)
 
Somehow I got it in the game now but it doesn't behave as it should.
 
So I'm trying to create my own 'soul' as an item.. but it gives me this error.
View attachment 61868

My code for GetTexture is valid.. I'm trying .gif it gave me an error.. I tried .png and it gives me an error still..
Now it is simply giving me this:
c:\Users\Daniel\Documents\My Games\Terraria\ModLoader\Mod Sources\ItemOverhaulOverpower\Items\SoulOfPower.cs(17,8) : error CS1061: 'Terraria.Item' does not contain a definition for 'GetTexture' and no extension method 'GetTexture' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

My cs file is there.. I checked code and thats all ok.
'item.GetTexture = "ItemOverhaulOverpower/Items/SoulOfPower";'

(SoulOfPower.gif)
Whoops, I forgot, the GetTexture method isn't actually needed for assigning textures to items. You can give items a texture by passing in the texture name as the third parameter of AddItem, since I call GetTexture for you with that. The GetTexture method is mostly for if people want to do their own custom drawing (for example, skeletron's arms). Also, gif files currently aren't supported by this mod.
I haven't looked into how souls animate yet; I will do that before the next update though.
 
Whoops, I forgot, the GetTexture method isn't actually needed for assigning textures to items. You can give items a texture by passing in the texture name as the third parameter of AddItem, since I call GetTexture for you with that. The GetTexture method is mostly for if people want to do their own custom drawing (for example, skeletron's arms). Also, gif files currently aren't supported by this mod.
I haven't looked into how souls animate yet; I will do that before the next update though.

Please work on gifs. Hehe. I'm working on a mod that allows the player to 'empower' items with souls. So basically if you already have a HM character you can give pre HM gear a boost. This is just an idea I think it is quite fun. Basically a sort of 'enchanthing'
 
Woah everyone replied while I was sleeping


Sure, there isn't anything stopping you from making one.


For now, you can look at the documentation and see which methods are virtual or abstract. Abstract methods must be overridden, and virtual methods can be overridden if you want to.


For the dll problem, I have it fixed so that it automatically finds the right directories for you in the next version.
For the texture problem, it looks like you've already got it fixed but I'll say it here for everyone else: when you call GetTexture you're essentially passing in the path of the texture as a parameter, starting with the mod's directory and not including the extension. For example, the ExampleMod folder contained all the files in the temporary tutorial, and it also had a folder called Items, which contained ExampleSword.png. So I used "ExampleMod/Items/ExampleSword".

Oh ok, now i get it.
In the Documentation is everything that exist, i thought you could make custom enemys atm ^^
 
Back
Top Bottom