This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| crpl:docs:destroy [2013/01/14 19:01] – created chani | crpl:docs:destroy [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | TODO | + | |
| + | <- [[crpl: | ||
| + | ===== Destroy | ||
| + | |||
| + | ^ Arguments ^ Result ^ Notation ^ | ||
| + | |Unit UID to Destroy, Explosion Mode (0,1,2,3)| |'' | ||
| + | |||
| + | |||
| + | === Description === | ||
| + | Destroys the specified unit. | ||
| + | WARNING: ENSURE YOU HAVE SAVED THE MAP BEFORE CALLING THIS! | ||
| + | This call will destroy the unit! | ||
| + | For the explosion mode argument, | ||
| + | 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 === | ||
| + | <code prpl> | ||
| + | $targetX: | ||
| + | $targetY: | ||
| + | $speed: | ||
| + | $payload: | ||
| + | |||
| + | once | ||
| + | SetUnitAttribute(self CONST_CREATEPZ false) | ||
| + | QueueMove(< | ||
| + | endonce | ||
| + | |||
| + | if (GetQueuedMoveCount eq0) | ||
| + | #Done | ||
| + | Destroy(self 2) | ||
| + | |||
| + | SetCreeper(CurrentCoords < | ||
| + | endif | ||
| + | |||
| + | # Gets around the bug with guppies and works for other units as well | ||
| + | : | ||
| + | -> | ||
| + | -> | ||
| + | StackSize -> | ||
| + | -1 -1 # extra pair of arguments to be consumed if needed | ||
| + | <-SD_Uid < | ||
| + | StackSize < | ||
| + | pop | ||
| + | loop | ||
| + | </ | ||