<- CRPL reference <- Unit Commands

Self

ArgumentsResultNotation
Unit UID for current unit – i1

Description

Pushes the unique unit ID (an int) for the current unit to the stack.

Examples

Trace current unit's ID

Self Trace

If the unit's ammo is full, destroy it

Self CONST_AMMO GetUnitAttribute ->ammo
Self CONST_MAXAMMO GetUnitAttribute ->maxAmmo

<-ammo <-maxAmmo gte if
    Self CONST_DESTROYMODE GetUnitAttribute ->destroyMode
    
    Self <-destroyMode Destroy
endif

Creates a unit then tells it its creator's UID in the “myCreator” variable

"CRPLCORE" CurrentCoords CreateUnit ->unit
<-unit "doThings.crpl" AddScriptToUnit
<-unit "doThings.crpl" "myCreator" Self SetScriptVar