I've poked around death a few times since I became a modder. I've experimented with Sarevok's undying avatar and made an amulet that kept the wearer immortal at the price of turning him into some kind of black-channeled glitch-slickened monster. But I've always wanted to make a real Animate Dead spell, and now I think I have the groundwork for it. Some people here have been very helpful with explanations of SPRITE_IS_DEAD variables and related topics.
Here are some things I've learned that are probably new.
1) Creatures do not switch to the General type DEAD when they die.
2) Several effects with timing mode 9 last unto death, including glows and invisibility and scripting state changes.
3) On death the engine very likely applies some combination of Make Unselectable, Remove Feet Circle or Set Scripting State to remove the circle and possibly reduces personal space so the avatar can be walked over. This is my guess, because a corpse behaves exactly like an unselectable living creature with disabled AI and dialogue. But without knowing what that custom spell is, if that is how the engine goes about it, there is no removing it. Making a creature immune to these opcodes does not prevent death.
4) A Raise Dead effect or a Current Hit Points Bonus with "Raise Dead" checked can bring any creature back to life. This decrements its SPRITE_IS_DEAD Global by 1. In the GAM file the Global stands out for being uniquely at 0 - from having being set first to 1 from "nothing" and then to 0.
5) But because a corpse is effectively unselectable, there is no way for the player to target it with a Raise Dead or Current Hit Points Bonus directly, from a party character. However, the engine can target it if ordered to ApplySpellRES on the dead one's script name or through a ReallyForceSpellRES on a party member.
6) Dead creatures do not react to area-of-effect versions of such spells, they must be targeted personally by their script names.
7) The death of any creature in the game is recorded. Those without a script name of their own in the CRE file increment the SPRITE_IS_DEADNONE variable (at around 1311 currently in my game, killing spree moderate).
Now to what I propose to do: since the engine can target the untargetable, an Animate Dead should summon an invisible minion or several scripted to execute ApplySpellRES on nearby dead, or better to say, non-living creatures. This is easy if their script names are known, as for a cutscene, but to make it universal some other Object would have to be substituted. Dead creatures are ignored by See() or Detect(), at least with any combination of other death triggers I have tried, like HPLT(LastSeenBy(),1) or a custom spell state persisting into death. But perhaps there is another way to latch on to them. Is it possible to refer to them by their blank script name? If the engine records it as NONE, can it be ordered to cast a spell at "None," if we used the exact string number for <NO TEXT> or No such index or even created a new string reading "NONE"? When I try to give the engine numbers "-1" or "0," it interprets them as strings rather than reference numbers.
Another possibility is contingencies. Because effects persist in death, consistencies likely do too.
Anyway, aside from this it seems that it's possible to make corpses wear armor and possibly other equipment - not through any engine function, unfortunately, but with Near Infinity. Dead ones' item slots all get set to -1 and they have no items, but they can be edited and items added. I have not been able to make them equip helmets or weapons. But this is Emerson, the mine boss, walking the horizontal catwalk in Baldur's Gate.