I have an unfinished NPC thief script. I fixed it to where the thief will check 2 tiles around it for Mobile(player) and if player has xml item, do not steal, however if no xml item exist then steal. The xml item is a timer, that goes away after 30 seconds ( adjustable ). Now what current happens is, the thief steals the item and it gets deleted (which i understand why per the code), however I would like the thief to 'steal' the item and put it in it's own pack. I've checked other creature codes, but this I'm not sure on... Below is the full Code (without the xml file of course) if anyone has any suggestions.

Code:
using System;
using Server;
using Server.Items;
using System.Collections;
using System.Collections.Generic;
using Server.Engines.XmlSpawner2;

namespace Server.Mobiles
{
    public class MasterThief : BaseVendor
    {
        private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
        [Constructable]
        public MasterThief()
            : base("the banished theif")
        {
            SetSkill( SkillName.Begging, 30.0, 100.0 );
            SetSkill( SkillName.Lockpicking, 70.0, 85.0 );
            SetSkill( SkillName.Hiding, 40.0, 63.0 );
            SetSkill( SkillName.Snooping, 30.0, 100.0 );
            SetSkill( SkillName.Stealing, 60.0, 120.0 );
            SetSkill( SkillName.Stealth, 30.0, 70.0 );
        }

        public override void InitSBInfo()
        {
        }
       
        protected override List<SBInfo> SBInfos
        {
            get
            {
                return this.m_SBInfos;
            }
        }

        public override void InitOutfit()
        {
            AddItem( new Shirt( GetRandomHue() ) );
            AddItem( new Shoes( GetShoeHue() ) );
            AddItem( new LongPants( GetRandomHue() ) );

            switch ( Utility.Random( 2 ) )
            {
                case 0: AddItem( new SkullCap( Utility.RandomNeutralHue() ) ); break;
                case 1: AddItem( new Bandana( Utility.RandomNeutralHue() ) ); break;
            }

            int hairHue = Utility.RandomHairHue();

            if ( Female )
            {
                switch ( Utility.Random( 9 ) )
                {
                    case 0: AddItem( new Afro( hairHue ) ); break;
                    case 1: AddItem( new KrisnaHair( hairHue ) ); break;
                    case 2: AddItem( new PageboyHair( hairHue ) ); break;
                    case 3: AddItem( new PonyTail( hairHue ) ); break;
                    case 4: AddItem( new ReceedingHair( hairHue ) ); break;
                    case 5: AddItem( new TwoPigTails( hairHue ) ); break;
                    case 6: AddItem( new ShortHair( hairHue ) ); break;
                    case 7: AddItem( new LongHair( hairHue ) ); break;
                    case 8: AddItem( new BunsHair( hairHue ) ); break;
                }
            }
            else
            {
                switch ( Utility.Random( 8 ) )
                {
                    case 0: AddItem( new Afro( hairHue ) ); break;
                    case 1: AddItem( new KrisnaHair( hairHue ) ); break;
                    case 2: AddItem( new PageboyHair( hairHue ) ); break;
                    case 3: AddItem( new PonyTail( hairHue ) ); break;
                    case 4: AddItem( new ReceedingHair( hairHue ) ); break;
                    case 5: AddItem( new TwoPigTails( hairHue ) ); break;
                    case 6: AddItem( new ShortHair( hairHue ) ); break;
                    case 7: AddItem( new LongHair( hairHue ) ); break;
                }

                switch ( Utility.Random( 5 ) )
                {
                    case 0: AddItem( new LongBeard( hairHue ) ); break;
                    case 1: AddItem( new MediumLongBeard( hairHue ) ); break;
                    case 2: AddItem( new Vandyke( hairHue ) ); break;
                    case 3: AddItem( new Mustache( hairHue ) ); break;
                    case 4: AddItem( new Goatee( hairHue ) ); break;
                }
            }

            PackGold( 100, 200 );
        }
       
        public override void OnThink()
        {
           
            foreach ( Mobile m in this.GetMobilesInRange( 2 ) )
            {
                if ( m.Player )
                {
                    MasterThiefXMLTimer a = (MasterThiefXMLTimer)XmlAttach.FindAttachment(m, typeof(MasterThiefXMLTimer));
                    if ( a != null )
                    {
                        m.SayTo( m, "Keep an eye on your stuff.." );
                        return;
                    }
                   
                    else
                    {
                        XmlAttach.AttachTo(m, new MasterThiefXMLTimer(30)); //set timer of how long before steal again(secs)
                        if ( m.Backpack != null )
                        {//add items and diff gold ammounts : TODO
                            Gold g = m.Backpack.FindItemByType( typeof( Gold ), true ) as Gold;
                            Bandage b = m.Backpack.FindItemByType( typeof( Bandage ), true ) as Bandage;
                            BaseArmor ba = m.Backpack.FindItemByType( typeof( BaseArmor ), true ) as BaseArmor;

                            if ( g != null )
                            {
                                if ( g.Amount > 800 )
                                    g.Amount -= 800;
                                if ( g.Amount > 200 )
                                    g.Amount -= 200;
                           
                                else
                                {
                                    g.Delete();
                                }
                                   

                                m.SayTo( m, "You notice {0} steal some gold from you and laugh...");
                            }
                            else
                            {
                               
                            }
                        }

                    }
                }
               
               

            }
        }


        public MasterThief( Serial serial ) : base( serial )
        {
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 ); // version
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }
    }
}
 
Back