User Tools

Site Tools


~~DISCUSSION~~ <- CRPL reference <- Unit Commands


Arguments Result Notation
Unit UID to Destroy, Explosion Mode (0,1,2,3) n1 n2 –


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, 0 means no explosion and no sound, 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.

Bug warning: There is some issue when deleting a docked guppy or a guppy base, the Destroy function is called again on the next pair of numbers on the stack and can potentially destroy another unit! I recommend using the SafeDestroy function from the example when deleting guppies, strafers or bobmers just to be safe.


	SetUnitAttribute(self CONST_CREATEPZ false)
	QueueMove(<-targetX <-targetY <-speed)
if (GetQueuedMoveCount eq0)
	Destroy(self 2)
	SetCreeper(CurrentCoords <-payload)
# Gets around the bug with guppies and works for other units as well
:SafeDestroy # uid mode -
    StackSize ->SD_Size # stack size without the arguments
    -1 -1 # extra pair of arguments to be consumed if needed
    <-SD_Uid <-SD_Mode Destroy # this may or may not consume the additinal arguments
    StackSize <-SD_Size do # remove extra arguments if not consumed by Destroy
crpl/docs/destroy.txt · Last modified: 2020/05/30 20:02 by Sanian