From ZDoom Wiki
Jump to navigation Jump to search

int ThingCountSector (int type, int tid, int tag)


Counts the number of actors in a given sector matching the given criteria. Only actors whose health is above 0 are counted.


  • type: The type of actor to count. Use T_NONE to count actors of any type.
  • tid: The Thing ID of the actor(s) to count. Use 0 to count actors regardless of TID.
  • tag: The tag of the sector(s) to count actors in.

Return value

Returns the number of actors in the given sector(s) matching the given criteria.


This line counts the number of cacodemons with a tid of 62 in all sectors with a tag of 11:

int CacosPresent = ThingCountSector (T_CACODEMON, 62, 11);

This line counts every actor in sectors with tag 40:

int AllActors = ThingCountSector (T_NONE, 0, 40);