Well I came up with something that works well for me and doesn't require continous loops check triggers and arrays
Here is what I did, and this helped with a tonne of dead bodies all over the place.
In the init part of the soliders that I wanted to dissappear I put this:
this addeventhandler ["killed", {_this exec "dead.sqs"}]
In the soldiers I created on the fly I added this to the "init".
Notice the double quotes.
this addeventhandler [""killed"", {_this exec ""dead.sqs""}]
I used some of the code from your script.
dead.sqs
; Select the Unit
_unit = _this select 0
;Delay the delete after death
~5
; Sink into the ground
_k = (getpos _unit) select 2
#loop
_k = _k - 0.1
_unit setpos [(getpos _unit) select 0,(getpos _unit) select 1,_k]
?(_k > -1):goto "loop"
; finally delete the vehicle
deletevehicle _unit
exit
Hope this helps others
Hoz