# Unit Can Create Effect On Unit

Grammarcaster can create effect on target
FlagsFunction

Returns true if the specified unit can execute the specified effect on the specified target unit.

# Arguments

  • unit — Caster
  • string<gamelink::Effect> — Effect
  • unit — Target

Returns — bool

bool libNtve_gf_UnitCanCreateEffectOnUnit(
	unit lp_caster,
	string lp_effect,
	unit lp_target,
);

Category: Environment / Effects

# Examples

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

            lv_currentattacktargetunit = UnitGroupUnitFromEnd(auto75294CD3_g, auto75294CD3_u);
            if (lv_currentattacktargetunit == null) { break; }
            if ((libNtve_gf_UnitCanCreateEffectOnUnit(lv_currentattacktargetunit, "ThreatTest", lp_attacker) == true) && ((UnitFilterMatch(lv_currentattacktargetunit, UnitGetOwner(lp_attacker), UnitFilter(0, 0, (1 << c_targetFilterCloaked), 0)) == true) || (libNtve_gf_UnitIsVisibleToPlayer(lv_currentattacktargetunit, UnitGetOwner(lp_attacker)) == true))) {
                lv_currentpathingdistance = AIPathingCostUnit(lp_attacker, UnitGetPosition(lv_currentattacktargetunit), c_ignoreEnemyBuildings);
                if ((lv_currentpathingdistance < lp_satisfiedPathingDistance)) {

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

        }

        if ((UnitIsAlive(lv_bestattacktargetunit) == true) && (libNtve_gf_UnitCanCreateEffectOnUnit(lv_bestattacktargetunit, "ThreatTest", lp_attacker) == true) && ((UnitFilterMatch(lv_bestattacktargetunit, UnitGetOwner(lp_attacker), UnitFilter(0, 0, (1 << c_targetFilterCloaked), 0)) == true) || (libNtve_gf_UnitIsVisibleToPlayer(lv_bestattacktargetunit, UnitGetOwner(lp_attacker)) == true))) {
            while ((UnitIsAlive(lp_attacker) == true) && (UnitIsAlive(lv_bestattacktargetunit) == true) && (libNtve_gf_UnitCanCreateEffectOnUnit(lv_bestattacktargetunit, "ThreatTest", lp_attacker) == true) && ((UnitFilterMatch(lv_bestattacktargetunit, UnitGetOwner(lp_attacker), UnitFilter(0, 0, (1 << c_targetFilterCloaked), 0)) == true) || (libNtve_gf_UnitIsVisibleToPlayer(lv_bestattacktargetunit, UnitGetOwner(lp_attacker)) == true))) {
                UnitIssueOrder(lp_attacker, OrderTargetingPoint(AbilityCommand("attack", 0), UnitGetPosition(lv_bestattacktargetunit)), c_orderQueueReplace);

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


        if ((UnitIsAlive(lv_bestattacktargetunit) == true) && (libNtve_gf_UnitCanCreateEffectOnUnit(lv_bestattacktargetunit, "ThreatTest", lp_attacker) == true) && ((UnitFilterMatch(lv_bestattacktargetunit, UnitGetOwner(lp_attacker), UnitFilter(0, 0, (1 << c_targetFilterCloaked), 0)) == true) || (libNtve_gf_UnitIsVisibleToPlayer(lv_bestattacktargetunit, UnitGetOwner(lp_attacker)) == true))) {
            while ((UnitIsAlive(lp_attacker) == true) && (UnitIsAlive(lv_bestattacktargetunit) == true) && (libNtve_gf_UnitCanCreateEffectOnUnit(lv_bestattacktargetunit, "ThreatTest", lp_attacker) == true) && ((UnitFilterMatch(lv_bestattacktargetunit, UnitGetOwner(lp_attacker), UnitFilter(0, 0, (1 << c_targetFilterCloaked), 0)) == true) || (libNtve_gf_UnitIsVisibleToPlayer(lv_bestattacktargetunit, UnitGetOwner(lp_attacker)) == true))) {
                UnitIssueOrder(lp_attacker, OrderTargetingPoint(AbilityCommand("attack", 0), UnitGetPosition(lv_bestattacktargetunit)), c_orderQueueReplace);
                Wait((lv_safethinkperiod + RandomFixed(-0.125, 0.125)), c_timeGame);

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

        }

        if (!((libNtve_gf_UnitCanCreateEffectOnUnit(lv_caster, "ObserverTargetLockCPOrderValidate", lv_target) == true))) {
            return false;
        }

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

    }

    if ((libNtve_gf_UnitCanCreateEffectOnUnit(lv_caster, "ObserverTargetLockCP", lv_target) == false)) {
        UnitCreateEffectUnit(lv_caster, "ObserverTargetLockDP", lv_caster);
    }

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

        }

        if (!((libNtve_gf_UnitCanCreateEffectOnUnit(lv_caster, "RavenTargetLockCPOrderValidate", lv_target) == true))) {
            return false;
        }

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

    }

    if ((libNtve_gf_UnitCanCreateEffectOnUnit(lv_caster, "RavenAnalyzeCP", lv_target) == false)) {
        UnitCreateEffectUnit(lv_caster, "RavenAnalyzeDP", lv_caster);
    }

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


    UnitSetOwner(lv_missile, lv_p, true);
    if ((libNtve_gf_UnitCanCreateEffectOnUnit(lv_missile, lv_effect, lv_reflectTarget) == true)) {
        UnitCreateEffectUnit(lv_missile, lv_effect, lv_reflectTarget);
    }

mods/warcoop/warclassic.sc2modbase.sc2data/TriggerLibs/WarClassic.galaxy:144

    // Automatic Variable Declarations
    // Implementation
    return libNtve_gf_UnitCanCreateEffectOnUnit(lp_unit, "TriggerValidatorUnitIsChanneling", lp_unit);
}