using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameContent.ItemDropRules;
public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot)
{
if (npc.type == NPCID.GreenSlime)
{
npcLoot.Add(ItemDropRule.Common(Mod.Find<ModItem>("NAMEOFITEM").Type, 1)); // if you want to have a drop chance make it .Type, 2)); this one is 1 out of 2 chance you can change it to what you want
}
}
That's strange, did you delete your namespace by chance? Because with the code I sent with it being blue slime worked for me yesterdayI did that, but as soon as I changed the drop to the blue slime, this error showed.
The problem is that you should have it formatted like this npcLoot.Add(ItemDropRule.Common(Mod.Find<ModItem>("RustedPlate").Type, 1)); You just set what ever is inside of the parenthesis and quotes to the file name and will find it without needing items.material.etcusing System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameContent.Bestiary;
using Terraria.GameContent.ItemDropRules;
namespace beyondtheshadows.Items.Materials
{
public class BossBagLoot : GlobalNPC
{
public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot)
{
if (npc.type == NPCID.BlueSlime)
{
npcLoot.Add(ItemDropRule.Common(Mod.Find<Items.MachineMaterials.PlatePiece>("Rusted Plate").Type, 1));
}
}
}
}
You don't make it the display name you make it the file name "PlatePiece"btw this is my code for my item
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace beyondtheshadows.Items.MachineMaterials
{
public class PlatePiece : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("RustedPlate");
Tooltip.SetDefault("I wonder what this does?");
}
public override void SetDefaults()
{
Item.width = 20;
Item.height = 20;
Item.maxStack = 999;
Item.rare = ItemRarityID.Orange;
}
}
}
I'm not sure if this still works but you can tryAny chance you know how to make it dropfrom a boss bag?
public override void OpenVanillaBag(string context, Player player, int arg)
{
if (context == "bossBag" && arg == ItemID.EaterOfWorldsBossBag)
{
player.QuickSpawnItem(ItemType<PUTITEMNAMEHERE>(), Main.rand.Next(1, 1));
}
}
using beyondtheshadows.Items.Materials
public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot)
{
if(npc.netID == NPCID.GreenSlime || npc.netID == NPCID.BlueSlime)
{
npcLoot.Add(ItemDropRule.Common(ModContent.ItemType<PlatePiece>(), 2, 2, 5));
}
}