RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Lootpack broken

woody_paine

Sorceror
I added a global loot drop to my basecreature.cs and it works great only problem is lootpacks are no longer working and I only get creature specific items and gold drops now. How do i get lootpacks working again?

public override bool OnBeforeDeath()
{
{
Mobile m = this.LastKiller;
switch (Utility.Random(100))
{
case 0: m.AddToBackpack(new SkillBall(1)); m.SendMessage (" You have captured
a fragment of this creature's soul "); break;
}

return base.OnBeforeDeath();
}
 

woody_paine

Sorceror
Code:
public override bool OnBeforeDeath()
        {
            {
            Mobile m = this.LastKiller;
            switch (Utility.Random(100))
            {   
                case 0: m.AddToBackpack(new SkillBall(1)); m.SendMessage (" You have captured a fragment of this creature's soul "); break;
            }
 
        return base.OnBeforeDeath();
            }
 
            int treasureLevel = TreasureMapLevel;
 
            if ( treasureLevel == 1 && this.Map == Map.Trammel && TreasureMap.IsInHavenIsland( this ) )
            {
                Mobile killer = this.LastKiller;
 
                if ( killer is BaseCreature )
                    killer = ((BaseCreature)killer).GetMaster();
 
                if ( killer is PlayerMobile && ((PlayerMobile)killer).Young )
                    treasureLevel = 0;
            }
 
            if ( !Summoned && !NoKillAwards && !IsBonded )
            {
                if ( treasureLevel >= 0 )
                {
                    if ( m_Paragon && Paragon.ChestChance > Utility.RandomDouble() )
                        PackItem( new ParagonChest( this.Name, treasureLevel ) );
                    else if ( (Map == Map.Felucca || Map == Map.Trammel) && TreasureMap.LootChance >= Utility.RandomDouble() )
                        PackItem( new TreasureMap( treasureLevel, Map ) );
                }
 
                if ( m_Paragon && Paragon.ChocolateIngredientChance > Utility.RandomDouble() )
                {
                    switch ( Utility.Random( 4 ) )
                    {
                        case 0: PackItem( new CocoaButter() ); break;
                        case 1: PackItem( new CocoaLiquor() ); break;
                        case 2: PackItem( new SackOfSugar() ); break;
                        case 3: PackItem( new Vanilla() ); break;
                    }
                }
            }
 
            if ( !Summoned && !NoKillAwards && !m_HasGeneratedLoot )
            {
                m_HasGeneratedLoot = true;
                GenerateLoot( false );
            }
 
            if ( !NoKillAwards && Region.IsPartOf( "Doom" ) )
            {
                int bones = Engines.Quests.Doom.TheSummoningQuest.GetDaemonBonesFor( this );
 
                if ( bones > 0 )
                    PackItem( new DaemonBone( bones ) );
            }
 
            if ( IsAnimatedDead )
                Effects.SendLocationEffect( Location, Map, 0x3728, 13, 1, 0x461, 4 );
 
            InhumanSpeech speechType = this.SpeechType;
 
            if ( speechType != null )
                speechType.OnDeath( this );
 
            if ( m_ReceivedHonorContext != null )
                m_ReceivedHonorContext.OnTargetKilled();
 
            return base.OnBeforeDeath();
        }
 

Soteric

Knight
Code:
 {
            Mobile m = this.LastKiller;
            switch (Utility.Random(100))
            {   
                case 0: m.AddToBackpack(new SkillBall(1)); m.SendMessage (" You have captured a fragment of this creature's soul "); break;
            }
 
        return base.OnBeforeDeath();
            }
return base.OnBeforeDeath(); - remove this. 'return' instruction means stop method execution
 

woody_paine

Sorceror
Thank you so much. I thought it just returned to the script to where it left off before my custom script interrupted it. It complied on my backup server with the reccomended change with no errors, so when I get a chance to take my live server down and test it I will check and see how it plays out. Certainly seems like the fix I was looking for though. Thank you so much.
 
Top