tModLoader How do I make a modded item drop from a vanilla loot bag/item?

jaractus

Ice Queen
Hi, I'm working on a Terraria Mod, and I have noo clue how to make a modded item drop from a loot bag/item.

Please help. Thanks!
 
Hi, I'm working on a Terraria Mod, and I have noo clue how to make a modded item drop from a loot bag/item.

Please help. Thanks!
Never mind you just have to make another .cs file with this code:
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ModName
{
    public class BossBags : GlobalItem
    {
        public override void OpenVanillaBag(string context, Player player, int arg)
        {
            if (context == "bossbag" && arg == ItemID.AnyBossBag)
            {
                player.QuickSpawnItem(mod.ItemType("ItemFileName"), Main.rand.Next(768, 781));
            }
        }
    }
}
 
Never mind you just have to make another .cs file with this code:
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ModName
{
    public class BossBags : GlobalItem
    {
        public override void OpenVanillaBag(string context, Player player, int arg)
        {
            if (context == "bossbag" && arg == ItemID.AnyBossBag)
            {
                player.QuickSpawnItem(mod.ItemType("ItemFileName"), Main.rand.Next(768, 781));
            }
        }
    }
}
What do I replace AnyBossBag with if I want my item to drop from Duke Fishron
What do I name the file and where do I put it?
 
What do I replace AnyBossBag with if I want my item to drop from Duke Fishron
What do I name the file and where do I put it?
For the Duke Fishron Bag, replace AnyBossBag with FishronBossBag for it to drop from that.
The file can be named anything as long as it is a .cs file, and it can be put anywhere in the mod folder, as long as it is in the mod folder.

Quick note: in the Main.rand.Next(768, 781)); doesn't matter, you can replace that/remove that, if you want to/in case you didn't know that.
 
Back
Top Bottom