UnitClassType (Civ5 Type)

From Civilization Modding Wiki
Revision as of 14:58, 19 September 2012 by DonQuich (talk | contribs) (Bot update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This page is a part of the Lua and UI Reference (Civ5).


ID.png The UnitClassType pseudo-type is actually a regular integer. Pseudo-types do not exist in Lua, they only serve a documentation purpose on the wiki!
  • DB.png Integers labeled as UnitClassType corresponds to the ID column of the UnitClasses XML table.


XML: the UnitClasses table

Here are the ID and Type columns found in this table.

ID Type
0 UNITCLASS_SETTLER
0 UNITCLASS_PROPHET
1 UNITCLASS_WORKER
1 UNITCLASS_MISSIONARY
2 UNITCLASS_WARRIOR
2 UNITCLASS_COMPOSITE_BOWMAN
3 UNITCLASS_SCOUT
3 UNITCLASS_GATLINGGUN
4 UNITCLASS_ARCHER
4 UNITCLASS_GALLEASS
5 UNITCLASS_SPEARMAN
5 UNITCLASS_GREAT_WAR_INFANTRY
6 UNITCLASS_CHARIOT_ARCHER
6 UNITCLASS_MARINE
7 UNITCLASS_SWORDSMAN
7 UNITCLASS_TRIPLANE
8 UNITCLASS_HORSEMAN
8 UNITCLASS_WWI_BOMBER
9 UNITCLASS_CATAPULT
9 UNITCLASS_WWI_TANK
10 UNITCLASS_KNIGHT
10 UNITCLASS_MACHINE_GUN
11 UNITCLASS_CROSSBOWMAN
11 UNITCLASS_PRIVATEER
12 UNITCLASS_PIKEMAN
12 UNITCLASS_INQUISITOR
13 UNITCLASS_TREBUCHET
13 UNITCLASS_GREAT_ADMIRAL
14 UNITCLASS_LONGSWORDSMAN
15 UNITCLASS_MUSKETMAN
16 UNITCLASS_CANNON
17 UNITCLASS_LANCER
18 UNITCLASS_RIFLEMAN
19 UNITCLASS_CAVALRY
20 UNITCLASS_INFANTRY
21 UNITCLASS_ARTILLERY
22 UNITCLASS_TANK
23 UNITCLASS_ANTI_TANK_GUN
24 UNITCLASS_ANTI_AIRCRAFT_GUN
25 UNITCLASS_PARATROOPER
26 UNITCLASS_FIGHTER
27 UNITCLASS_BOMBER
28 UNITCLASS_ATOMIC_BOMB
29 UNITCLASS_ROCKET_ARTILLERY
30 UNITCLASS_MECHANIZED_INFANTRY
31 UNITCLASS_MODERN_ARMOR
32 UNITCLASS_HELICOPTER_GUNSHIP
33 UNITCLASS_MOBILE_SAM
34 UNITCLASS_GUIDED_MISSILE
35 UNITCLASS_JET_FIGHTER
36 UNITCLASS_STEALTH_BOMBER
37 UNITCLASS_NUCLEAR_MISSILE
38 UNITCLASS_MECH
39 UNITCLASS_WORKBOAT
40 UNITCLASS_GALLEY
41 UNITCLASS_TRIREME
42 UNITCLASS_CARAVEL
43 UNITCLASS_FRIGATE
44 UNITCLASS_IRONCLAD
45 UNITCLASS_DESTROYER
46 UNITCLASS_BATTLESHIP
47 UNITCLASS_SUBMARINE
48 UNITCLASS_CARRIER
49 UNITCLASS_NUCLEAR_SUBMARINE
50 UNITCLASS_MISSILE_CRUISER
51 UNITCLASS_ARTIST
52 UNITCLASS_SCIENTIST
53 UNITCLASS_MERCHANT
54 UNITCLASS_ENGINEER
55 UNITCLASS_GREAT_GENERAL
56 UNITCLASS_SS_COCKPIT
57 UNITCLASS_SS_STASIS_CHAMBER
58 UNITCLASS_SS_ENGINE
59 UNITCLASS_SS_BOOSTER


Examples

Here are different ways to query the database to retrieve the ID from the type. Those examples will return and assign the integer value 0. See also GameInfo.

local id = GameInfo.UnitClasses.UNITCLASS_PROPHET.ID
local id = GameInfo["UnitClasses"].["UNITCLASS_PROPHET"].ID
local id = GameInfo.UnitClasses{Type="UNITCLASS_PROPHET"}().ID

Alternatively you could use the ID or the type to retrieve the value of the Description column. Those examples will return and assign the value TXT_KEY_UNIT_PROPHET.

local description = GameInfo.UnitClasses[0].Description
local description = GameInfo["UnitClasses"][0]["Description"]
local description = GameInfo.UnitClasses{ID=0}().Description


Used by

int Game.GetUnitClassCreatedCount(UnitClassType index)
bool Game.IsUnitClassMaxedOut(UnitClassType index, int extra)
int Player:GetUnitClassCount(UnitClassType index)
int Player:GetUnitClassCountPlusMaking(UnitClassType index)
int Player:GetUnitClassMaking(UnitClassType index)
bool Player:IsProductionMaxedUnitClass(UnitClassType unitClass)
bool Player:IsUnitClassMaxedOut(UnitClassType index, int extra)
int Team:GetUnitClassCount(UnitClassType index)
int Team:GetUnitClassCountPlusMaking(UnitClassType unitClass)
int Team:GetUnitClassMaking(UnitClassType unitClass)
bool Team:IsUnitClassMaxedOut(UnitClassType index, int extra)
int Unit:GetUnitClassModifier(UnitClassType index)
UnitClassType Unit:GetUnitClassType()
int Unit:UnitClassAttackModifier(UnitClassType unitClass)
int Unit:UnitClassDefenseModifier(UnitClassType unitClass)



The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.