Okay so if you ever downloaded PickyBeetle.cs and/or the ShardCleaner.cs then you all are familiar with the OnThink method below.

Code:
public override void OnThink()
        {
            base.OnThink();

            if (DateTime.UtcNow < m_NextPickup)
                return;

            m_NextPickup = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10));

            Container pack = this.Backpack;

            if (pack == null)
                return;

            ArrayList list = new ArrayList();

            foreach (Item item in this.GetItemsInRange(2))
            {
                if (item.Movable && item.Stackable)
                    list.Add(item);
            }

            int pickedUp = 0;

            for (int i = 0; i < list.Count; ++i)
            {
                Item item = (Item)list[i];

                if (!pack.CheckHold(this, item, false, true))
                    return;

                bool rejected;
                LRReason reject;

                NextActionTime = Core.TickCount;

                Lift(item, item.Amount, out rejected, out reject);

                if (rejected)
                    continue;

                Drop(this, Point3D.Zero);

                if (++pickedUp == 3)
                    break;
            }
        }

What I need are two lists or arraylists that function within the code below that specify what items to pick up off the ground and what items to ignore; so one list will be items to grab and the other list will be items that if listed will be ignored by the mobile.

A crude example of what I'm talking about would kind of look like this; yes I know the code is wrong and that is why I am asking for help on here :)

-----------------------------------------------------------------
Mobile Object Pickup List
-----------------------------------------------------------------
if ( )
item is object || item is object || item is object.....

pickup item;
return true;

-or- Just brainstorming

Code:
private static Type[] m_Pickup = new Type[]
		{
	        typeof( Gold ), typeof( Broadsword ), typeof( Dagger ), typeof (Bandage)
		};

-----------------------------------------------------------------
Mobile Object Ignore List
-----------------------------------------------------------------
if ( )
item is object || item is object || item is object.....

pickup item;
return false;

-or- Just brainstorming

Code:
 private static Type[] m_Ignore = new Type[]
		{
	        typeof( SoulSeeker ), typeof( TalonBite ), typeof( TotemOfVoid )
		};
-----------------------------------------------------------------

The final thing I need is a way to prevent the mobile from picking up an item after it dies. This is a bug in both the ShardCleaner.cs and the PickyBeetle.cs.

What I am doing is remaking my militia scripts. One of the functions of each mercenary is that they will pick up items that have been dropped to the ground and loot specific items off corpses (another method and list I'll need help with in the future.:

swords, armor, arrows, bows...

Thank you so much ahead of time and credit will be given appropriately.
 
Last edited:
Why do you need a list of items that it will pick up AND one that it will not? Shouldn't it ignore any item that is not on the list to pick up?

As far as not picking up items when dead, I would think a simple check for IsAlive in the OnThink method and a return if it is not.
 
Code:
foreach (Item item in this.GetItemsInRange(3))
            {
                if (item is BaseArmor || item is BaseWeapon || item is Bandage || item is Gold || item.Stackable )          
                    list.Add(item);          
            }
Thanks for the help Ravenwolfe, but I ended up solving two of the issues with a simple solution and solving the third issue with your suggestion.

For those interested in this fix here it is...

look for the following code in your PickBeetle, ShardCleaner, or HordeMinion scripts:

Code:
if (item.Movable && item.Stackable)
              list.Add(item);

and change it to look like this snippet:

Code:
foreach (Item item in this.GetItemsInRange(3))
             {
                    if (item is BaseArmor || item is BaseWeapon || item is Bandage || item is Gold || item.Stackable )          
                    list.Add(item);          
            }

This will restrict what the mobile actually picks up off the ground and works quite well. I used base scripts as a descriptor for generalized items, however you can get more specific by adding:

Code:
...item is Dagger || item is FloppyHat || item is CSharpManual...

I removed the following: item.Movable because that makes the mobile pick up everything around him and that's just annoying when you accidently drop a rare on the ground and poof* now you have an npc to kill.
 
Last edited:
Back