Hello,
There is a way to close an open container if a player moves?
I noticed if the container is outside your backpack its gump automatically closes if I go out of range, but if I put the container inside my backpack I never go out of range.. so the gump remains open.

I would have containers I can open only if I'm next to certain NPCs, and closes/locks (become not usable) if I go away from them..

uhmm.. Ideas?
 
with bankboxes its handled via the banker mobile and onmovement method
bank boxes are virtual, which i believe means they have no "physical" location, or just stay in the internal map

if you have a physically present container you use then use the onmovement method on the container itself
 
actually it's handled in server mobile Move method
but you need supporting properties on the container to check if it's opened or closed

Code:
public virtual bool Move(Direction d)
        {
            if (m_Deleted)
            {
                return false;
            }

            BankBox box = FindBankNoCreate();

            if (box != null && box.Opened)
            {
                box.Close();
}
 
Back