# Save Data Table Value (Unit)

Grammar — Save value as name in the scope|Global/Local data table
FlagsNative | Action

Saves a unit value into a data table. Data tables allow you to store and recall values using a string identifier. If you save a data table value using a string identifier that already exists, you will overwrite the old value, even if it is a different data type than the value you are saving.

# Arguments

  • bool [ preset::DataScope ] — Scope
  • string — Name
  • unit — Value

Returns — void

native void DataTableSetUnit(
	bool global,
	string name,
	unit val,
);

Category: Data Table / Save Value

# Examples

# campaigns/swarm.sc2campaign

MapScript.galaxy

// L732
DataTableSetUnit(true, ("EscortShuttle_" + IntToString(UnitGetTag(lp_escort))), UnitGroupUnit(lp_shuttles, 1))
// L732
DataTableSetUnit(true, ("EscortShuttle_" + IntToString(UnitGetTag(lp_escort))), UnitGroupUnit(lp_shuttles, 1))

# campaigns/swarmstory.sc2campaign

SwarmCampaignLib.galaxy

// L7778
DataTableSetUnit(true, (libSwaC_gv_zSC_ArmyCustomEggUnitDataPrefix + (lp_armyCategory)), lv_eggUnit)

# mods/core.sc2mod

NativeLib.galaxy

// L5162
DataTableSetUnit(false, "%REPLACEDUNIT%", lp_unit)
// L5197
DataTableSetUnit(false, "%REPLACEDUNIT%", lv_newUnit)
// L4407
DataTableSetUnit(false, "%REPLACEDUNIT%", lp_unit)
// L4442
DataTableSetUnit(false, "%REPLACEDUNIT%", lv_newUnit)

# mods/heroesbrawlmods/brawlmapmods/coop/pvebrawlmod.stormmod

LibPVEB.galaxy

// L789
DataTableSetUnit(false, TriggerEventParamName(libPVEB_gv_eventID_NPCHeroSpawn_C, libPVEB_gv_eventParam_NPCHeroSpawn_HeroUnit_C), lp_heroUnit)

# mods/heroesbrawlmods/brawlmapmods/coop/pvemod.stormmod

LibPVEM.galaxy

// L996
DataTableSetUnit(false, TriggerEventParamName(libPVEM_gv_pvEEventIDNPCHeroSpawn_C, libPVEM_gv_pvEEventParamNPCHeroSpawnHeroUnit_C), lp_heroUnit)

# mods/heroesdata.stormmod

GameDataHelperLib.galaxy

// L464
DataTableSetUnit(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurUltimateEvolutionEnded_C, libGDHL_gv_eventParam_AbathurUltimateEvolution_ClonedUnit_C), lp_clonedUnit)
// L516
DataTableSetUnit(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurSymbiote_C, libGDHL_gv_eventParam_AbathurSymbiote_SymbioteUnit_C), lp_symbioteUnit)
// L517
DataTableSetUnit(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurSymbiote_C, libGDHL_gv_eventParam_AbathurSymbiote_SymbioteTarget_C), lp_symbioteTarget)

# mods/heroesdata.stormmod

GameLib.galaxy

// L3465
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_JungleDefenderAIDefenderKilled_C, libGame_gv_eventParam_JungleDefenderAIDefenderKilled_Unit_C), lp_unit)
// L3638
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInCreepTakedown_C, libGame_gv_eventParam_HeroParticipatedInCreepTakedown_NPC_C), lp_unit)
// L3676
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroExitedTransport_C, libGame_gv_eventParam_HeroExitedTransport_Transport_C), lp_unit)
// L3702
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroEnteredTransport_C, libGame_gv_eventParam_HeroEnteredTransport_Transport_C), lp_transportUnit)
// L3703
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroEnteredTransport_C, libGame_gv_eventParam_HeroEnteredTransport_CargoUnit_C), lp_cargoUnit)
// L3780
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroPortedBackToTown_C, libGame_gv_eventParam_HeroPortedBackToTown_Unit_C), lp_unit)
// L3806
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInNPCTakedown_C, libGame_gv_eventParam_HeroParticipatedInNPCTakedown_NPC_C), lp_unit)
// L3832
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroWitnessedAlliedNPCDeath_C, libGame_gv_eventParam_HeroWitnessedAlliedNPCDeath_NPC_C), lp_unit)
// L3858
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_SpecialCaseUnitParticipatedInNPCTakedown_C, libGame_gv_eventParam_SpecialCaseUnitParticipatedInNPCTakedown_NPC_C), lp_unit)
// L3892
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInTakedown_C, libGame_gv_eventParam_HeroParticipatedInTakedown_HeroKilled_C), lp_heroKilled)

# mods/heroesdata.stormmod

HeroesLib.galaxy

// L3391
DataTableSetUnit(true, libCore_gf__UnitDataName(libCore_ge__UnitDataType_Unit, lp_unit, lp_index), lp_value)

# mods/starcoop/starcoop.sc2mod

LibCOMI.galaxy

// L6328
DataTableSetUnit(false, TriggerEventParamName((lp_event), "ZeratulEventUnit"), libCOMI_gv_cM_HeroUnit[lp_zeratulPlayer])
// L6329
DataTableSetUnit(false, TriggerEventParamName((lp_event), "ZeratulEventArtifactUnit"), lp_artifactUnit)
// L25122
DataTableSetUnit(false, TriggerEventParamName(lv_event, "EventHero"), lv_hero)
// L25166
DataTableSetUnit(false, TriggerEventParamName(lv_event, "EventStructure"), lv_structure)
// L26853
DataTableSetUnit(false, TriggerEventParamName((lv_event), "ZeratulEventUnit"), EventUnit())
// L27060
DataTableSetUnit(false, TriggerEventParamName((lv_event), "ZeratulEventUnit"), EventUnit())