Standalone [1.3] tModLoader - A Modding API

Is the 6 element shield supposed to do anything?And how did you port the abomination from this release.
It doesn't do anything yet other than having a very cool animation. One of its tooltips says "WIP - need to add player support first" or something along those lines.
I ported the Abomination by copying over the hooks from my tAPI mod then renaming the hooks to the proper tModLoader names and method signatures.
 
Any idea how one would go about removing a drop from a vanilla NPC without completely disabling drops for them? I primarily need it for a few bosses but I will probably also have to modify some common NPCs too.
 
That's exactly what I needed! Thanks!
Do you know of a way to remove a vanilla recipe too?
In order to do that you'll have to do a bit of dirty work. First you'll need to iterate through Main.recipe until you find the one you're looking for by checking the recipe's result and ingredients. Then, you'll need to set the recipe at that index to the recipe in the next index, and continue to do this until you reach the final index, which you will simply set to a new Recipe. Finally, you'll have to decrement Recipe.numRecipes by 1.

If you don't want to program all that yourself, @Gorateron made a dll file that you can reference that can do that for you here:
http://forums.terraria.org/index.php?threads/tmodloader-code-examples-handy-code-snippets.28901/
 
In order to do that you'll have to do a bit of dirty work. First you'll need to iterate through Main.recipe until you find the one you're looking for by checking the recipe's result and ingredients. Then, you'll need to set the recipe at that index to the recipe in the next index, and continue to do this until you reach the final index, which you will simply set to a new Recipe. Finally, you'll have to decrement Recipe.numRecipes by 1.

If you don't want to program all that yourself, @Gorateron made a dll file that you can reference that can do that for you here:
http://forums.terraria.org/index.php?threads/tmodloader-code-examples-handy-code-snippets.28901/
Ok, thanks!
 
I have this problem where I cannot open tModLoader.
It always says; "Unable to load CSteamworks.dll - The specified file cannot be found"
Please help - I worked so long on the textures and I don't want them to go to waste!
 
I have this problem where I cannot open tModLoader.
It always says; "Unable to load CSteamworks.dll - The specified file cannot be found"
Please help - I worked so long on the textures and I don't want them to go to waste!
You made sure to copy the modded Terraria.exe back to the folder where you got the original exe from, then run it from there, right?
 
You made sure to copy the modded Terraria.exe back to the folder where you got the original exe from, then run it from there, right?


Actually - it keeps getting stuck at "Resetting game objects" and quits out. I did what you said and everything worked up till there.
[DOUBLEPOST=1440538251,1440537733][/DOUBLEPOST]My items can't be crafted for some reason.
 
So I have been trying to get blockLoot to work but everything I have tried seems get errors regarding it being read only, or incorrect types, or stuff like that. It doesn't surprise me though considering most of my programming experience is in plain C, not C#. If I saw some example code how to properly use the NPCLoader.blockLoot, I am sure it would help me understand things well enough to finished my drop-handler for my mod. Would someone be willing to do so?
 
So I have been trying to get blockLoot to work but everything I have tried seems get errors regarding it being read only, or incorrect types, or stuff like that. It doesn't surprise me though considering most of my programming experience is in plain C, not C#. If I saw some example code how to properly use the NPCLoader.blockLoot, I am sure it would help me understand things well enough to finished my drop-handler for my mod. Would someone be willing to do so?
All you need to do is add the type of the item to blockLoot. Can I see the code you're trying to use?
 
All you need to do is add the type of the item to blockLoot. Can I see the code you're trying to use?
Sorry, I was too busy face palming for forgetting the brackets. I got it working, though I think that I died on the inside a little bit (metaphorically).
 
Wait, now none of his items are dropping at all. The other enemies still have normal loot though.
Here's the test code I was using. Tell me where I goofed.

public override bool PreNPCLoot(NPC npc)
{
if(npc.type==NPCID.EyeofCthulhu)
{
NPCLoader.blockLoot[0]=ItemID.DemoniteOre;
}
return true;
}
 
Wait, now none of his items are dropping at all. The other enemies still have normal loot though.
Here's the test code I was using. Tell me where I goofed.

public override bool PreNPCLoot(NPC npc)
{
if(npc.type==NPCID.EyeofCthulhu)
{
NPCLoader.blockLoot[0]=ItemID.DemoniteOre;
}
return true;
}
It looks like the problem is that an ArrayIndexOutOfBoundsException is causing the entire NPCLoot to end. You're setting the first index of a list with size 0. What you want to do is add the item's ID, not set an index in the list to the ID. So for example, like "NPCLoader.blockLoot.Add(ItemID.DemoniteOre);".
 
Screen Shot 2015-08-25 at 7.55.28 PM.png

I cry everytime.
AI 19 is a spear, right?
 
Back
Top Bottom