1. Greetings.

    Im trying atm to create and Save storage containers to use for item transports.

    Creating, using all no problem. works fine.

    Im stuck now at Saving them and loading them if the plugin reloads or server restarts.

    thats what i got so far:
    Code:
    public class StoredData
            {
            public Dictionary<StorageContainer , ulong> mailboxes = new Dictionary<StorageContainer , ulong>();
                public StoredData()
                {
                }
            }
    Code:
    void Save()
            {
                Interface.Oxide.DataFileSystem.WriteObject("Boxes", storedData);
            }
    Code:
    void loaded()
    {
    storedData = Interface.Oxide.DataFileSystem.ReadObject<StoredData>("Boxes");}
    as i expected is the compiler not able to transform String into Storage container...

    anybody an idea?
     
  2. Just save their nameOfEntity.net.ID;
     
  3. i think he even does that
    Code:
     "mailboxes": {
        "woodbox_deployed[4412]": 76561198023*****
    but , even if i only save the entity ID , how get i back the StorageContainer reference ?
     
  4. BaseNetworkable x = BaseNetworkable.serverEntities.Find(yourDictionary[player.userId]);

    So when you will need to check, is it this entity or not:
    BaseNetworkable x = BaseNetworkable.serverEntities.Find(yourDictionary[player.userId]);
    if (x == null){ Puts("It is not saved mail-box"); return; }
    But i cant understand, why userId is Value, please describe what do you want to do, and i will help.
     
  5. well im working on a custom plugin atm, that kinda is a shop,
    you offer items, you pay with items.

    ATM the item price, you pay with get transfered into the sellers inventory.
    obviously thats not gonna work if the player is dead , or is even not good if the player is in a fight or something
    so i wanted to let them make a box for that so the items can be transfered into that instead.
    for now, the creation, the item transfer and all that is working but im missing a way to save that stuff
    on reload or unload...
     
  6. ok... this was probably a huge way around, but i did it now that those positions are saved on reload

    On unload i just added all items of the dictionary in a hashset , with the Vector3 position + userid. for every box.

    and on plugin load just created the boxes again with the Vector3 and userid.
    so you dont actually need to store the BaseEntity or else.

    Might not work out if items are still in it. But this now works out for me :D
     
  7. Hello, creating a mailbox wasn't a better solution for you? It will avoid to create and kill entity at each transaction.