# Add Charge Used For Unit Ability

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

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

# Arguments

  • unit — Unit
  • string<gamelink::Abil> — Ability
  • string<charge> — Charge
  • fixed — Value

Returns — void

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

Category: Unit / Charges And Cooldowns

# Examples

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

    // Automatic Variable Declarations
    // Implementation
    UnitAbilityAddChargeUsed(lp_inUnit, lp_inAbil, lp_inCharge, (-1.0 * UnitAbilityGetChargeUsed(lp_inUnit, lp_inAbil, lp_inCharge)));
}

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

    // Automatic Variable Declarations
    // Implementation
    UnitAbilityAddChargeUsed(lp_inUnit, lp_inAbil, lp_inCharge, (-1.0 * UnitAbilityGetChargeUsed(lp_inUnit, lp_inAbil, lp_inCharge)));
}

mods/heroesbrawlmods/brawlmapmods/coop/deadmansstand.stormmodbase.stormdata/LibPEB1.galaxy:2476

    VisRevealArea(libCore_gv_cOMPUTER_TeamChaos, RegionCircle(libPEB1_gv_currentScourgeMissileTargetPoint, 4.0), 4.0, false);
    VisRevealArea(libCore_gv_cOMPUTER_TeamOrder, RegionCircle(UnitGetPosition(libPEB1_gv_currentScourgeMissileCaster), 6.0), 4.0, false);
    UnitAbilityAddChargeUsed(libPEB1_gv_currentScourgeMissileCaster, "GhostShipBombardChargedPort", "Abil/BattleshipBombardCharged", 1.0);
    if ((libPEB1_gv_scourgeMissileTargetPing == c_invalidPingId)) {
        libCore_gf_CreateMinimapPingStorm(PlayerGroupAll(), "StormGhostShipImpact", UnitGetPosition(libPEB1_gv_currentScourgeMissileTargetUnit), ColorWithAlpha(100.00, 0.00, 0.00, 0.00), 3.0);

mods/heroesmapmods/battlegroundmapmods/blackheartsbay.stormmodbase.stormdata/LibBBAY.galaxy:283

    lv_currentCharges = FixedToInt(UnitAbilityChargeInfo(libBBAY_gv_mMBBCannonballsGhostShip, AbilityCommand("GhostShipBombardChargedPort", 0), c_unitAbilChargeCountLeft));
    lv_targetCharges = (libBBAY_gv_mMBBCannonballsStartInBattleship_C + libBBAY_gv_mMBBCannonballsStockedInBattleship_C);
    UnitAbilityAddChargeUsed(libBBAY_gv_mMBBCannonballsGhostShip, "GhostShipBombardChargedPort", "Abil/BattleshipBombardCharged", (lv_currentCharges - lv_targetCharges));
    UnitAbilityAddChargeUsed(libBBAY_gv_mMBBCannonballsGhostShip, "GhostShipBombardChargedStarboard", "Abil/BattleshipBombardCharged", (lv_currentCharges - lv_targetCharges));
    libBBAY_gv_mMBBCannonballsGhostShipTotalAmmo = lv_targetCharges;

mods/heroesmapmods/battlegroundmapmods/blackheartsbay.stormmodbase.stormdata/LibBBAY.galaxy:284

    lv_targetCharges = (libBBAY_gv_mMBBCannonballsStartInBattleship_C + libBBAY_gv_mMBBCannonballsStockedInBattleship_C);
    UnitAbilityAddChargeUsed(libBBAY_gv_mMBBCannonballsGhostShip, "GhostShipBombardChargedPort", "Abil/BattleshipBombardCharged", (lv_currentCharges - lv_targetCharges));
    UnitAbilityAddChargeUsed(libBBAY_gv_mMBBCannonballsGhostShip, "GhostShipBombardChargedStarboard", "Abil/BattleshipBombardCharged", (lv_currentCharges - lv_targetCharges));
    libBBAY_gv_mMBBCannonballsGhostShipTotalAmmo = lv_targetCharges;
    lv_itCannonTarget = 1;

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

    lv_actualCreator = UnitLastCreated();
    if ((UnitOrderIsValid(lv_actualCreator, lv_order1) == false) && (UnitOrderIsValid(lv_actualCreator, lv_order2) == false)) {
        UnitAbilityAddChargeUsed(lv_warpGate, libCOMI_gv_warpGateTrainAbility, "WarpGateTrain", -1.0);
        UnitRemove(lv_actualCreator);
        return true;

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

    if ((UnitBehaviorCount(lv_creator, libCOMI_gv_supplicantWarpTrainWarpRefundBehaviorLink) > 0)) {
        lv_warpGate = UnitBehaviorEffectUnit(lv_creator, libCOMI_gv_supplicantWarpTrainCreatorWarpGateFinderBehaviorLink, c_effectUnitCaster, 0);
        UnitAbilityAddChargeUsed(lv_warpGate, libCOMI_gv_warpGateTrainAbility, "WarpGateTrain", -1.0);
        UnitRemove(lv_creator);
    }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:3412

    }
    if ((libNtve_gf_UnitInRegion(lp_civilianUnit, RegionCircle(UnitGetPosition(libCOMU_gv_cT_CandyBowlUnit), 3.0)) == true) && (UnitAbilityChargeInfo(libCOMU_gv_cT_CandyBowlUnit, AbilityCommand("MutatorBuyCandy", 0), c_unitAbilChargeCountLeft) >= 1)) {
        UnitAbilityAddChargeUsed(libCOMU_gv_cT_CandyBowlUnit, "MutatorBuyCandy", "Abil/MutatorBuyCandy", 1.0);
        UnitIssueOrder(lp_civilianUnit, Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
        libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(lp_civilianUnit), c_animNameDefault, "Stand Victory", 0, c_animTimeDefault);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:7623

    TriggerEnable(libCOMU_gt_CT_CandyBowlTextUpdate, true);
    libCOUI_gf_DisplaySingularBossBarVoidCampaign("Assets\\Textures\\btn-tips-scrap.dds", StringExternal("Param/Value/lib_COMU_066CB91C"), 50);
    UnitAbilityAddChargeUsed(libCOMU_gv_cT_CandyBowlUnit, "MutatorBuyCandy", "Abil/MutatorBuyCandy", lv_initialCandy);
    libCOUI_gf_SetSingularBossBarCurrentValueVoidCampaign(FixedToInt(UnitAbilityChargeInfo(libCOMU_gv_cT_CandyBowlUnit, AbilityCommand("MutatorBuyCandy", 0), c_unitAbilChargeCountLeft)), true);
    if ((libCOMU_gf_MutatorIsEnabled("TrickOrTreat") == true)) {