# Unit Type From String
Grammar — Unit type from s
Flags —Native|Function
Converts a string to a unit type. If the string does not match a valid unit type, the result will be empty.
# Arguments
string— String
Returns — string<gamelink::Unit>
native string UnitTypeFromString(string inString);
# 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/libertystory.sc2campaign — base.sc2data/TriggerLibs/CampaignLib.galaxy:8982
for ( ; ( (auto62551DF2_ai >= 0 && lv_index <= auto62551DF2_ae) || (auto62551DF2_ai < 0 && lv_index >= auto62551DF2_ae) ) ; lv_index += auto62551DF2_ai ) {
if ((BankKeyExists(lp_sourceBank, lv__SectionName, IntToString(lv_index)) == true)) {
libCamp_gf_TS_HelpUnitsPanel_AddEnabledUnitType(UnitTypeFromString(libCamp_gf_TS_LoadTransitionVarString(lp_sourceBank, lv__SectionName, IntToString(lv_index), "")));
}
campaigns/libertystory.sc2campaign — base.sc2data/TriggerLibs/CampaignLib.galaxy:9721
}
libCamp_gv_tS_StoryRoomUnitTypes[lv_roomIndex][libCamp_gv_tS_StoryRoomUnitTypeCount[lv_roomIndex]] = UnitTypeFromString(lv_item);
}
}
campaigns/swarmstory.sc2campaign — base.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:13186
lv_index = 1;
for ( ; ( (auto3D41700D_ai >= 0 && lv_index <= auto3D41700D_ae) || (auto3D41700D_ai < 0 && lv_index >= auto3D41700D_ae) ) ; lv_index += auto3D41700D_ai ) {
libSwaC_gf_ZS_HelpUnitsPanel_AddEnabledUnitType(UnitTypeFromString(libSwaC_gf_ZS_LoadTransitionVarString(lp_sourceBank, lv__SectionName, IntToString(lv_index), "")));
}
lv__SectionName = libSwaC_gf_ZS_BankSectionName(lp_map, "Tips");
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignLib.galaxy:7177
lv_index = 1;
for ( ; ( (autoE1BE8001_ai >= 0 && lv_index <= autoE1BE8001_ae) || (autoE1BE8001_ai < 0 && lv_index >= autoE1BE8001_ae) ) ; lv_index += autoE1BE8001_ai ) {
libVoiC_gf_ZS_HelpUnitsPanel_AddEnabledUnitType(UnitTypeFromString(libVoiC_gf_PC_LoadTransitionVarString(lp_sourceBank, lv__SectionName, IntToString(lv_index), "")));
}
lv__SectionName = libVoiC_gf_PC_BankSectionName(lp_map, "Tips");
mods/heroesbrawlmods/arenamodemods/arenashared.stormmod — base.stormdata/LibMArS.galaxy:83
}
if ((UnitGetType(lv_arenaHero) == UnitTypeFromString("HeroRagnaros"))) {
SetTalentEnabled(("RagnarosLavaWave"), false);
}
mods/heroesmapmods/battlegroundmapmods/blackheartsbay.stormmod — base.stormdata/LibBBAY.galaxy:494
lv_townHall = libGame_gv_townTownData[lv_town].lv_structureUnits[libGame_gv_townTownData[lv_town].lv_townHallIndex];
if ((UnitIsAlive(lv_townHall) == false)) {
UnitGroupRemove(lv_buildings, UnitGroupUnit(libNtve_gf_UnitsInRegionWithAllianceToPlayerMatchingCondition(UnitTypeFromString("RagnarosBigRag"), "", "", c_playerAny, c_unitAllianceAny, libGame_gv_townTownData[lv_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), 1));
return UnitGroupRandomUnit(lv_buildings, c_unitCountAlive);
}
mods/heroesmapmods/battlegroundmapmods/skytemple.stormmod — base.stormdata/LibMLCP.galaxy:1105
lv_townHall = libGame_gv_townTownData[lv_town].lv_structureUnits[libGame_gv_townTownData[lv_town].lv_townHallIndex];
if ((UnitIsAlive(lv_townHall) == false)) {
UnitGroupRemove(lv_buildings, UnitGroupUnit(libNtve_gf_UnitsInRegionWithAllianceToPlayerMatchingCondition(UnitTypeFromString("RagnarosBigRag"), "", "", c_playerAny, c_unitAllianceAny, libGame_gv_townTownData[lv_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), 1));
return UnitGroupClosestToPoint(lv_buildings, UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple));
}
mods/heroesmapmods/battlegroundmapmods/skytemple.stormmod — base.stormdata/LibMLCP.galaxy:1209
lv_townHall = libGame_gv_townTownData[lv_town].lv_structureUnits[libGame_gv_townTownData[lv_town].lv_townHallIndex];
if ((UnitIsAlive(lv_townHall) == false)) {
UnitGroupRemove(lv_buildings, UnitGroupUnit(libNtve_gf_UnitsInRegionWithAllianceToPlayerMatchingCondition(UnitTypeFromString("RagnarosBigRag"), "", "", c_playerAny, c_unitAllianceAny, libGame_gv_townTownData[lv_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), 1));
return libMLCP_gf_MMSkyTempleClosestUnits(lv_buildings, 3, UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple));
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:3567
// Implementation
return UnitTypeFromString(CatalogFieldValueGet(c_gameCatalogAbil, lv_link, "InfoArray[" + IntToString(lv_index) + "].Unit[" + IntToString(lp_unitIndex) + "]", lp_p));
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:7564
for ( ; ( (auto9AFF4A66_ai >= 0 && lv_catalogIndex <= auto9AFF4A66_ae) || (auto9AFF4A66_ai < 0 && lv_catalogIndex >= auto9AFF4A66_ae) ) ; lv_catalogIndex += auto9AFF4A66_ai ) {
lv_stringUnitID = (CatalogEntryGet(c_gameCatalogUnit, lv_catalogIndex));
if ((UnitTypeTestAttribute(UnitTypeFromString(lv_stringUnitID), c_unitAttributeMapBoss) == true)) {
continue;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:7567
continue;
}
else if ((UnitTypeTestAttribute(UnitTypeFromString(lv_stringUnitID), c_unitAttributeStructure) == true)) {
if ((libCOOC_gf_CC_UnitTypeIsTownHall((lv_stringUnitID)) == true) && (libNtve_gf_CatalogFieldValueGetAsReal(c_gameCatalogUnit, (lv_stringUnitID), "Speed", c_playerAny) <= 0.0)) {
lv_sightRange = libCOMI_gf_MinimumDifficultyValueCoopReal(9.0, 9.0, 7.0, 7.0, 7.0, 7.0);
mods/voidprologue.sc2mod — base.sc2data/LibA3DDD02B.galaxy:6312
lv_index = 1;
for ( ; ( (auto3D41700D_ai >= 0 && lv_index <= auto3D41700D_ae) || (auto3D41700D_ai < 0 && lv_index >= auto3D41700D_ae) ) ; lv_index += auto3D41700D_ai ) {
libA3DDD02B_gf_PP_HelpUnitPanel_AddEnabledUnitType(UnitTypeFromString(libA3DDD02B_gf_PP_LoadTransitionVarString(lp_sourceBank, lv__SectionName, IntToString(lv_index), "")));
}
lv__SectionName = libA3DDD02B_gf_PP_BankSectionName(lp_map, "Tips");