tModLoader How to set up your mod using Visual Studio (MVS)

Hey @Gorateron I get this error whenever I try to build my mod

error CS1061: 'Terraria.ModLoader.ModRecipe' does not contain a definition for 'ModRecipe' and no extension method 'ModRecipe' accepting a first argument of type 'Terraria.ModLoader.ModRecipe' could be found (are you missing a using directive or an assembly reference?)

could you tell me how to fix this please?

Edit: Never mind I figured it out.
 
Last edited:
On my computer there is nothing called a blank project, just silver light and WPF
Check which version you are using and then search Google where it is located for your version, it seems to be different depending on your version of MVS.
 
Check which version you are using and then search Google where it is located for your version, it seems to be different depending on your version of MVS.
I'm using visual studio community 2015, and also it's called visual studio blend on my computer, could that mean anything
 
I have updated this thread on 16-10-2015
I hope the thread is more clear now. I will not create pictures as I think all this will do is clutter the thread which is not neccesary (the text should be enough!)
If you still have any questions about setting up a mod using MVS then feel free to ask me here!
 
I have updated this thread on 16-10-2015
I hope the thread is more clear now. I will not create pictures as I think all this will do is clutter the thread which is not neccesary (the text should be enough!)
If you still have any questions about setting up a mod using MVS then feel free to ask me here!
Looks neat and well explained. Great work (and hopefully everyone will start using VS for modding)!
 
I'm using visual studio community 2015, and also it's called visual studio blend on my computer, could that mean anything
Blend is the (or a?) UI designer for VS. It used to be a separate program but it's been rolled into VS. Its name and capabilities have changed significantly over the years.
 
I'm glad to see this still helps people. I just changed a little sentence. If it's still unclear: what is documented in OP demonstrates how to create a single solution file to hold all of your mods, if you were to create solutions for mods seperately you follow the same process but: select Mod Sources as it's location, make the name what you want the name to be internally and check the option for it to create a Solution folder. (this will be the folder inside Mod Sources that holds the mod)
 
Question: can i make a mod that alters all the vanilla items damage using a variable or i need to make some changes on tModLoader itself?
 
Yes you can, using the GlobalItem class and the public virtual void SetDefaults(Item item) hook. If you want to change all of them, you'd need to loop through all items.
Here's GlobalItem from the wiki: https://github.com/bluemagic123/tModLoader/wiki/GlobalItem

but in this case could I add another variable to the class Item.cs to maintain the original value? i want to do something like this:

Code:
item.originalDamage= 35; // that variable doesn't exist on Item.cs
item.modifier = 5; // that variable doesn't exist on Item.cs
item.damage = 40;
 
but in this case could I add another variable to the class Item.cs to maintain the original value? i want to do something like this:

Code:
item.originalDamage= 35; // that variable doesn't exist on Item.cs
item.modifier = 5; // that variable doesn't exist on Item.cs
item.damage = 40;
Unfortunately, that wouldn't be possible without editing src.
 
but in this case could I add another variable to the class Item.cs to maintain the original value? i want to do something like this:

Code:
item.originalDamage= 35; // that variable doesn't exist on Item.cs
item.modifier = 5; // that variable doesn't exist on Item.cs
item.damage = 40;
You can do an iteminfo. It also looks like you'd want to use the modify damage hooks, but maybe that was just an example
 
Back
Top Bottom