SCRMaps
/
Sign in

Transform: changing a unit without dropping the selection

Remove and recreate loses the selection and the state. Driving the game's own morph order keeps both.

6 min read

The obvious way to turn one unit into another is to remove it and make a new one, which drops the selection, loses the state and flashes. StarCraft already has an order that does this properly - the Zerg morph - and writing that order onto the unit keeps it selected the whole way through.

0x4D (명령 번호)   = 42
0x4E (명령 상태)   = 2
0x4F (명령 신호)   = 4
0x98 (생산 대기열) = 바뀔 유닛 번호 (2바이트)
The unit to become goes into the build queue slot. It is the Zerg path and it works on any unit.
The known problems
체력이 가득 찹니다Save the hit points before and restore them once the morph completes.
생산 완료 음성이 납니다There is no clean fix. Suppressing it by changing the player value gives a wrong selection-circle colour, allied units occasionally attacking, and occasional crashes - the voice is the lesser evil.
부속 유닛이 남습니다A unit with a turret, like the Goliath or Siege Tank, leaves it behind. Write the turret pointer back to 0x70 to reattach it; an orphaned turret normally crashes.
죽는 연출이 나옵니다That comes from using the remove timer. Use a RemoveUnit trigger instead, or point the new unit's image at iscript 89 - which is the Science Vessel turret's script, and so has no death motion.

Some target units leave a dolmen. Morphing into a Marine, Wraith, Battlecruiser or Arbiter is reported to, while Vulture and Firebat are clean, and nobody knows why - not the author of the original post either. Test the specific unit you intend to use.

Iscript 89 is worth remembering as the useful blank: it draws and stops, with no death motion, which is what you want for any image that should simply appear. And a transform clears any overlay on the unit, so if you use both, transform first and attach the overlay second.

Sign in to track your progress