<- CRPL reference <- Utility Commands

GetNearestGroundEnemy

ArgumentsResultNotation
X and Y coord of unit, search range, LOS_test, creeper, digitalis, anticreeper X and Y coord of target X1 Y1 R1 b1 b2 b3 b4 – X2 Y2

Description

A sophisticated multipurpose method used to create custom units like blasters. Given the location (X1,Y1), it can return the closest creeper, digitalis, or anticreeper in range, either with or without Testing Length of Sight.

If LOS_test is set to true, your custom weapon will not see the creeper at higher elevations, or hiding behind a wall of higher elevation.

Each of creeper, digitalis and anticreeper must be set to TRUE or FALSE. This controls which of the three is searched for. Any combination is legal.

If target is not found, (-1,-1) is returned.

Examples

#Create an enemy blaster that targets anticreeper
CurrentCoords 20 TRUE FALSE FALSE TRUE GetNearestGroundEnemy ->targetY ->targetX
<-targetY -1 neq <-targetX -1 neq and if
  <-targetY <-targetX @fire
endif