Deaths() only answers questions like “is it at least 100?”. When you need the actual number you narrow it down with a binary search.
var level = 0;
if(level + 512 <= 1000 && Deaths(CurrentPlayer, AtLeast, level + 512, "Level")){ level = level + 512; }
if(level + 256 <= 1000 && Deaths(CurrentPlayer, AtLeast, level + 256, "Level")){ level = level + 256; }
if(level + 128 <= 1000 && Deaths(CurrentPlayer, AtLeast, level + 128, "Level")){ level = level + 128; }
// ... 64, 32, 16, 8, 4, 2, 1A maximum of 1000 takes ten lines. The count grows logarithmically, so even two billion is 31 lines.
Writing this by hand is tedious but entirely mechanical - SCRMaps' own save/load generator emits exactly this pattern for every value you choose to store.
You do not have to write it by hand either. EUDBinaryMax does this search for you: give it a condition and it returns the largest value for which the condition holds. The ten lines above become one.
const level = EUDBinaryMax(function(x) {
return l2v(Deaths(CurrentPlayer, AtLeast, x, "Level"));
}, 0, 1000);