1. As I understand it I can capture the moment a player dies using:

    OnEntityDeath

    How would I access their inventory?

    I am looking to access what attire a player has and what the player has in their belt specifically their map when they die. I'd like to take, at the very least, their map and place it in a storage box.

    My idea is what I call a deathbox. When a player dies, their attire and map go into the last box they made and deployed. I play with a group who tend to give you map back after you die and we felt this would be a great mod for us.

    Thank you!
     
  2. Calytic

    Calytic Community Admin Community Mod

    Here is some psuedo-code for the death procedure.

    Code:
    void OnEntityDeath(BaseEntity entity, HitInfo info)
    {
        if (entity is BasePlayer)
        {
            BasePlayer player = (BasePlayer)entity;        foreach (Item item in player.inventory.containerBelt.itemList)
            {
                item.MoveToContainer(someOtherContainer);
            }        foreach (Item item in player.inventory.containerWear.itemList)
            {
                item.MoveToContainer(someOtherContainer);
            }
        }
    }
     
  3. Do you have any idea why item.MoveToContainer would return false and not add the item to the container? I create an ItemContainer in code, would that suffice?
     
  4. Possibly if the container is full.