User Tools

Site Tools


crpl:docs:damage

<- CRPL reference <- Unit Commands

Damage

Arguments Result Notation
Unit UID to Damage, Amt of damage n1 n2--

Description

Damages the specified unit. WARNING: ENSURE YOU HAVE SAVED THE MAP BEFORE CALLING THIS! This call may cause units to be destroyed! Typical health values for most units are either 0 or 1. Units that have a health of 0 will be destroyed with Damage is called. Other units will have damage deducted from their health. Note that positive values cause damage. If a negative value is passed in, the resulting unit's health increases.

Examples

$COLLISION_RADIUS:1
$DAMAGE_AMT:0.1

do (GetUnitsInRange(CurrentCoords <-COLLISION_RADIUS) 0)
   # GetUnitsInRange returns a list of unit UIDs on the stack.  
   # Pop each one off and cause damage to the associated unit.
   ->unitUID
   Damage(<-unitUID <-DAMAGE_AMT)
loop
crpl/docs/damage.txt · Last modified: 2021/02/05 11:44 by Karsten75