# Unit Type Cost
Grammar — inCostType cost of inUnitType
Flags —Native
|Function
Returns the cost of a unit type.
# Arguments
string
<gamelink::Unit> — Unit Typeint
<preset::UnitCostType> — Resource Type
Returns — int
native int UnitTypeGetCost(
string inUnitType,
int inCostType,
);
# Related
Category: Unit / Properties
- Unit Type Of Unit —
string
<gamelink::Unit> — UnitGetType - Unit Tag —
int
— UnitGetTag - Unit Seed —
int
— UnitGetSeed - Unit Property Changes —
void
— TriggerAddEventUnitProperty - Triggering Unit Property —
int
<preset::Unit_Property> — EventUnitProperty - Triggering Unit Property Change (Integer) —
int
— EventUnitPropertyChangeInt - Triggering Unit Property Change (Real) —
fixed
— EventUnitPropertyChangeFixed - Set Unit Property —
void
— UnitSetPropertyFixed - Set Unit State —
void
— UnitSetState - Set Unit Seed —
void
— UnitSetSeed - Reset Unit Seed —
void
— UnitResetSeed - Make Unit Invulnerable —
void
— libNtve_gf_MakeUnitInvulnerable - Make Unit Uncommandable —
void
— libNtve_gf_MakeUnitUncommandable - Unit Property —
fixed
— UnitGetPropertyFixed - Unit Property (Int) —
int
— UnitGetPropertyInt - Unit Type Property —
fixed
— UnitTypeGetProperty - Unit Classification Check —
bool
— UnitTestState - Unit Type Classification Check —
bool
— UnitTypeTestFlag - Unit Type Attribute Check —
bool
— UnitTypeTestAttribute - Unit Targetable Check —
bool
— UnitTestPlane - Unit Is Invulnerable —
bool
— libNtve_gf_UnitIsInvulnerable - Unit Kills —
int
— libNtve_gf_UnitGetPropertyKills - Unit Resources —
int
— libNtve_gf_UnitGetPropertyResources - Unit Attachment Point —
point
— UnitGetAttachmentPoint - Name Of Unit Type —
text
— UnitTypeGetName - Gender Code Of Unit Type —
string
— UnitTypeGetGenderCode - Unit Type Cost —
int
— UnitTypeGetCost - Unit Type Is Affected By Upgrade —
bool
— UnitTypeIsAffectedByUpgrade - Reset Movement Speed —
void
— UnitResetSpeed - Unit Uses Mover —
bool
— UnitMoverExists - Unit Type Uses Mover —
bool
— libNtve_gf_UnitMoverExists - Unit Type From String —
string
<gamelink::Unit> — UnitTypeFromString - Set Unit Color —
void
— UnitSetTeamColorIndex - Set Unit Info Button - Ability Tooltip —
void
— libNtve_gf_SetUnitInfoButtonAbilityTooltip - Set Unit Info Button - Button Tooltip —
void
— libNtve_gf_SetUnitInfoButtonButtonTooltip - Set Unit Info Button - Item Tooltip —
void
— libNtve_gf_SetUnitInfoButtonItemTooltip - Reset Unit Info Button - Ability Tooltip —
void
— libNtve_gf_ResetUnitInfoButtonAbilityTooltip - Reset Unit Info Button - Button Tooltip —
void
— libNtve_gf_ResetUnitInfoButtonButtonTooltip - Reset Unit Info Button - Item Tooltip —
void
— libNtve_gf_ResetUnitInfoButtonItemTooltip - Set Unit Command Button Tooltip —
void
— UnitSetInfoButtonTooltip - Reset Unit Command Button Tooltip —
void
— UnitClearInfoButtonTooltip - Set Unit Highlight Cursor —
void
— UnitSetCursor - Set Unit Ping Cursor —
void
— UnitSetPingCursor - Set Unit Info —
void
— UnitSetInfoText - Set Unit Info Text —
void
— UnitSetInfoText2 - Set Unit Info Tip —
void
— UnitSetInfoTip - Set Unit Info SubTip —
void
— UnitSetInfoSubTip - Clear Unit Info —
void
— UnitClearInfoText - Set Unit Status Bar State (Deprecated) —
void
— UnitForceStatusBar - Show Unit Status Bar —
void
— UnitStatusBarOverride - Hide Unit Status Bar —
void
— UnitStatusBarClearOverride - Set Unit Scale —
void
— UnitSetScale - Set Unit Model Variation —
void
— libNtve_gf_UnitSetVariation - Change Unit Height —
void
— UnitSetHeight - Height Of Unit —
fixed
— UnitGetHeight - Change Unit Damage —
void
— libNtve_gf_ChangeUnitDamage - Add On Child —
unit
— UnitAddOnChild - Add On Parent —
unit
— UnitAddOnParent
# Examples
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul02.sc2map/MapScript.galaxy:547
}
PlayerModifyPropertyInt(gv_p1_USER, c_playerPropMinerals, c_playerPropOperAdd, UnitTypeGetCost("Nexus", c_unitCostMinerals));
libNtve_gf_SetAlliance(gv_p1_USER, gv_p5_ABANDONED_STRUCTURES, libNtve_ge_AllianceSetting_Neutral);
libNtve_gf_SetAlliance(gv_p1_USER, gv_p7_NEUTRAL, libNtve_ge_AllianceSetting_Neutral);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul02.sc2map — MapScript.galaxy:547
}
PlayerModifyPropertyInt(gv_p1_USER, c_playerPropMinerals, c_playerPropOperAdd, UnitTypeGetCost("Nexus", c_unitCostMinerals));
libNtve_gf_SetAlliance(gv_p1_USER, gv_p5_ABANDONED_STRUCTURES, libNtve_ge_AllianceSetting_Neutral);
libNtve_gf_SetAlliance(gv_p1_USER, gv_p7_NEUTRAL, libNtve_ge_AllianceSetting_Neutral);
campaigns/swarm.sc2campaign — base.sc2maps/maps/campaign/swarm/zlab03.sc2map/MapScript.galaxy:2723
}
if (!((PlayerGetPropertyInt(EventPlayer(), c_playerPropMinerals) >= UnitTypeGetCost("SpineCrawler", c_unitCostMinerals)))) {
return false;
}
campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zlab03.sc2map — MapScript.galaxy:2723
}
if (!((PlayerGetPropertyInt(EventPlayer(), c_playerPropMinerals) >= UnitTypeGetCost("SpineCrawler", c_unitCostMinerals)))) {
return false;
}
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignLib.galaxy:10690
DataTableSetInt(true, ("UnitMade_" + lv_iD), lv_previousValue);
lv_previousValue = DataTableGetInt(true, ("MinSpent_" + lv_iD));
DataTableSetInt(true, ("MinSpent_" + lv_iD), (lv_previousValue+UnitTypeGetCost(UnitGetType(EventUnitCreatedUnit()), c_unitCostMinerals)));
lv_previousValue = DataTableGetInt(true, ("VesSpent_" + lv_iD));
DataTableSetInt(true, ("VesSpent_" + lv_iD), (lv_previousValue+UnitTypeGetCost(UnitGetType(EventUnitCreatedUnit()), c_unitCostVespene)));
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignLib.galaxy:10692
DataTableSetInt(true, ("MinSpent_" + lv_iD), (lv_previousValue+UnitTypeGetCost(UnitGetType(EventUnitCreatedUnit()), c_unitCostMinerals)));
lv_previousValue = DataTableGetInt(true, ("VesSpent_" + lv_iD));
DataTableSetInt(true, ("VesSpent_" + lv_iD), (lv_previousValue+UnitTypeGetCost(UnitGetType(EventUnitCreatedUnit()), c_unitCostVespene)));
return true;
}
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignLib.galaxy:10750
lv_previousValue = DataTableGetInt(true, ("DmgDone_" + lv_triggeringArmyString));
DataTableSetInt(true, ("DmgDone_" + lv_triggeringArmyString), (lv_previousValue+FixedToInt(EventUnitDamageAmount())));
lv_mineralValue = (EventUnitDamageAmount()*UnitTypeGetCost(UnitGetType(EventUnit()), c_unitCostMinerals)/UnitGetPropertyFixed(EventUnit(), c_unitPropLifeMax, c_unitPropCurrent));
lv_previousValue = DataTableGetInt(true, ("MinDone_" + lv_triggeringArmyString));
DataTableSetInt(true, ("MinDone_" + lv_triggeringArmyString), (lv_previousValue+FixedToInt(lv_mineralValue)));
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignLib.galaxy:10753
lv_previousValue = DataTableGetInt(true, ("MinDone_" + lv_triggeringArmyString));
DataTableSetInt(true, ("MinDone_" + lv_triggeringArmyString), (lv_previousValue+FixedToInt(lv_mineralValue)));
lv_vespeneValue = (EventUnitDamageAmount()*UnitTypeGetCost(UnitGetType(EventUnit()), c_unitCostVespene)/UnitGetPropertyFixed(EventUnit(), c_unitPropLifeMax, c_unitPropCurrent));
lv_previousValue = DataTableGetInt(true, ("VesDone_" + lv_triggeringArmyString));
DataTableSetInt(true, ("VesDone_" + lv_triggeringArmyString), (lv_previousValue+FixedToInt(lv_vespeneValue)));
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignLib.galaxy:10867
DataTableSetInt(true, ("UnitDied_" + lv_triggeringArmyString), (lv_previousValue+1));
lv_previousValue = DataTableGetInt(true, ("MinLost_" + lv_triggeringArmyString));
DataTableSetInt(true, ("MinLost_" + lv_triggeringArmyString), (lv_previousValue+UnitTypeGetCost(UnitGetType(EventUnit()), c_unitCostMinerals)));
lv_previousValue = DataTableGetInt(true, ("VesLost_" + lv_triggeringArmyString));
DataTableSetInt(true, ("VesLost_" + lv_triggeringArmyString), (lv_previousValue+UnitTypeGetCost(UnitGetType(EventUnit()), c_unitCostVespene)));
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignLib.galaxy:10869
DataTableSetInt(true, ("MinLost_" + lv_triggeringArmyString), (lv_previousValue+UnitTypeGetCost(UnitGetType(EventUnit()), c_unitCostMinerals)));
lv_previousValue = DataTableGetInt(true, ("VesLost_" + lv_triggeringArmyString));
DataTableSetInt(true, ("VesLost_" + lv_triggeringArmyString), (lv_previousValue+UnitTypeGetCost(UnitGetType(EventUnit()), c_unitCostVespene)));
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:91
libCOMI_gv_catalogAdditiveBonusPrefix = "CatalogAdditiveBonus";
libCOMI_gv_candyChargeCmd = AbilityCommand("MutatorBuyCandy", 0);
libCOMI_gv_supplicantWarpTrainActualUnitCost = UnitTypeGetCost("Supplicant", c_unitCostMinerals);
libCOMI_gv_supplicantWarpTrainActualCommand = AbilityCommand("WarpGateTrainSupplicantTrue", 11);
libCOMI_gv_cM_PrestigeRaynor_AirUnits = UnitGroupEmpty();
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:2091
UnitSetPropertyFixed(UnitLastCreated(), c_unitPropEnergyPercent, 100.0);
UnitGroupAdd(lv_attackForce, UnitLastCreated());
lv_resourcesForPlayer[lv_playerIter] -= UnitTypeGetCost(lv_unitTypeToCreate, c_unitCostSumMineralsVespene);
lv_unitCount -= 1;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:2188
UnitSetPropertyFixed(lv_unitCreated, c_unitPropEnergyPercent, 100.0);
UnitGroupAdd(lv_attackForce, lv_unitCreated);
lv_resourcesForPlayer[lv_playerIter] -= UnitTypeGetCost(lv_unitTypeToCreate, c_unitCostSumMineralsVespene);
lv_unitCount -= 1;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:2642
}
if ((UnitTypeGetCost(lv_unitTypesForWave[lv_unitPercentBaseIter], c_unitCostSumMineralsVespene) > 0)) {
lv_unitPercentBaseCreateCount = MaxI(TruncI((lv_unitTypePercentBase[lv_unitPercentBaseIter] * lv_waveResourceTotal / UnitTypeGetCost(lv_unitTypesForWave[lv_unitPercentBaseIter], c_unitCostSumMineralsVespene))), 1);
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:2643
if ((UnitTypeGetCost(lv_unitTypesForWave[lv_unitPercentBaseIter], c_unitCostSumMineralsVespene) > 0)) {
lv_unitPercentBaseCreateCount = MaxI(TruncI((lv_unitTypePercentBase[lv_unitPercentBaseIter] * lv_waveResourceTotal / UnitTypeGetCost(lv_unitTypesForWave[lv_unitPercentBaseIter], c_unitCostSumMineralsVespene))), 1);
}
else {
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:2654
if ((lv_unitTypePerWaveLimit[lv_unitPercentBaseIter] > 0)) {
lv_unitTypePerWaveLimit[lv_unitPercentBaseIter] -= 1;
lv_waveResourceUsed += UnitTypeGetCost(lv_unitTypesForWave[lv_unitPercentBaseIter], c_unitCostSumMineralsVespene);
libCOMI_gf_CM_CoopAI_AttackForce_AddUnitType(lv_unitTypesForWave[lv_unitPercentBaseIter], 1);
if ((lv_waveResourceUsed > lv_waveResourceTotal)) {
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:2690
}
}
if ((lv_randomUnitFailsafeBreakout == true) && ((lv_randomUnitType == null) || (UnitTypeGetCost(lv_randomUnitType, c_unitCostSumMineralsVespene) <= 0))) {
TriggerDebugOutput(3, StringExternal("Param/Value/lib_COMI_6B70C116"), libCOMI_gv_showAIDebugging);
break;
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:2694
break;
}
else if (((lv_randomUnitType == null) || (UnitTypeGetCost(lv_randomUnitType, c_unitCostSumMineralsVespene) <= 0))) {
lv_randomUnitTryCount += 1;
continue;
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:2699
}
else if (true) {
lv_waveResourceUsed += UnitTypeGetCost(lv_randomUnitType, c_unitCostSumMineralsVespene);
lv_unitTypePerWaveLimit[lv_randomUnitIter] -= 1;
libCOMI_gf_CM_CoopAI_AttackForce_AddUnitType(lv_randomUnitType, 1);
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:2998
}
if ((UnitTypeGetCost(lv_unitTypesForWave[lv_unitPercentBaseIter], c_unitCostSumMineralsVespene) > 0)) {
lv_unitPercentBaseCreateCount = MaxI(TruncI((lv_unitTypePercentBase[lv_unitPercentBaseIter] * lv_waveResourceTotal / UnitTypeGetCost(lv_unitTypesForWave[lv_unitPercentBaseIter], c_unitCostSumMineralsVespene))), 1);
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:1183
}
if ((UnitTypeGetCost(UnitGetType(lp_orderedUnit), c_unitCostVespene) > 0) && (PlayerGetPropertyInt(lv_microPlayer, c_playerPropVespene) > 0) && (UnitGetType(lp_orderedUnit) != "Roach") && (UnitGetType(lp_orderedUnit) != "RoachVile")) {
lv_useVespene = true;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:4399
libCOMU_gf_CT_RegisterSpawnedUnit(UnitLastCreated());
UnitGroupAdd(libCOMU_gv_cT_VoidRiftLastSpawnedUnits, UnitLastCreated());
lv_resourceValue -= UnitTypeGetCost(lv_spawnType, c_unitCostMinerals);
lv_resourceValue -= UnitTypeGetCost(lv_spawnType, c_unitCostVespene);
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:4400
UnitGroupAdd(libCOMU_gv_cT_VoidRiftLastSpawnedUnits, UnitLastCreated());
lv_resourceValue -= UnitTypeGetCost(lv_spawnType, c_unitCostMinerals);
lv_resourceValue -= UnitTypeGetCost(lv_spawnType, c_unitCostVespene);
}
}