A medic can cast it, and so can a ghost (although the ghost will lose its attack button, it can still attack manually if selected in a group which includes a unit that has an attack button). This is because they both normally have abilities which require a casting animation.
The first thing to do is to put the unit you want to swap at a predetermined index. You can find more about how to figure out various indexes and the units you would place and/or kill to alter them in this thread:
http://www.staredit.net/topic/15356/For the sake of this example, we'll use index 1367, as used in jjf's "WraithShot SCV" map:
http://www.staredit.net/334523/Set your Medic to use index 1367 (you can fill the indexes before that with Map Revealers). The indexes in use are listed when you select a unit in SCMDraft (and they can be moved up and down the list of indexes as well).
The preplaced unit which increases this index's unit ID by 1 when it dies is Unit #3900 owned by Player 223.
The preplaced unit which increases this index's command card by 1 when it dies is Unit #3900 owned by Player 235.
To find the difference in unit IDs between your starting unit and your target unit, you just go into SCMDraft and select both to see what their IDs are.
A Medic is Unit #34, and a Defiler is Unit #46.
This being the case, you would place 12 of each unit (the one that changes the unit's ID, and the one that changes its command card). You would also place a firebat nearby which will kill the preplaced units simultaneously via the splash of its normal attack (placement for the units is a bit odd, check the attached map to get the spacing correct, the firebat has to be approximately 15 horizontal tiles away).
When the preplaced units die, the medic will gain the stats and abilities of the defiler, while still looking like a medic.
I've attached a map which demonstrates this specific example.
Edit: You'll notice I disabled Burrow, that's because a Medic doesn't have the animation for it, so the game will crash if you try to do it.
Attachments:
Post has been edited 1 time(s), last time on Aug 29 2012, 4:48 am by Azrael.