Toxic2214

Initiate
ServUO Version
Publish Unknown
Ultima Expansion
Endless Journey
Hey,

hoping someone can assist trying to figure this out, our server uses a fair few custom items. I am trying to make a boss that will drop a item directly into a players backpack on a 20% drop chance.

Currently i have

public override void OnDeath(Container c)
{

base.OnDeath(c);
if( 0.20 > Utility.RandomDouble() ) // 20% Drop Rate
{
switch ( Utility.Random( 2 ))
{
case 0: c.DropItem( new PetBondingPotion() ); break;
case 1: c.DropItem( new PetSlotStatue() ); break;
case 2: c.DropItem( new InstaTameDeed() ); break;
case 3: c.DropItem( new StableSlotIncreaseDeed() ); break;
case 4: c.DropItem( new MarineShroud() ); break;
case 5: c.DropItem( new DiamondChargerDeed() ); break;
}
}
}

But this is obviously for the mostners corpse. How would i be able to ammend this to drop directly into the players backpack? using PUB 54

Thank you in advance.
 
C#:
        public override bool OnBeforeDeath()
        {
            if (LastKiller != null && LastKiller is PlayerMobile pm)
            {
                if (Utility.RandomDouble() < 0.2)
                {
                    pm.AddToBackpack(new Gold(50));
                }
            }

            return base.OnBeforeDeath();
        }
 
Just check for the last killer if a basecreature and then lookup the control master from there. Assuming the first killer check was not a playermobile.
 

Active Shards

Donations

Total amount
$80.00
Goal
$1,000.00
Back