Standalone [1.3] tModLoader - A Modding API

That appears to be the same, but quick question, does the max/min stuff at the top confine it between certain X and Y values?

On a side note, how do I get custom boss music to work?
hey Iriazul, new question, how do you edit the drops of an existing boss, i want to add in the "OneRing" item as a drop from Golem(vanilla boss id 249), an ideas?
 
hey Iriazul, new question, how do you edit the drops of an existing boss, i want to add in the "OneRing" item as a drop from Golem(vanilla boss id 249), an ideas?
You'll want to use the GlobalNPC class for that. Ex:
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace MyMod.NPCs
{
    public class MyGlobalNPC : GlobalNPC
    {
        public override void NPCLoot(NPC npc)
        {
            if(npc.type == NPCID.Golem)
            {
                 // Drop your item here.
            }
        }
    }
}
 
IT DIDNT WORK!!!!!
:'(
[doublepost=1465779018,1465778948][/doublepost]
Everytime i have to download Tmodloader again and again because i can only play it once then when i try to play a second time it says:


System.DllNotFoundException: Unable to load DLL 'CSteamworks': The specified module could not be found. (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)



WHAT SHOULD I DO!!!!!!

IT DIDNT WORK :'(
 
so i want to add it into Golems Drop table, he has 8 items, each with a 12.5% chance of dropping, how do i make all those items,Stynger,Possessed Hatchet,Sun Stone,Eye of the Golem,Picksaw, Heat Ray,Staff of Earth, Golem Fist, and my item OneRing, all have an 11% drop rate
For that you'll want to override all vanilla dropping and use PreNPCLoot instead. Ex:
Code:
public override bool PreNPCLoot(NPC npc)
{
    int rand = Main.rand.Next(0, 9);

    if(rand == 0)
        // Drop item 1
    else if (rand == 1)
        // Drop item 2
    // Etc etc, untill you reach 8, where you drop your own item.

    return false;
}
 
Trying to repair this:

System.DllNotFoundException: Unable to load DLL 'CSteamworks': The specified module could not be found. (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)
 
For that you'll want to override all vanilla dropping and use PreNPCLoot instead. Ex:
Code:
public override bool PreNPCLoot(NPC npc)
{
    int rand = Main.rand.Next(0, 9);

    if(rand == 0)
        // Drop item 1
    else if (rand == 1)
        // Drop item 2
    // Etc etc, untill you reach 8, where you drop your own item.

    return false;
}
what do you mean "drop item 1" what do i put
 
what do you mean "drop item 1" what do i put
Use the Item.NewItem function.
Trying to repair this:

System.DllNotFoundException: Unable to load DLL 'CSteamworks': The specified module could not be found. (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)
Could you give some more details. Which OS are you running, which tModLoader version, etc?
 
Alright, thanks, it spawns now, but at a ridiculous rarity. After shredding up a small world with the drill mount, I found one vein of ore. I killed the boss about 20+ times, but my guess would be it is only spawning one vein per kill, judging from the rarity.
The code you got there will only spawn 1 patch. You have to randomize within the loop.
 
Since I'm not too sure how to do that, could I just run SpawnOre(); multiple times instead?
No, this was totally my bad. Change the function like so:
Code:
private void SpawnOre()
{
    int minX = 200;
    int maxX = Main.maxTilesX - 200;
    int minY = (int)Main.worldSurface;
    int maxY = Main.maxTilesY - 200;

    int minSpread = 2;
    int maxSpread = 8;

    int minFreq = 6;
    int maxFreq = 8;

    for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++)
    {
        int x = WorldGen.genRand.Next(minX, maxX);
        int y = WorldGen.genRand.Next(minY, maxY);

        int s = WorldGen.genRand.Next(minSpread, maxSpread + 1);
        int f = WorldGen.genRand.Next(minFreq, maxFreq + 1);

        WorldGen.OreRunner(x, y, s, f, (ushort)mod.TileType("OreName"));
    }
}
 
OK, now I have a new problem: I can access the Main.playerDrawInfo information for my armor, but changing it doesn't do anything. Where would I have to edit the information so that it occurs pre-draw?
Can I please have an answer on this? I've seen a few different things in the documentation, and I have a feeling that I may have to do this from ModPlayer instead of ModItem, but I'm really not sure!
 
ima be honest with you, ive been programming since last friday, so about a week, can you give me one item set up and ill go from there
Code:
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, TheTypeOfTheItemYouWantToDrop);
 
Back
Top Bottom