This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| crpl:docs:destroy [2013/02/02 17:30] – virgilw | crpl:docs:destroy [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ~~DISCUSSION~~ | + | |
| <- [[crpl: | <- [[crpl: | ||
| ===== Destroy | ===== Destroy | ||
| - | ^Arguments^Result^Notation^ | + | ^ Arguments ^ Result ^ Notation ^ |
| - | |Unit UID to Destroy, Explosion Mode (0,1,2)| |'' | + | |Unit UID to Destroy, Explosion Mode (0,1,2,3)| |'' |
| Line 11: | Line 11: | ||
| WARNING: ENSURE YOU HAVE SAVED THE MAP BEFORE CALLING THIS! | WARNING: ENSURE YOU HAVE SAVED THE MAP BEFORE CALLING THIS! | ||
| This call will destroy the unit! | This call will destroy the unit! | ||
| - | For the explosion mode argument, | + | For the explosion mode argument, |
| - | 1 means a small soundless flash, 2 or higher | + | 1 means a small soundless flash, 2 means a full explosion with sound, 3 means full explosion but no sound. |
| + | |||
| + | **Note:** If Destroy is called on SELF, the script will stop at that line. Any code after won't be executed. | ||
| + | |||
| + | <color # | ||
| === Examples === | === Examples === | ||
| - | < | + | < |
| $targetX:0 | $targetX:0 | ||
| $targetY:0 | $targetY:0 | ||
| Line 21: | Line 25: | ||
| once | once | ||
| - | self CONST_CREATEPZ | + | SetUnitAttribute(self CONST_CREATEPZ |
| - | < | + | QueueMove(< |
| endonce | endonce | ||
| - | GetQueuedMoveCount eq0 if | + | if (GetQueuedMoveCount eq0) |
| #Done | #Done | ||
| - | self 0 Destroy | + | Destroy(self 2) |
| - | CurrentCoords < | + | SetCreeper(CurrentCoords < |
| endif | endif | ||
| + | |||
| + | # Gets around the bug with guppies and works for other units as well | ||
| + | : | ||
| + | -> | ||
| + | ->SD_Uid | ||
| + | StackSize -> | ||
| + | -1 -1 # extra pair of arguments to be consumed if needed | ||
| + | <-SD_Uid < | ||
| + | StackSize < | ||
| + | pop | ||
| + | loop | ||
| </ | </ | ||