diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index 61890feca0..1f2bd94021 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -1509,11 +1509,13 @@ class DefaultObject(ObjectDB, metaclass=TypeclassBase): returns the new clone name on the form keyXX """ key = self.key - num = sum( - 1 - for obj in self.location.contents - if obj.key.startswith(key) and obj.key.lstrip(key).isdigit() - ) + num = 1 + if self.location: + num = max(0, *[ + int(obj.key.lstrip(key) or 0) + for obj in self.location.contents + if obj.key.startswith(key) + ])+1 return "%s%03i" % (key, num) new_key = new_key or find_clone_key()