Bittiez

Member
Bittiez submitted a new resource:

Custom Loot [No core modifications required] - Add your own custom loot to monsters easily, with no modifications to core files required.

What is this?

This is a very simple, easy to use way to add your customized loot to monsters in game.
Why is this different from other loot systems? It requires 0 core modifications, simply drag and drop.

Installation

Drag CustomLoot.cs into your Scripts/Custom/ folder.
Edit CustomLoot.cs with your custom loot.


[COLOR=rgb(251, 160...[/HEADING]​



Read more about this resource...

 
It would be nice if instead of a specific loot, it was a large or small loot like that of a superboss or FilthyRich. To leave it as a special event
 
I have been adding to this script. This script now provides the gold drops based on the creature's HitsMax and also gives a chance at a rare item based on a list inside the script. The list is easy to add any kind of rares you would like to have a chance to drop. I also have mine set to only have a chance to drop if the creature's HitsMax are greater than 100. You will need to remove the gold drop from lootpack.cs file so your players dont get double gold

CustomLoot.cs:
using System;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Mobiles;

namespace Bittiez.CustomLoot
{
    public static class CustomLoot
    {
        // List of rare items
        private static List<Type> rareItems = new List<Type>
        {
            typeof(BraceletOfHealth),
            typeof(PowerScroll),
            typeof(OrnamentOfTheMagician),
            typeof(ArcaneShield),
            // Add more rare items as needed
        };

        public static void Initialize()
        {
            EventSink.CreatureDeath += EventSink_CreatureDeath;
        }

        private static void EventSink_CreatureDeath(CreatureDeathEventArgs e)
        {
            if (e.Creature == null || !(e.Creature is BaseCreature creature))
                return;

            if (e.Corpse is Corpse corpse)
            {
                if (creature.HitsMax >= 20)
                {
                    int goldReward = creature.HitsMax * 2;
                    corpse.AddItem(new Gold(goldReward));
                }
                TryDropRareItem(corpse, creature);
            }
        }

        private static void TryDropRareItem(Corpse corpse, BaseCreature creature)
{

    if (creature.HitsMax > 100)
    {
        double baseDropChance = Math.Min(0.001 * creature.HitsMax, 0.1); // Max 10% chance

        if (Utility.RandomDouble() < baseDropChance)
        {
            Type rareItemType = rareItems[Utility.Random(rareItems.Count)];
            Item rareItem = (Item)Activator.CreateInstance(rareItemType);
            corpse.AddItem(rareItem);

        }
    }
}
    }
}
 

Active Shards

Donations

Total amount
$0.00
Goal
$500.00
Back