GetPlayerTechCount

Parameters
whichPlayerplayer

The player whose tech level to query.

techidinteger

Rawcode ID of the tech. Either an upgrade like Iron Plating 'Rhar', a unit type like Footman 'hfoo' or one of the following special equivalency IDs:

  • 'HERO' - any hero
  • 'TALT' - any altar
  • 'TWN1' - town hall tier 1
  • 'TWN2' - town hall tier 2
  • etc.
  • 'TWN9' - town hall tier 9, see BlzGetPlayerTownHallCount
specificonlyboolean
  • true: only exact matches are considered
  • false: also counts dependency equivalents:
    • the Human Guard Tower 'hgtw' will also be counted when querying for the Scout Tower 'hwtw' (even if the Guard Tower is preplaced, i.e. not doing the upgrade on runtime, so this checks the Techtree - Upgrades To 'uupt' field?).
    • Higher tier townhalls will be considered when querying for lower tier thownhalls, i.e. querying for tier 1 Great Hall 'ogre' will also consider tier 2 Stronghold 'ostr' and tier 3 Fortress 'ofrt'.
    • Ability morph does not seem to be considered when specificonly is false, tested with Berserker Upgrade of Headhunter.
  • always: "Techtree - Dependency Equivalents" 'udep' seems to be considered even if specificonly is true, i.e. when you set Scout Tower as an equivalent for Farm 'hhou', querying for 'hhou' will also consider Scout Towers.
comment

Returns level of player's tech. This can be an upgrade, a unit type or an equivalent as selected in tech requirement fields.

  • For an upgrade: returns player's upgrade level, or 0 if the player has not researched the upgrade at all.
  • For unit type: returns amount of units of this type (or their type equivalents) under player's control.
note

Internally, specificonly=true only sets flag 16, while false sets flags 8 and 16 for lookups.

note

See: For unit type equivalents "Techtree - Dependency Equivalents" aka 'udep' aka "DependencyOr".

patch

1.00

Source
common.j (suggest an edit or discuss on Github)
return type
integer
Source code
constant native GetPlayerTechCount      takes player whichPlayer, integer techid, boolean specificonly returns integer