This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| crpl:docs:destroy [2013/01/18 17:58] – grauniad | 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 ^ |
| - | |Explosion Mode (0,1,2)| |'' | + | |Unit UID to Destroy, |
| === Description === | === Description === | ||
| - | Destroys the current | + | Destroys the specified |
| 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 and your script along with it. | + | This call will destroy the unit! |
| - | This call pops an int from the stack as an argument and uses that to determine | + | For the explosion |
| - | whether to create an explosion. 0 means no explosion, | + | 1 means a small soundless flash, 2 means a full explosion with sound, 3 means full explosion but no sound. |
| - | 1 means a small soundless flash, 2 or higher | + | |
| + | **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: | ||
| + | $targetY: | ||
| + | $speed: | ||
| + | $payload: | ||
| + | |||
| + | once | ||
| + | SetUnitAttribute(self CONST_CREATEPZ false) | ||
| + | QueueMove(<-targetX < | ||
| + | endonce | ||
| + | |||
| + | if (GetQueuedMoveCount eq0) | ||
| + | #Done | ||
| + | Destroy(self 2) | ||
| + | |||
| + | SetCreeper(CurrentCoords < | ||
| + | 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 | ||
| + | </ | ||