I made this same type of ability, named Necrogenesis
Each time you kill a unit, it overrides the last killed unit and saved the new one
If you doesn't kill any further unit, the last killed unit is permanently saved until you kill the new one
I know my test map is different from what you were requesting but, it's more advanced trigger I must say
Please come back here and comments on the given test map
If you're still not satisfy, I'll be doing your
true request which is:
Starting hero unit does not has ANY ability
When the hero kills a unit, a new command will be available to further level the ability, starting with level 1 of course
But, if you do this, this will involve an issue, of "leveling up abilities through red cross"
When we ADD ability using trigger, that ability CANNOT be leveled up by pressing the red cross BECAUSE the unit doesn't have the ability to begin with
However, he can level it up by using trigger:
-
Unit - Set level of Necrogenesis for (Triggering unit) to ((Level of Necrogenesis for (Triggering unit)) + 1)
But the red cross will not appear (if you doesn't have ANY ability for that hero at the start of the game)
@wolfman
You doesn't need to save EVERY unit-type in that map, lol...
You can save it using trigger by variables

Take some dummy spell (like I did in my test map which is the Roar ability)
And load up the last killed unit, there you have it