# Add Charge Used For Unit

Grammar — Add inVal charges used for charge inCharge on unit inUnit
FlagsNative | Action

Consumes the specified number of charges for the specified unit charge link.

# Arguments

  • unit — Unit
  • string<charge> — Charge
  • fixed — Value

Returns — void

native void UnitAddChargeUsed(
	unit inUnit,
	string inCharge,
	fixed inVal,
);

Category: Unit / Charges And Cooldowns

# Examples

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner05s.sc2map/MapScript.galaxy:1456

    SoundPlay(SoundLink("TUISecret", 0), PlayerGroupAll(), 100.0, 0.0);
    if ((libNtve_gf_DifficultyValueInt(1, 1, 0, 0) == 1)) {
        UnitAddChargeUsed(gv_raynor, "RaynorTossGrenade", -3.0);
    }
    else {

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner05s.sc2map/MapScript.galaxy:1459

    }
    else {
        UnitAddChargeUsed(gv_raynor, "RaynorTossGrenade", -2.0);
    }
    Wait(1.0, c_timeGame);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner05s.sc2map/MapScript.galaxy:1532

    SoundPlay(SoundLink("TUISecret", 0), PlayerGroupAll(), 100.0, 0.0);
    if ((libNtve_gf_DifficultyValueInt(1, 1, 0, 0) == 1)) {
        UnitAddChargeUsed(gv_raynor, "RaynorPlasmaGun", -3.0);
    }
    else {

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner05s.sc2map/MapScript.galaxy:1535

    }
    else {
        UnitAddChargeUsed(gv_raynor, "RaynorPlasmaGun", -2.0);
    }
    Wait(1.0, c_timeGame);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner05s.sc2map/MapScript.galaxy:1608

    SoundPlay(SoundLink("TUISecret", 0), PlayerGroupAll(), 100.0, 0.0);
    if ((libNtve_gf_DifficultyValueInt(1, 1, 0, 0) == 1)) {
        UnitAddChargeUsed(gv_raynor, "RaynorTimeBomb", -1.0);
    }
    else {

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner05s.sc2map/MapScript.galaxy:1611

    }
    else {
        UnitAddChargeUsed(gv_raynor, "RaynorTimeBomb", -1.0);
    }
    Wait(1.0, c_timeGame);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner05s.sc2mapMapScript.galaxy:1456

    SoundPlay(SoundLink("TUISecret", 0), PlayerGroupAll(), 100.0, 0.0);
    if ((libNtve_gf_DifficultyValueInt(1, 1, 0, 0) == 1)) {
        UnitAddChargeUsed(gv_raynor, "RaynorTossGrenade", -3.0);
    }
    else {

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner05s.sc2mapMapScript.galaxy:1459

    }
    else {
        UnitAddChargeUsed(gv_raynor, "RaynorTossGrenade", -2.0);
    }
    Wait(1.0, c_timeGame);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner05s.sc2mapMapScript.galaxy:1532

    SoundPlay(SoundLink("TUISecret", 0), PlayerGroupAll(), 100.0, 0.0);
    if ((libNtve_gf_DifficultyValueInt(1, 1, 0, 0) == 1)) {
        UnitAddChargeUsed(gv_raynor, "RaynorPlasmaGun", -3.0);
    }
    else {

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner05s.sc2mapMapScript.galaxy:1535

    }
    else {
        UnitAddChargeUsed(gv_raynor, "RaynorPlasmaGun", -2.0);
    }
    Wait(1.0, c_timeGame);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner05s.sc2mapMapScript.galaxy:1608

    SoundPlay(SoundLink("TUISecret", 0), PlayerGroupAll(), 100.0, 0.0);
    if ((libNtve_gf_DifficultyValueInt(1, 1, 0, 0) == 1)) {
        UnitAddChargeUsed(gv_raynor, "RaynorTimeBomb", -1.0);
    }
    else {

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner05s.sc2mapMapScript.galaxy:1611

    }
    else {
        UnitAddChargeUsed(gv_raynor, "RaynorTimeBomb", -1.0);
    }
    Wait(1.0, c_timeGame);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zspace01.sc2map/MapScript.galaxy:819

    auto76730D7A_n = (gf_HyperionFighterCountMax() - gf_HyperionFighterCountCurrent());
    for (auto76730D7A_i = 1; auto76730D7A_i <= auto76730D7A_n; auto76730D7A_i += 1) {
        UnitAddChargeUsed(gv_hyperion, "SJHyperionFighters", -1.0);
    }
}

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zspace01.sc2map/MapScript.galaxy:3161

    gv_hyperionFighterRecalling = false;
    if ((gf_HyperionFighterCountCurrent() < gf_HyperionFighterCountMax())) {
        UnitAddChargeUsed(gv_hyperion, "SJHyperionFighters", -1.0);
    }

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zspace01.sc2map/MapScript.galaxy:3413

    }

    UnitAddChargeUsed(gv_hyperion, "SJHyperionFighters", -1.0);
    TriggerStop(gt_LaunchHyperionFighters);
    gf_RecallHyperionFighters();

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zspace01.sc2map/MapScript.galaxy:3566


    gv_tacFightersLost += 1;
    UnitAddChargeUsed(gv_hyperion, "SJHyperionFighters", 1.0);
    if ((UnitGroupCount(gv_hyperionFighterGroup, c_unitCountAlive) == 0)) {
        gf_RecallHyperionFighters();

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zspace01.sc2mapMapScript.galaxy:819

    auto76730D7A_n = (gf_HyperionFighterCountMax() - gf_HyperionFighterCountCurrent());
    for (auto76730D7A_i = 1; auto76730D7A_i <= auto76730D7A_n; auto76730D7A_i += 1) {
        UnitAddChargeUsed(gv_hyperion, "SJHyperionFighters", -1.0);
    }
}

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zspace01.sc2mapMapScript.galaxy:3161

    gv_hyperionFighterRecalling = false;
    if ((gf_HyperionFighterCountCurrent() < gf_HyperionFighterCountMax())) {
        UnitAddChargeUsed(gv_hyperion, "SJHyperionFighters", -1.0);
    }

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zspace01.sc2mapMapScript.galaxy:3413

    }

    UnitAddChargeUsed(gv_hyperion, "SJHyperionFighters", -1.0);
    TriggerStop(gt_LaunchHyperionFighters);
    gf_RecallHyperionFighters();

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zspace01.sc2mapMapScript.galaxy:3566


    gv_tacFightersLost += 1;
    UnitAddChargeUsed(gv_hyperion, "SJHyperionFighters", 1.0);
    if ((UnitGroupCount(gv_hyperionFighterGroup, c_unitCountAlive) == 0)) {
        gf_RecallHyperionFighters();

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

    // Automatic Variable Declarations
    // Implementation
    UnitAddChargeUsed(lp_inUnit, lp_inCharge, (-1.0 * UnitGetChargeUsed(lp_inUnit, lp_inCharge)));
}

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

    // Automatic Variable Declarations
    // Implementation
    UnitAddChargeUsed(lp_inUnit, lp_inCharge, (-1.0 * UnitGetChargeUsed(lp_inUnit, lp_inCharge)));
}

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:7990

    }

    UnitAddChargeUsed(lv_butcher, lv_freshMeatChargeLink, (lv_changeInCharges * -1));
    return true;
}

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:10016

    }

    UnitAddChargeUsed(lv_caster, "Abil/FaerieDragonPixieCharm", -1.0);
    return true;
}

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:10311

    }

    UnitAddChargeUsed(lv_unit, "Abil/IllidanBladesOfAzzinoth", -1.0);
    return true;
}

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:12611

    if ((PlayerHasTalent(EventPlayer(), "LeoricMasteryOsseinRenewal") == true)) {
        UnitCreateEffectUnit(lv_leoric, "LeoricOsseinRenewalGlobeImpactSet", lv_leoric);
        UnitAddChargeUsed(lv_leoric, "Abil/LeoricOsseinRenewal", -1.0);
    }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:17389

    }

    UnitAddChargeUsed(lv_caster, "Abil/MurkyAFishyDeal", -1.0);
    return true;
}

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:17821

        UnitCreateEffectUnit(lv_nova, "TalentBribeAdd1Token", lv_nova);
        if ((ModI(UnitBehaviorCount(lv_nova, libGame_gv_players[lv_player].lv_bribeTokenLink), libGame_gv_players[lv_player].lv_bribeChargeStackRequirement) == 0)) {
            UnitAddChargeUsed(lv_nova, "Abil/TalentBucketBribe", -1.0);
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:21581

    }

    UnitAddChargeUsed(lv_unit, "Abil/SgtHammerSiegeModeDestructiveMunitions", -1.0);
    return true;
}

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:22511

    }

    UnitAddChargeUsed(lv_caster, "Abil/SylvanasPossession", 2.0);
    UnitAddChargeRegenRemaining(lv_caster, "Abil/SylvanasPossession", 0.0);
    return true;

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:22887

    }

    UnitAddChargeUsed(lv_caster, "Abil/ThrallAncestralWrath", -1.0);
    return true;
}

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:24981


                lv_chargeLink = CatalogFieldValueGet(c_gameCatalogAbil, lv_abilLink, "Cost[" + IntToString(0) + "].Charge.Link", UnitGetOwner(lv_hero));
                UnitAddChargeUsed(lv_hero, lv_chargeLink, -1.0);
            }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:8114

                lv_chargeLink = CatalogFieldValueGet(c_gameCatalogAbil, lv_abilLink, "Cost[" + IntToString(0) + "].Charge.Link", UnitGetOwner(lv_itUnit));
                lv_chargeCount = CatalogFieldValueGetAsInt(c_gameCatalogAbil, lv_abilLink, "Cost[" + IntToString(0) + "].Charge.CountMax", UnitGetOwner(lv_itUnit));
                UnitAddChargeUsed(lv_itUnit, lv_chargeLink, (-lv_chargeCount));
                PlayerAddChargeUsed(lp_player, lv_chargeLink, (-lv_chargeCount));
            }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:9254

        UnitCreateEffectUnit(lv_bribeOwnerUnit, "TalentBribeAdd1Token", lv_bribeOwnerUnit);
        if ((ModI(UnitBehaviorCount(lv_bribeOwnerUnit, libGame_gv_players[lp_killingPlayer].lv_bribeTokenLink), libGame_gv_players[lp_killingPlayer].lv_bribeChargeStackRequirement) == 0)) {
            UnitAddChargeUsed(lv_bribeOwnerUnit, "Abil/TalentBucketBribe", -1.0);
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/SupportLib.galaxy:1654

            libNtve_gf_PlayerRemoveCooldown(lv_ownerofUnit, lv_cooldownLink);
            lv_chargeLink = CatalogFieldValueGet(c_gameCatalogAbil, lv_abilLink, "Cost[" + IntToString(0) + "].Charge.Link", lv_ownerofUnit);
            UnitAddChargeUsed(lp_unit, lv_chargeLink, -1.0);
            PlayerAddChargeUsed(lv_ownerofUnit, lv_cooldownLink, -1.0);
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/SupportLib.galaxy:1760

                if ((lv_tokenBehavior == "ButcherFreshMeatTokenCounter")) {
                    lv_chargeLink = CatalogFieldValueGet(c_gameCatalogAbil, "ButcherFreshMeatDummy", "Cost[" + IntToString(0) + "].Charge.Link", lp_player);
                    UnitAddChargeUsed(lv_itSelectedUnit, lv_chargeLink, (-(lv_newTokenCount - lv_currentTokenCount)));
                }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/SupportLib.galaxy:1765

                if ((lv_tokenBehavior == "WitchDoctorVoodooRitualTokenCounter")) {
                    lv_chargeLink = CatalogFieldValueGet(c_gameCatalogAbil, "WitchDoctorVoodooRitualDummy", "Cost[" + IntToString(0) + "].Charge.Link", lp_player);
                    UnitAddChargeUsed(lv_itSelectedUnit, lv_chargeLink, (-(lv_newTokenCount - lv_currentTokenCount)));
                }

mods/heromods/hanzo.stormmodbase.stormdata/LibHHAN.galaxy:723

    }

    UnitAddChargeUsed(lv_hanzoUnit, "Abil/HanzoNaturalAgilityButton", -1.0);
    return true;
}

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicSystem.galaxy:1732


    libNtve_gf_UnitRemoveChargeUsed(lv_u, libGAwX_gv_hearthstoneChargeLink);
    UnitAddChargeUsed(lv_u, libGAwX_gv_hearthstoneChargeLink, (libGAwX_gv_hearthstoneChargeMax - lv_c));
    return true;
}