# Convert Target Filter String To Unit Filter

Grammar — Convert Target Filter String targetFilterString|string To Unit Filter
FlagsFunction

Takes a target filter string (obtained from the catalog) and returns a unit filter.

# Arguments

  • string — Target Filter String

Returns — unitfilter

unitfilter libNtve_gf_ConvertTargetFilterStringToUnitFilter(
	string lp_targetFilterString,
);

Category: Unit / Filters

# Examples

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/ttosh03a.sc2map/MapScript.galaxy:466


    AISetFilterAlliance(lv_snipeFilter, c_playerGroupEnemy);
    AISetFilterBits(lv_snipeFilter, libNtve_gf_ConvertTargetFilterStringToUnitFilter(CatalogFieldValueGet(c_gameCatalogAbil, "Snipe", "TargetFilters[" + IntToString(0) + "]", lp_owner)));
    AISetFilterRange(lv_snipeFilter, lp_ghost, (StringToFixed(CatalogFieldValueGet(c_gameCatalogAbil, "Snipe", "Range[" + IntToString(0) + "]", lp_owner)) + 1.0));
    AISetFilterLifePerMarker(lv_snipeFilter, StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "SnipeDamage", "Amount", lp_owner)), lv_snipeMarker);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/ttosh03a.sc2mapMapScript.galaxy:466


    AISetFilterAlliance(lv_snipeFilter, c_playerGroupEnemy);
    AISetFilterBits(lv_snipeFilter, libNtve_gf_ConvertTargetFilterStringToUnitFilter(CatalogFieldValueGet(c_gameCatalogAbil, "Snipe", "TargetFilters[" + IntToString(0) + "]", lp_owner)));
    AISetFilterRange(lv_snipeFilter, lp_ghost, (StringToFixed(CatalogFieldValueGet(c_gameCatalogAbil, "Snipe", "Range[" + IntToString(0) + "]", lp_owner)) + 1.0));
    AISetFilterLifePerMarker(lv_snipeFilter, StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "SnipeDamage", "Amount", lp_owner)), lv_snipeMarker);

mods/core.sc2modbase.sc2data/TriggerLibs/NativeLib.galaxy:5759

    lv_weapon = 1;
    for ( ; ( (auto761381D2_ai >= 0 && lv_weapon <= auto761381D2_ae) || (auto761381D2_ai < 0 && lv_weapon >= auto761381D2_ae) ) ; lv_weapon += auto761381D2_ai ) {
        lv_weaponFilter = libNtve_gf_ConvertTargetFilterStringToUnitFilter(CatalogFieldValueGet(c_gameCatalogWeapon, UnitWeaponGet(lp_u, lv_weapon), "TargetFilters", UnitGetOwner(lp_u)));
        if ((UnitWeaponIsEnabled(lp_u, lv_weapon) == true) && (UnitFilterMatch(lp_s, UnitGetOwner(lp_u), lv_weaponFilter) == true)) {
            return true;

mods/core.stormmodbase.stormdata/TriggerLibs/NativeLib.galaxy:4897

    lv_weapon = 1;
    for ( ; ( (auto761381D2_ai >= 0 && lv_weapon <= auto761381D2_ae) || (auto761381D2_ai < 0 && lv_weapon >= auto761381D2_ae) ) ; lv_weapon += auto761381D2_ai ) {
        lv_weaponFilter = libNtve_gf_ConvertTargetFilterStringToUnitFilter(CatalogFieldValueGet(c_gameCatalogWeapon, UnitWeaponGet(lp_u, lv_weapon), "TargetFilters", UnitGetOwner(lp_u)));
        if ((UnitWeaponIsEnabled(lp_u, lv_weapon) == true) && (UnitFilterMatch(lp_s, UnitGetOwner(lp_u), lv_weaponFilter) == true)) {
            return true;

mods/liberty.sc2modbase.sc2data/TriggerLibs/LibertyLib.galaxy:967

        lv_itUpgrade = UserDataGetGameLink(libLbty_gv_starCraftEventsEventTable, lv_itInstance, "Upgrade", 1);
        lv_itMessage = (UserDataGetString(libLbty_gv_starCraftEventsEventTable, lv_itInstance, "Message", 1));
        lv_itMessageFilter = libNtve_gf_ConvertTargetFilterStringToUnitFilter(UserDataGetString(libLbty_gv_starCraftEventsEventTable, lv_itInstance, "MessageFilter", 1));
        if (((CatalogEntryIsValid(c_gameCatalogUpgrade, lv_itDisabler) == true) || (libNtve_gf_DateTimeisBetween(lv_curDateTime, lv_itStart, lv_itEnd) == false))) {
            continue;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:16782

            lv_userInstance = UserDataInstance(libCOMI_gv_c_DehakaConsumeEffectUserType, lv_i);
            lv_effectFilterString = UserDataGetString(libCOMI_gv_c_DehakaConsumeEffectUserType, lv_userInstance, "Filter", 1);
            lv_effectFilter = libNtve_gf_ConvertTargetFilterStringToUnitFilter(lv_effectFilterString);
            if ((UnitFilterMatch(lv_targetUnit, lv_dehakaPlayer, lv_effectFilter) == true)) {
                lv_effect = UserDataGetGameLink(libCOMI_gv_c_DehakaConsumeEffectUserType, lv_userInstance, "Effect", 1);

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicTactical.galaxy:151


    // Implementation
    return libNtve_gf_ConvertTargetFilterStringToUnitFilter(CatalogFieldValueGet(c_gameCatalogAbil, lp_abil, "TargetFilters[" + IntToString(lv_index) + "]", lp_owner));
}

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicTactical.galaxy:157

    // Automatic Variable Declarations
    // Implementation
    return libNtve_gf_ConvertTargetFilterStringToUnitFilter(CatalogFieldValueGet(c_gameCatalogEffect, (((lp_abil) + "@Search")), "SearchFilters", lp_owner));
}

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicTactical.galaxy:353

    lv_unitsInRange = AIGetFilterGroup(lv_rangeFilter, lp_nearByUnits);
    AISetFilterAlliance(lv_enemyNearbyFilter, c_playerGroupEnemy);
    AISetFilterBits(lv_enemyNearbyFilter, libNtve_gf_ConvertTargetFilterStringToUnitFilter(CatalogFieldValueGet(c_gameCatalogEffect, (((lp_abil) + "@Search")), "SearchFilters", lp_owner)));
    lv_enemiesNearby = AIGetFilterGroup(lv_enemyNearbyFilter, lv_unitsInRange);
    AISetFilterAlliance(lv_friendNearbyFilter, c_playerGroupAlly);