Macil

Initiate
What script and edits would I need to make to turn OFF instance loot? I think that's what its called at least. I want to make it so multiple partied players can all participate in killing something and when it dies it leaves a single pile of gold instead of 3, 4, 5... Etc.
 
So, anyone trying to do this, here is what I found works. I am still testing to make sure it works without any issues... But I think this is everything I commented out and got it to work with no problems thus far...

In Corpse.cs comment out the following sections:

Code:
 [CommandProperty(AccessLevel.GameMaster)]
        public virtual bool InstancedCorpse
        {
            get
            {
                if (!Core.SE)
                {
                    return false;
                }

                return (DateTime.UtcNow < (m_TimeOfDeath + InstancedCorpseTime));
            }
        }
        /*
        private Dictionary<Item, InstancedItemInfo> m_InstancedItems;
        
        public bool HasAssignedInstancedLoot { get; private set; }

        private class InstancedItemInfo
        {
            private readonly Mobile m_Mobile;
            private readonly Item m_Item;

            public bool Perpetual { get; set; }

            public InstancedItemInfo(Item i, Mobile m)
            {
                m_Item = i;
                m_Mobile = m;
            }

            public bool IsOwner(Mobile m)
            {
                if (m_Item.LootType == LootType.Cursed) //Cursed Items are part of everyone's instanced corpse... (?)
                {
                    return true;
                }

                if (m == null)
                {
                    return false; //sanity
                }

                if (m_Mobile == m)
                {
                    return true;
                }

                Party myParty = Party.Get(m_Mobile);

                return (myParty != null && myParty == Party.Get(m));
            }
        }

        public override bool IsChildVisibleTo(Mobile m, Item child)
        {
            if (!m.Player || m.IsStaff()) //Staff and creatures not subject to instancing.
            {
                return true;
            }

            if (m_InstancedItems != null)
            {
                InstancedItemInfo info;

                if (m_InstancedItems.TryGetValue(child, out info) && (InstancedCorpse || info.Perpetual))
                {
                    return info.IsOwner(m); //IsOwner checks Party stuff.
                }
            }

            return true;
        }

        public override void AddItem(Item item)
        {
            base.AddItem(item);

            if (InstancedCorpse && HasAssignedInstancedLoot)
            {
                if (item.GetBounce() != null)
                {
                    if (m_HasLooted == null)
                        m_HasLooted = new List<Item>();

                    m_HasLooted.Add(item);
                }

                AssignInstancedLoot(item);
            }
        }

        private void AssignInstancedLoot()
        {
            AssignInstancedLoot(this.Items);
        }

        public void AssignInstancedLoot(Item item)
        {
            AssignInstancedLoot(new Item[] { item });
        }

        private void AssignInstancedLoot(IEnumerable<Item> items)
        {
            if (m_Aggressors.Count == 0 || Items.Count == 0)
            {
                return;
            }

            if (m_InstancedItems == null)
            {
                m_InstancedItems = new Dictionary<Item, InstancedItemInfo>();
            }

            var stackables = new List<Item>();
            var unstackables = new List<Item>();

            foreach (var item in items.Where(i => !m_InstancedItems.ContainsKey(i)))
            {
                if (item.LootType != LootType.Cursed) //Don't have curesd items take up someone's item spot.. (?)
                {
                    if (item.Stackable)
                    {
                        stackables.Add(item);
                    }
                    else
                    {
                        unstackables.Add(item);
                    }
                }
            }

            var attackers = new List<Mobile>(m_Aggressors);

            for (int i = 1; i < attackers.Count - 1; i++) //randomize
            {
                int rand = Utility.Random(i + 1);

                Mobile temp = attackers[rand];
                attackers[rand] = attackers[i];
                attackers[i] = temp;
            }

            //stackables first, for the remaining stackables, have those be randomly added after
            for (int i = 0; i < stackables.Count; i++)
            {
                Item item = stackables[i];

                if (item.Amount >= attackers.Count)
                {
                    int amountPerAttacker = (item.Amount / attackers.Count);
                    int remainder = (item.Amount % attackers.Count);

                    for (int j = 0; j < ((remainder == 0) ? attackers.Count - 1 : attackers.Count); j++)
                    {
                        Item splitItem = Mobile.LiftItemDupe(item, item.Amount - amountPerAttacker);
                        //LiftItemDupe automagically adds it as a child item to the corpse

                        if (!m_InstancedItems.ContainsKey(splitItem))
                        {
                            m_InstancedItems.Add(splitItem, new InstancedItemInfo(splitItem, attackers[j]));
                        }
                        //What happens to the remaining portion?  TEMP FOR NOW UNTIL OSI VERIFICATION:  Treat as Single Item.
                    }

                    if (remainder == 0)
                    {
                        if (!m_InstancedItems.ContainsKey(item))
                        {
                            m_InstancedItems.Add(item, new InstancedItemInfo(item, attackers[attackers.Count - 1]));
                        }
                        //Add in the original item (which has an equal amount as the others) to the instance for the last attacker, cause it wasn't added above.
                    }
                    else
                    {
                        unstackables.Add(item);
                    }
                }
                else
                {
                    //What happens in this case?  TEMP FOR NOW UNTIL OSI VERIFICATION:  Treat as Single Item.
                    unstackables.Add(item);
                }
            }

            for (int i = 0; i < unstackables.Count; i++)
            {
                Mobile m = attackers[i % attackers.Count];
                Item item = unstackables[i];

                if (!m_InstancedItems.ContainsKey(item))
                {
                    m_InstancedItems.Add(item, new InstancedItemInfo(item, m));
                }
            }

            ColUtility.Free(stackables);
            ColUtility.Free(unstackables);
        }
        */
        public void AddCarvedItem(Item carved, Mobile carver)
        {
            DropItem(carved);

            /*if (InstancedCorpse)
            {
                if (m_InstancedItems == null)
                {
                    m_InstancedItems = new Dictionary<Item, InstancedItemInfo>();
                }

                if (!m_InstancedItems.ContainsKey(carved))
                {
                    m_InstancedItems.Add(carved, new InstancedItemInfo(carved, carver));
                }
            }*/
        }

and

Code:
                if (!owner.Player)
                {
                    //c.AssignInstancedLoot();
                    //c.HasAssignedInstancedLoot = true;
                }

Also, I'd like to eventually add in some kind of toggle so players can elect to have this feature enabled or disabled within their parties or not. 'Though that will likely never be within' my capabilities skill-wise. Hope this at least helps anyone else out there who has had an issue with this as long as I have.
 

Active Shards

Donations

Total amount
$50.00
Goal
$1,000.00
Back