Insert Coin

Member
Hello guys!
Im looking to do some drops doing in players backpack,not in corpse,so i ask here for the best way to do that,i see the script of the fleshrenderer on Doom as example,i see this code:

Code:
public override void OnDeath(Container c)
        {

            List<DamageStore> rights = GetLootingRights();

            int top = 0;
            Item blood = null;

            foreach (Mobile m in rights.Select(x => x.m_Mobile).Distinct().Take(3))
            {
                if (top == 0)
                    blood = new BloodOfTheDarkFather(5);
                else if (top == 1)
                    blood = new BloodOfTheDarkFather(3);
                else if (top == 2)
                    blood = new BloodOfTheDarkFather(2);

                top++;

                if (m.Backpack == null || !m.Backpack.TryDropItem(m, blood, false))
                {
                    m.BankBox.DropItem(blood);
                }
            }

            base.OnDeath(c);
        }

        public static Mobile FindRandomPlayer(BaseCreature creature)
        {
            List<DamageStore> rights = creature.GetLootingRights();

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = rights[i];

                if (!ds.m_HasRight)
                    rights.RemoveAt(i);
            }

            if (rights.Count > 0)
                return rights[Utility.Random(rights.Count)].m_Mobile;

            return null;
        }

This is all i need to do that?Thank you!
 
after you make it constructable and set hits ect just add lines like
AddItem( new PlateChest() );
AddItem( new PlateArms() );
AddItem( new PlateGloves() );
AddItem( new PlateLegs() );

it is usualy way up by the top and not under ondeath, but these items will be stealable
 
You'd be better off overriding OnKilledBy instead of OnDeath for this.
Code:
public override void OnKilledBy( Mobile mob )
{
    if ( mob.Player )
    {
        mob.AddToBackpack( new Longsword() );
    }

    base.OnKilledBy( mob );
}
 
You'd be better off overriding OnKilledBy instead of OnDeath for this.
Code:
public override void OnKilledBy( Mobile mob )
{
    if ( mob.Player )
    {
        mob.AddToBackpack( new Longsword() );
    }

    base.OnKilledBy( mob );
}
Thank you so much,testing it.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back