I was just wondering if anyone knew of a script (new or old) that makes a chest open a different container depending on who opens it? I have absolutely no idea where to begin, so I was hoping someone knew of a script I could cannibalize for my intended purposes.

Small edit - or if anyone knows how to make two "chests" share the same inventory.
 
Even if you do script it, the client will have an issue displaying it. For example, if you do an AccessLevel check on the person double-clicking the container and set its GumpID accordingly, the client will have cached the first (default) gump loaded when the item appeared on screen. It won't change that gump until you log out and back in. Or it may work once and then never again until you re-log.

I ran into this when scripting custom containers and changing the gump via [props to test. Moving the container may make the client refresh its settings but that still won't help when your goal is for it to change based on the person opening it.
 
Add this override to any container, and adjust the conditional to your need.. I used Name prop as an example..

Code:
        public override void DisplayTo(Mobile to)
        {
            ProcessOpeners(to);

            NetState ns = to.NetState;

            if (ns == null)
            {
                return;
            }

            if (to is PlayerMobile pm)
            {
                if (pm.Name == "Fraz")
                {
                    ContainerData = ContainerData.GetData(2958);
                }
                else if (pm.Name == "Geos")
                {
                    ContainerData = ContainerData.GetData(3708);
                }
            }

            ValidatePositions();

            if (ns.HighSeas)
            {
                to.Send(new ContainerDisplayHS(this));
            }
            else
            {
                to.Send(new ContainerDisplay(this));
            }

            if (ns.ContainerGridLines)
            {
                to.Send(new ContainerContent6017(to, this));
            }
            else
            {
                to.Send(new ContainerContent(to, this));
            }

            if (to.ViewOPL)
            {
                var items = Items;

                foreach (var o in items)
                {
                    to.Send(o.OPLPacket);
                }
            }
        }
 
Well Fraz, thanks for the input. Thats unfortunate that you have to program it in for each specific user tho =( Guess if thats how it has to be done, thats how it has to be done.
 
Well no.. you just need to figure out the catagories you need.. and make the proper adjustments.. could be by any property.
Gender, race, guild w/e..
 
Well I specifically wanted it for a self enclosed event. ConditionalTeleporters in/out for no backpack items. Just wanted a chest that stores each players inventorys before they leave the area.
 
Gotcha.. I understand better now. Not a different looking container, an actual different container.
You may find some ideas looking at how corpses are handled, or even better I think there is a Bag of Sending in the resources or somewhere, maybe.
 
Back