SCRMaps
/
Sign in

Showing an explosion, in one line

How to put any of StarCraft's effect graphics wherever you want: one unit and one write.

7 min read

To make an explosion happen at a spot, the usual approach is hunting for a unit that has that graphic. There is no need: the whole technique is three lines.

wwrite(0x666160 + 2*380, imageId);   // 380번 스프라이트의 이미지를 바꾼다
CreateUnit(1, 33, loc, cp);          // 유닛 33 = 스캐너 스윕
RemoveUnit(33, cp);
Unit 33, the Scanner Sweep, spawns sprite 380 when it is created. Change which image that sprite uses and that image plays at the spot.

Why it composes matters: StarCraft reads the image only at creation and never looks again. So setting the image, creating, setting it again and creating gives you two different effects at once out of one shared sprite slot.

Why unit 33
클릭이 안 됩니다It cannot be clicked, not even by dragging.
미니맵에 안 나옵니다It is not drawn there at all.
여러 개가 겹칩니다Any number of them can occupy the same spot.
밑에 깔린 유닛이 느려지지 않습니다Putting one over a ground unit does not affect its movement.
유닛 이동 트리거가 안 먹습니다It will not be moved or swept up by accident.

All of which is exactly what you want from a decoration. It is this list, not any graphic, that made unit 33 the effect vehicle everybody uses.

You have to make unit 33 trigger-creatable first, or CreateUnit silently does nothing - no error and no unit. Ticking "unit listing and palette" in DatEdit is this, and the same thing can be done in code: it is bit 0x0002 of the Staredit availability flags.

Put back what you changed. Sprite 380 is the slot the game uses for a real Scanner Sweep too, so without restoring the original image the next scan plays your explosion.

The five pools the engine draws from
Sign in to track your progress