void RecursiveChestRestore(object oStore, int iFirst=TRUE) { object oItem = GetFirstItemInInventory(oStore); while(oItem!=OBJECT_INVALID) { if(!iFirst || GetHasInventory(oItem)) { ActionTakeItem(oItem, oStore); } oItem = GetNextItemInInventory(oStore); } if(iFirst) { AssignCommand( OBJECT_SELF, ActionDoCommand( RecursiveChestRestore( oStore, FALSE ) ) ); return; } AssignCommand(OBJECT_SELF, ActionDoCommand( DestroyObject(oStore) ) ); } void main() { object oPC = GetLastOpenedBy(); SendMessageToPC(oPC, "Saving items is expensive in script time use on the server"+ "\n You must therefore wait 60 seconds between transactions"+ "\n The chest will be locked for that period after you close" ); string sName = GetName(oPC); string sLeft = GetStringLeft(sName,4); string sCampName = "BankVaults_" + sLeft; object oStore = RetrieveCampaignObject(sCampName,"Chest", GetLocation(OBJECT_SELF), OBJECT_INVALID,oPC); // Override the existing campaign object for this // player StoreCampaignObject(sCampName,"Chest", OBJECT_INVALID,oPC); AssignCommand(OBJECT_SELF, ActionDoCommand(RecursiveChestRestore(oStore))); }