ThingCountName

From ZDoom Wiki
Jump to navigation Jump to search

int ThingCountName (str classname, int tid)

Usage

ThingCountName counts all things specified on the map. Monsters are specified by their names (see Classes), or by name and tid.

ThingCountName will not count dead monsters, even though their things still exist and can be used, for instance, by SpawnSpot.

Example

For example let's say you have a map with 10 enemies:

Imp - tid 5
Imp - tid 5
Imp - tid 0
Baron - tid 5
Baron - tid 5
Baron - tid 4
Baron - tid 0
Demon - tid 5
Demon - tid 4
Demon - tid 0

Here are some example values:

ThingCountName("DoomImp", 0) = 3
ThingCountName("BaronOfHell", 0) = 4
ThingCountName("Demon", 0) = 3
ThingCountName("DoomImp", 5) = 2
ThingCountName("Demon", 4) = 1
ThingCountName("DoomImp", 4) = 0

Notice that specifying a tid of 0 means that ThingCountName will just ignore the tid and count all instances of the specified thing, as opposed to only counting things with a tid of 0.

See also