Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

find

From Quake Wiki

entity find(entity start, .string fieldName, string fieldValue)

Usage[edit]

Searches through the entity list, finding the first entity whose field name has the passed field value. Can be used to iterate through every entity in the map to find specific ones e.g. an entity's targets when it activates.

Parameters[edit]

  • start
The entity to start from in the list, exclusive. Passing world will start from the very first entity.
  • fieldName
The name of the string field on the entity to check. This is a symbol e.g. if you wanted to check an entity's targetname field, you would pass targetname.
  • fieldValue
The value that the entity's field must be set to in order to be considered a match.

Return[edit]

The first entity found starting after start whose field has the passed value.

Example[edit]

// This finds every target the entity has and sets their health to 200
for (entity it = find(world, targetname, self.target); it; it = find(it, targetname, self.target))
    it.health = 200;