Standalone [1.3] tModLoader - A Modding API

How do i fix this(these) error(s)
c:\Users\---------\Documents\My Games\Terraria\ModLoader\Mod Sources\Unknownmod\Items\Amuletofdarkness.cs(9,24) : error CS0115: 'Unknownmod.Items.Amuletofdarkness.SetDefaults()': no suitable method found to override
c:\Users\--------\Documents\My Games\Terraria\ModLoader\Mod Sources\Unknownmod\Items\Amuletofdarkness.cs(23,24) : error CS0115: 'Unknownmod.Items.Amuletofdarkness.CanUseItem(Terraria.Player)': no suitable method found to override
c:\Users\---------\Documents\My Games\Terraria\ModLoader\Mod Sources\Unknownmod\Items\Amuletofdarkness.cs(28,24) : error CS0115: 'Unknownmod.Items.Amuletofdarkness.UseItem(Terraria.Player)': no suitable method found to override
c:\Users\-----------\Documents\My Games\Terraria\ModLoader\Mod Sources\Unknownmod\Items\Amuletofdarkness.cs(34,24) : error CS0115: 'Unknownmod.Items.Amuletofdarkness.AddRecipes()': no suitable method found to override
i have no idea how to make a summoning item for bosses
(name blocked out again for privacy)
[doublepost=1496598633,1496598503][/doublepost]
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Unknownmod.Items
{
public class Amuletofdarkness
{
public override void SetDefaults()
{
item.name = "The Amulet Of Darkness";
item.width = 20;
item.height = 20;
item.macStack = 1;
AddTooltip("It's pulsing dark energy");
item.value = 1;
item.rare - 1;
item.useAnimation = 30;
item.useTime = 30;
itemuseStyle = 4;
item.consumable = true;
}
public override bool CanUseItem(Player player)
{
return !NPC.AnyNPCs(mod.NPCType("theeyesintheshadows"));
return !Main.dayTime;
}
public override bool UseItem(Player player)
{
NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("theeyesintheshadows"));
Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);
return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipes()
recipe.AddIngredient(ItemID.GoldBar, 3);
recipe.AddIngredient(ItemID.IronBar, 2);
recipe.SetResult(this);
recipe.AddRecipe():
}
}
}

i forgot to add the code
You need to add inheritance from the ModItem class like this:
Code:
public class Amuletofdarkness : ModItem
 
You need to add inheritance from the ModItem class like this:
Code:
public class Amuletofdarkness : ModItem
thanks
[doublepost=1496600112,1496599650][/doublepost]
now i'm getting these errors
c:\Users\---------\Documents\My Games\Terraria\ModLoader\Mod Sources\Unknownmod\Items\Amuletofdarkness.cs(17,4) : error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
c:\Users\---------\Documents\My Games\Terraria\ModLoader\Mod Sources\Unknownmod\Items\Amuletofdarkness.cs(26,4) : warning CS0162: Unreachable code detected
c:\Users\---------\Documents\My Games\Terraria\ModLoader\Mod Sources\Unknownmod\Items\Amuletofdarkness.cs(36,39) : error CS1002: ; expected
how do i fix this
 
thanks
[doublepost=1496600112,1496599650][/doublepost]
now i'm getting these errors
c:\Users\---------\Documents\My Games\Terraria\ModLoader\Mod Sources\Unknownmod\Items\Amuletofdarkness.cs(17,4) : error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
c:\Users\---------\Documents\My Games\Terraria\ModLoader\Mod Sources\Unknownmod\Items\Amuletofdarkness.cs(26,4) : warning CS0162: Unreachable code detected
c:\Users\---------\Documents\My Games\Terraria\ModLoader\Mod Sources\Unknownmod\Items\Amuletofdarkness.cs(36,39) : error CS1002: ; expected
how do i fix this
I suggest you to use an IDE like Visual Studio to code so you can easily see these errors, and the errors themselves are quite descrivtive.

Here you wrote a "-" insted of "="
Code:
item.rare - 1;

As you can see in the CanUseItem hook you have two returns, that's not possible because after the first return, the method is exited and so the code after will not be run.
Code:
return !NPC.AnyNPCs(mod.NPCType("theeyesintheshadows"));
return !Main.dayTime;
I think you meant to concatenate the two together and to do that you use the && operator, the code will be like this:
Code:
return !NPC.AnyNPCs(mod.NPCType("theeyesintheshadows")) && !Main.dayTime;

For the third error, as it says you forget a ";" in that determined line in AddRecipes() hook after new ModRecipe()
Code:
ModRecipe recipe = new ModRecipes(); <- here goes the semicolon
Also it is "ModRecipe" and not "ModRecipes"
 
I suggest you to use an IDE like Visual Studio to code so you can easily see these errors, and the errors themselves are quite descrivtive.

Here you wrote a "-" insted of "="
Code:
item.rare - 1;

As you can see in the CanUseItem hook you have two returns, that's not possible because after the first return, the method is exited and so the code after will not be run.
Code:
return !NPC.AnyNPCs(mod.NPCType("theeyesintheshadows"));
return !Main.dayTime;
I think you meant to concatenate the two together and to do that you use the && operator, the code will be like this:
Code:
return !NPC.AnyNPCs(mod.NPCType("theeyesintheshadows")) && !Main.dayTime;

For the third error, as it says you forget a ";" in that determined line in AddRecipes() hook after new ModRecipe()
Code:
ModRecipe recipe = new ModRecipes(); <- here goes the semicolon
Also it is "ModRecipe" and not "ModRecipes"
Thank you for the help!
[doublepost=1496601601,1496601051][/doublepost]
Thank you for the help!
how do i fix this error CS0115: 'Unknownmod.Items.Amuletofdarkness.AddRecipe()': no suitable method found to override
public override void AddRecipe()
Thanks in advance!
also i started trying to make mods again sometime around may 30th so thanks for the help
 
Thank you for the help!
[doublepost=1496601601,1496601051][/doublepost]
how do i fix this error CS0115: 'Unknownmod.Items.Amuletofdarkness.AddRecipe()': no suitable method found to override
public override void AddRecipe()
Thanks in advance!
also i started trying to make mods again sometime around may 30th so thanks for the help
This is why I suggested you to use Visual Studio, because the hook isn't "AddRecipe" but "AddRecipes"

Edit
You should give a read to this thread to get started:
https://forums.terraria.org/index.php?threads/official-tmodloader-help-thread.28901/
 
Hey I'm new to mods and stuff for Terraria and I'm playing on mac. I did everything that it says on the "read this" and i watched some toturials but when I changed my Terraria to the new one (the one with tmodloader) it only opens the normal Terraria is that cuz it is out of date? Ik it says "(Out of date)" but i'm not really sure. If it is that tmodloader is not working on mac I wonder when will the update for mac happen or will it even happen? I really want to test some mods so i hope I am not disturbing anyone, annoying anyone or stressing the dev with these questions... (._.') PS: I'm srry if my grammar sucks anywhere i'm not the writhing type...
 
How do i download the 1.3.4.4 version? i cant really find anything and terraria just keeps crashing after loading mods

i know how to download the 1.3.4.4 version but it involves
hqdefault.jpg





;)




i hope to god that i didnt just screw myself here



i didnt say anything untoward
you know
 
The downgrade to 1.3.4.4 without piracy instructions have been posted in this thread dozens of times. I'm too lazy to go back and find it, but just go through the last 20 pages and you'll find it.




yea we know but




its kinda more simple and you have to understand some folks really prefer simple but meh



which ever one floats ppls sky islands man ;)
 
The downgrade to 1.3.4.4 without piracy instructions have been posted in this thread dozens of times. I'm too lazy to go back and find it, but just go through the last 20 pages and you'll find it.
Yah, i did the zip thing people were talking about, but everytime i try to load mods, it crashes on the last ones with no error message (pic provided)
upload_2017-6-4_19-39-52.png
 
yea we know but




its kinda more simple and you have to understand some folks really prefer simple but meh



which ever one floats ppls sky islands man ;)
I guess all I can say is go read the forum rules.

Yah, i did the zip thing people were talking about, but everytime i try to load mods, it crashes on the last ones with no error message (pic provided) View attachment 172266
Not sure. Come to discord, lots of people can help there.
 
Hey guys. After i installed Tmodloader, when i open Terraria and try to maximize the window it crashes. If i go to video settings and increase the resolusion i can manually expand the window, but to some point of resolusion, it crashes again. Any suggestions or fixed i can apply?
 
Hey guys. After i installed Tmodloader, when i open Terraria and try to maximize the window it crashes. If i go to video settings and increase the resolusion i can manually expand the window, but to some point of resolusion, it crashes again. Any suggestions or fixed i can apply?
probably at the end of the month coding is hard
[doublepost=1496681572,1496681535][/doublepost]
when will 1.3.5 compatibility be released?
I replied to the wrong person
 
Halp. I don't know how to copy and paste crash logs so I just took a picture instead. its in the attached files. What do I do?
 

Attachments

  • error.jpg
    error.jpg
    625.7 KB · Views: 766
Halp. I don't know how to copy and paste crash logs so I just took a picture instead. its in the attached files. What do I do?
when you need pictures of your computer do this
1-your keyboard must have a key "Imprnpaint" the key prints your computer screen.
2-after that open paint.
3-press and hold ctrl+v to paste the image that your computer print right into paint.
4-select the error and save the image as a .jpg file
 
v0.10
-Fixed bug where items can be duplicated in NPC shops
-Fixed bug where prefix effects can be stacked in NPC shops
-A few grass framing fixes
-Fixed a few instances where dropped items lose their ItemInfo
-Improved the performance of recipe groups
-Added ShiftClickSlot hook for ModPlayer
-Modded NPCs no longer need a matching display name
-Modded NPCs now persist when mods are unloaded then reloaded
-Updated to Terraria 1.3.5.2
-Added new ModTranslation system for names and tooltips
-All ID counts are now public
-Fixed bug where unloaded items aren't restored on reloading
-Updated my favorite color
-Built in tModReader functionality to the mods menu
-Renamed ExtraPickupSpace to ItemSpace and fixed a few bugs with it
-Renamed CanSpawn to SpawnChance
-Foolproofed modder errors with spawn weights
-Added PostAddRecipes hook
-RenderTargets are now public
-Greatly improved performance when inventory is closed
-Merged all Infos into Globals and added new global instance system
-Made numerous changes to autoloading
-Added mod-less overload for generic GetGlobals
-Improved performance of PlayerHooks
-Minor bugfixes

Normally I try to write a long message here, but life has been kicking me around really hard and I'm pretty tired, so I'll try to keep this short.

No pre-v0.10 mods will work with v0.10. There has been tons and tons of changes, both in vanilla and in tModLoader. A work-in-progress migration guide for mod authors can be found here: https://docs.google.com/document/d/1GY6Jyj0IkqfvQlXJUwXg60d2V8tIzumoNVgh5OWzGIc/edit?usp=sharing

There will probably be many bugs; please report everything you find.

You will probably still want to play on v0.9.2.3 while you wait for mods to update. Everything you need will be in the old downloads section.

We also have a Patreon now, if you feel like donating: https://www.patreon.com/tModLoader
 
Last edited:
Back
Top Bottom