1. If we create a box using "GameManager.server.CreateEntity" how can we uniquely identify it (since it doesn't belong to a player OR assign it to a player?
     
  2. Here's a snippet example:
    Code:
    [ChatCommand("boxhere")]
    private void cmdBoxHere(BasePlayer player, string command, string[] args)
    {
    var box = GameManager.server.CreateEntity("assets/prefabs/deployable/large wood storage/box.wooden.large.prefab", player.transform.position, new Quaternion(), true);
            box.OwnerID = player.userID;
            box.Spawn(true);
    }
    I tested it and it worked fine for me. Once you spawn it, press f1 and type: "ent who" and it should show you the owner ID.
     
  3. Great !!

    Is there anyway to track this box with a unique ID?
     

  4. I'm not sure if there's a native way to track entities, but you could make it in a plugin much like Entity Owner does, but in this case, just for boxes.
     
  5. maybe:

    Code:
    box.name = uniqueID 
    With the plugin tracking the uniqueID number list. ?
     
  6. net.ID
    So in this case
    Code:
    List<uint> boxIDs = new List<uint>();
        [ChatCommand("boxhere")]
        private void cmdBoxHere(BasePlayer player, string command, string[] args)
        {
            var box = GameManager.server.CreateEntity("assets/prefabs/deployable/large wood storage/box.wooden.large.prefab", player.transform.position, new Quaternion(), true);
            box.OwnerID = player.userID;
            box.Spawn(true);
            boxIDs.Add(box.net.ID);
        }
     
  7. The only problem with this is that it will reset the list each time the plugin is reloaded, which I suppose isn't a problem if you're not wanting to keep it after server restarts, or making modifications to the plugin.
     
  8. Sorry, I thought that the need to save that data was obvious. I was merely telling isuelt what to use for a unique ID, the question didn't ask what to do with it once he has it
     
    Last edited by a moderator: Feb 19, 2016
  9. Thanks for the help guys ! :)

    Another question: How do I access vars in one plugin that are set in another.

    For instance: Plugin A (LUA) has an array var that Plugin B (C#) need to check

    Or is it just better to have Plugin A set a value in a file/DB in which Plugin B can check ?
     
  10. Wulf

    Wulf Community Admin

    Create a hook that returns a var in Plugin A, call hook in Plugin B to get that var.
     
  11. DUH ! Sorry for the dumb question! I was just thinking about it wrong.

    Thanks @Wulf