Willfaith

Member
there is a method to clean the whole backpack and pg from the one he has with himself?
in the documentation I have not found
 
Remove to where? or simply delete them? Either way I don't think there is a method like this in the core/scripts so you'd have to create one.
It wouldn't be hard however as you'd just do a loop on the mobile's layers and remove the items on the wanted layers from them and same idea for the backpack.
 
Code:
public static void UndressToBackpack( Mobile mobile )
{
    Item bank = mobile.FindBankNoCreate( ); // cache bank
    Item pack = mobile.Backpack; // cache pack

    int i = mobile.Items.Count;

    while( --i >= 0 ) // loop through equipped items in reverse
    {
        if( i >= mobile.Items.Count ) // prevent index out of range error
        {
            continue;
        }

        Item item = mobile.Items[i];

        // only move items that are not the pack or bank
        if( item != null && item != pack && item != bank )
        {
             if( item is EtherealMount ) // special case dismount
             {
                 ((EtherealMount)item).Rider = null;
             }
             else
             {
                 // doesn't care about pack max items/weight
                 mobile.PlaceInBackpack( item );
            }
        }
    }
}

You can put this code where you need it and call it, it can work both as static or non-static depending on your needs.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back