//Check if there are any items left and destroy the object if there are none void main() { if (!GetIsObjectValid(GetFirstItemInInventory())) DestroyObject(OBJECT_SELF); }