User Tools

Site Tools


4rpl:commands:findunitenemy

This is an old revision of the document!


Index

FindUnitEnemy

FindUnitEnemy(<-unit <-deepest <-firePriority) ->cellZ ->cellX

Description

Finds creeper and mesh within range of a unit. The range is specified on the unit (along with other line of sight options).

  • Deepest is a boolean. If true, then the deepest creeper will be found. If false the nearest creeper will be found.
  • FirePriority is either 0 or 1. If 0, then creeper has priority. If 1 then mesh has priority.

The returned cell coordinate is the cell of the found creeper or mesh. A value of -1 is returned for each returned int if no enemy is found in range.
Note: When deepest is specified this routine runs the same code as a mortar. When nearest, the same code as a cannon. That means that firePriority is interpreted differently in each case. For deepest (the mortar) firepriority chooses between targeting creeper or mesh (it picks one and ignores the other). For nearest (the cannon) firePriority will find either if the other (creeper or mesh) is not present.

Examples

FindUnitEnemy(self true 0) ->cellZ ->cellX

Index

4rpl/commands/findunitenemy.1610121708.txt.gz · Last modified: 2025/02/14 14:56 (external edit)