# Save Data Table Value (Unit)
Grammar — Save value as name in the scope|Global/Local data table
Flags —Native
|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> — Scopestring
— Nameunit
— Value
Returns — void
native void DataTableSetUnit(
bool global,
string name,
unit val,
);
# Related
Category: Data Table / Save Value
- Save Data Table Value (Ability Command) —
void
— DataTableSetAbilCmd - Save Data Table Value (Actor) —
void
— DataTableSetActor - Save Data Table Value (Actor Scope) —
void
— DataTableSetActorScope - Save Data Table Value (AI Filter) —
void
— DataTableSetAIFilter - Save Data Table Value (Bank) —
void
— DataTableSetBank - Save Data Table Value (Boolean) —
void
— DataTableSetBool - Save Data Table Value (Byte) —
void
— DataTableSetByte - Save Data Table Value (Camera Object) —
void
— DataTableSetCameraInfo - Save Data Table Value (Cinematic) —
void
— DataTableSetCinematic - Save Data Table Value (Color) —
void
— DataTableSetColor - Save Data Table Value (Control) —
void
— DataTableSetControl - Save Data Table Value (Conversation) —
void
— DataTableSetConversation - Save Data Table Value (Conversation Reply) —
void
— DataTableSetReply - Save Data Table Value (Dialog) —
void
— DataTableSetDialog - Save Data Table Value (Dialog Item) —
void
— libNtve_gf_SaveDataTableValueDialogItem - Save Data Table Value (Difficulty Level) —
void
— libNtve_gf_SaveDataTableValueDifficultyLevel - Save Data Table Value (Doodad) —
void
— DataTableSetDoodad - Save Data Table Value (Integer) —
void
— DataTableSetInt - Save Data Table Value (Marker) —
void
— DataTableSetMarker - Save Data Table Value (Objective) —
void
— DataTableSetObjective - Save Data Table Value (Order) —
void
— DataTableSetOrder - Save Data Table Value (Ping) —
void
— DataTableSetPing - Save Data Table Value (Planet) —
void
— DataTableSetPlanet - Save Data Table Value (Player Color) —
void
— libNtve_gf_SaveDataTableValuePlayerColor - Save Data Table Value (Player Group) —
void
— DataTableSetPlayerGroup - Save Data Table Value (Point) —
void
— DataTableSetPoint - Save Data Table Value (Portrait) —
void
— DataTableSetPortrait - Save Data Table Value (Real) —
void
— DataTableSetFixed - Save Data Table Value (Region) —
void
— DataTableSetRegion - Save Data Table Value (Revealer) —
void
— DataTableSetRevealer - Save Data Table Value (Sound) —
void
— DataTableSetSound - Save Data Table Value (Sound Link) —
void
— DataTableSetSoundLink - Save Data Table Value (String) —
void
— DataTableSetString - Save Data Table Value (Text) —
void
— DataTableSetText - Save Data Table Value (Text Tag) —
void
— libNtve_gf_SaveDataTableValueTextTag - Save Data Table Value (Timer) —
void
— DataTableSetTimer - Save Data Table Value (Transmission) —
void
— DataTableSetTransmission - Save Data Table Value (Transmission Source) —
void
— DataTableSetTransmissionSource - Save Data Table Value (Trigger) —
void
— DataTableSetTrigger - Save Data Table Value (Unit) —
void
— DataTableSetUnit - Save Data Table Value (Unit Filter) —
void
— DataTableSetUnitFilter - Save Data Table Value (Unit Group) —
void
— DataTableSetUnitGroup - Save Data Table Value (Unit Reference) —
void
— DataTableSetUnitRef - Save Data Table Value (Wave) —
void
— DataTableSetWave - Save Data Table Value (Wave Info) —
void
— DataTableSetWaveInfo - Save Data Table Value (Wave Target) —
void
— DataTableSetWaveTarget
# Examples
campaigns/swarm.sc2campaign — base.sc2maps/maps/campaign/swarm/zexpedition02.sc2map/MapScript.galaxy:732
// Implementation
DataTableSetUnitGroup(true, ("EscortShuttles_" + IntToString(UnitGetTag(lp_escort))), lp_shuttles);
DataTableSetUnit(true, ("EscortShuttle_" + IntToString(UnitGetTag(lp_escort))), UnitGroupUnit(lp_shuttles, 1));
DataTableSetUnitGroup(true, ("ShuttleEscorts_" + IntToString(UnitGetTag(UnitGroupUnit(lp_shuttles, 1)))), lp_allEscorts);
}
campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition02.sc2map — MapScript.galaxy:732
// Implementation
DataTableSetUnitGroup(true, ("EscortShuttles_" + IntToString(UnitGetTag(lp_escort))), lp_shuttles);
DataTableSetUnit(true, ("EscortShuttle_" + IntToString(UnitGetTag(lp_escort))), UnitGroupUnit(lp_shuttles, 1));
DataTableSetUnitGroup(true, ("ShuttleEscorts_" + IntToString(UnitGetTag(UnitGroupUnit(lp_shuttles, 1)))), lp_allEscorts);
}
campaigns/swarmstory.sc2campaign — base.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:7778
}
DataTableSetUnit(true, (libSwaC_gv_zSC_ArmyCustomEggUnitDataPrefix + (lp_armyCategory)), lv_eggUnit);
if ((libSwaC_gf_StoryArmyCategoryStateCheck(lp_armyCategory, c_armyCategoryStateUnlocked) == true)) {
libSwaC_gf_ZS_ArmyCalloutUpdate(lp_armyCategory);
mods/core.sc2mod — base.sc2data/TriggerLibs/NativeLib.galaxy:5162
// Implementation
if (((lp_unit == null) || (UnitGetType(lp_unit) == lp_unitType))) {
DataTableSetUnit(false, "%REPLACEDUNIT%", lp_unit);
return ;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/NativeLib.galaxy:5197
}
UnitRemove(lp_unit);
DataTableSetUnit(false, "%REPLACEDUNIT%", lv_newUnit);
}
mods/core.stormmod — base.stormdata/TriggerLibs/NativeLib.galaxy:4407
// Implementation
if (((lp_unit == null) || (UnitGetType(lp_unit) == lp_unitType))) {
DataTableSetUnit(false, "%REPLACEDUNIT%", lp_unit);
return ;
}
mods/core.stormmod — base.stormdata/TriggerLibs/NativeLib.galaxy:4442
}
UnitRemove(lp_unit);
DataTableSetUnit(false, "%REPLACEDUNIT%", lv_newUnit);
}
mods/heroesbrawlmods/brawlmapmods/coop/pvebrawlmod.stormmod — base.stormdata/LibPVEB.galaxy:789
// Implementation
DataTableSetInt(false, TriggerEventParamName(libPVEB_gv_eventID_NPCHeroSpawn_C, libPVEB_gv_eventParam_NPCHeroSpawn_Player_C), lp_player);
DataTableSetUnit(false, TriggerEventParamName(libPVEB_gv_eventID_NPCHeroSpawn_C, libPVEB_gv_eventParam_NPCHeroSpawn_HeroUnit_C), lp_heroUnit);
TriggerSendEvent(libPVEB_gv_eventID_NPCHeroSpawn_C);
}
mods/heroesbrawlmods/brawlmapmods/coop/pvemod.stormmod — base.stormdata/LibPVEM.galaxy:996
// Implementation
DataTableSetInt(false, TriggerEventParamName(libPVEM_gv_pvEEventIDNPCHeroSpawn_C, libPVEM_gv_pvEEventParamNPCHeroSpawnPlayer_C), lp_player);
DataTableSetUnit(false, TriggerEventParamName(libPVEM_gv_pvEEventIDNPCHeroSpawn_C, libPVEM_gv_pvEEventParamNPCHeroSpawnHeroUnit_C), lp_heroUnit);
TriggerSendEvent(libPVEM_gv_pvEEventIDNPCHeroSpawn_C);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameDataHelperLib.galaxy:464
// Implementation
DataTableSetInt(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurUltimateEvolutionEnded_C, libGDHL_gv_eventParam_AbathurUltimateEvolution_AbathurPlayer_C), lp_abathurPlayer);
DataTableSetUnit(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurUltimateEvolutionEnded_C, libGDHL_gv_eventParam_AbathurUltimateEvolution_ClonedUnit_C), lp_clonedUnit);
TriggerSendEvent(libGDHL_gv_eventID_AbathurUltimateEvolutionEnded_C);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameDataHelperLib.galaxy:516
// Implementation
DataTableSetInt(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurSymbiote_C, libGDHL_gv_eventParam_AbathurSymbiote_AbathurPlayer_C), lp_abathurPlayer);
DataTableSetUnit(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurSymbiote_C, libGDHL_gv_eventParam_AbathurSymbiote_SymbioteUnit_C), lp_symbioteUnit);
DataTableSetUnit(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurSymbiote_C, libGDHL_gv_eventParam_AbathurSymbiote_SymbioteTarget_C), lp_symbioteTarget);
TriggerSendEvent(libGDHL_gv_eventID_AbathurSymbiote_C);
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameDataHelperLib.galaxy:517
DataTableSetInt(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurSymbiote_C, libGDHL_gv_eventParam_AbathurSymbiote_AbathurPlayer_C), lp_abathurPlayer);
DataTableSetUnit(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurSymbiote_C, libGDHL_gv_eventParam_AbathurSymbiote_SymbioteUnit_C), lp_symbioteUnit);
DataTableSetUnit(false, TriggerEventParamName(libGDHL_gv_eventID_AbathurSymbiote_C, libGDHL_gv_eventParam_AbathurSymbiote_SymbioteTarget_C), lp_symbioteTarget);
TriggerSendEvent(libGDHL_gv_eventID_AbathurSymbiote_C);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:3465
// Implementation
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_JungleDefenderAIDefenderKilled_C, libGame_gv_eventParam_JungleDefenderAIDefenderKilled_Index_C), lp_defenderAIIndex);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_JungleDefenderAIDefenderKilled_C, libGame_gv_eventParam_JungleDefenderAIDefenderKilled_Unit_C), lp_unit);
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_JungleDefenderAIDefenderKilled_C, libGame_gv_eventParam_JungleDefenderAIDefenderKilled_KillingPlayer_C), lp_killingPlayer);
TriggerSendEvent(libGame_gv_eventID_JungleDefenderAIDefenderKilled_C);
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:3638
// Implementation
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInCreepTakedown_C, libGame_gv_eventParam_HeroParticipatedInCreepTakedown_Player_C), lp_player);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInCreepTakedown_C, libGame_gv_eventParam_HeroParticipatedInCreepTakedown_NPC_C), lp_unit);
TriggerSendEvent(libGame_gv_eventID_HeroParticipatedInCreepTakedown_C);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:3676
// Implementation
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_HeroExitedTransport_C, libGame_gv_eventParam_HeroExitedTransport_Player_C), lp_player);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroExitedTransport_C, libGame_gv_eventParam_HeroExitedTransport_Transport_C), lp_unit);
TriggerSendEvent(libGame_gv_eventID_HeroExitedTransport_C);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:3702
// Implementation
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_HeroEnteredTransport_C, libGame_gv_eventParam_HeroEnteredTransport_Player_C), lp_player);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroEnteredTransport_C, libGame_gv_eventParam_HeroEnteredTransport_Transport_C), lp_transportUnit);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroEnteredTransport_C, libGame_gv_eventParam_HeroEnteredTransport_CargoUnit_C), lp_cargoUnit);
TriggerSendEvent(libGame_gv_eventID_HeroEnteredTransport_C);
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:3703
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_HeroEnteredTransport_C, libGame_gv_eventParam_HeroEnteredTransport_Player_C), lp_player);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroEnteredTransport_C, libGame_gv_eventParam_HeroEnteredTransport_Transport_C), lp_transportUnit);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroEnteredTransport_C, libGame_gv_eventParam_HeroEnteredTransport_CargoUnit_C), lp_cargoUnit);
TriggerSendEvent(libGame_gv_eventID_HeroEnteredTransport_C);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:3780
// Implementation
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_HeroPortedBackToTown_C, libGame_gv_eventParam_HeroPortedBackToTown_Player_C), lp_player);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroPortedBackToTown_C, libGame_gv_eventParam_HeroPortedBackToTown_Unit_C), lp_unit);
TriggerSendEvent(libGame_gv_eventID_HeroPortedBackToTown_C);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:3806
// Implementation
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInNPCTakedown_C, libGame_gv_eventParam_HeroParticipatedInNPCTakedown_Player_C), lp_player);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInNPCTakedown_C, libGame_gv_eventParam_HeroParticipatedInNPCTakedown_NPC_C), lp_unit);
TriggerSendEvent(libGame_gv_eventID_HeroParticipatedInNPCTakedown_C);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:3832
// Implementation
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_HeroWitnessedAlliedNPCDeath_C, libGame_gv_eventParam_HeroWitnessedAlliedNPCDeath_Player_C), lp_player);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroWitnessedAlliedNPCDeath_C, libGame_gv_eventParam_HeroWitnessedAlliedNPCDeath_NPC_C), lp_unit);
TriggerSendEvent(libGame_gv_eventID_HeroWitnessedAlliedNPCDeath_C);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:3858
// Implementation
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_SpecialCaseUnitParticipatedInNPCTakedown_C, libGame_gv_eventParam_SpecialCaseUnitParticipatedInNPCTakedown_Player_C), lp_player);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_SpecialCaseUnitParticipatedInNPCTakedown_C, libGame_gv_eventParam_SpecialCaseUnitParticipatedInNPCTakedown_NPC_C), lp_unit);
TriggerSendEvent(libGame_gv_eventID_SpecialCaseUnitParticipatedInNPCTakedown_C);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:3892
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInTakedown_C, libGame_gv_eventParam_HeroParticipatedInTakedown_PlayerKilling_C), lp_playerKilling);
DataTableSetInt(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInTakedown_C, libGame_gv_eventParam_HeroParticipatedInTakedown_PlayerKilled_C), lp_playerKilled);
DataTableSetUnit(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInTakedown_C, libGame_gv_eventParam_HeroParticipatedInTakedown_HeroKilled_C), lp_heroKilled);
DataTableSetPoint(false, TriggerEventParamName(libGame_gv_eventID_HeroParticipatedInTakedown_C, libGame_gv_eventParam_HeroParticipatedInTakedown_HeroKilledPosition_C), lp_heroKilledPosition);
TriggerSendEvent(libGame_gv_eventID_HeroParticipatedInTakedown_C);
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:3391
// Automatic Variable Declarations
// Implementation
DataTableSetUnit(true, libCore_gf__UnitDataName(libCore_ge__UnitDataType_Unit, lp_unit, lp_index), lp_value);
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:6357
// Automatic Variable Declarations
// Implementation
DataTableSetUnit(false, TriggerEventParamName((lp_event), "ZeratulEventUnit"), libCOMI_gv_cM_HeroUnit[lp_zeratulPlayer]);
DataTableSetUnit(false, TriggerEventParamName((lp_event), "ZeratulEventArtifactUnit"), lp_artifactUnit);
DataTableSetInt(false, TriggerEventParamName((lp_event), "ZeratulEventPlayer"), lp_zeratulPlayer);
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:6358
// Implementation
DataTableSetUnit(false, TriggerEventParamName((lp_event), "ZeratulEventUnit"), libCOMI_gv_cM_HeroUnit[lp_zeratulPlayer]);
DataTableSetUnit(false, TriggerEventParamName((lp_event), "ZeratulEventArtifactUnit"), lp_artifactUnit);
DataTableSetInt(false, TriggerEventParamName((lp_event), "ZeratulEventPlayer"), lp_zeratulPlayer);
DataTableSetInt(false, TriggerEventParamName((lp_event), "ZeratulEventArtifactNumber"), lp_artifactNumber);
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:25198
lv_itUnitType = UserDataGetUnit(libCOMI_gv_cM_Tychus_UserTypeHeroList, lv_heroInstance, "Unit Type", 1);
if ((lv_itUnitType == lv_heroType)) {
DataTableSetUnit(false, TriggerEventParamName(lv_event, "EventHero"), lv_hero);
DataTableSetString(false, TriggerEventParamName(lv_event, "EventHeroInstance"), (lv_heroInstance));
TriggerSendEvent(lv_event);
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:25242
}
DataTableSetUnit(false, TriggerEventParamName(lv_event, "EventStructure"), lv_structure);
TriggerSendEvent(lv_event);
return true;
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:26926
lv_event = "ZeratulEvent_VisionNotReady";
}
DataTableSetUnit(false, TriggerEventParamName((lv_event), "ZeratulEventUnit"), EventUnit());
DataTableSetInt(false, TriggerEventParamName((lv_event), "ZeratulEventPlayer"), UnitGetOwner(EventUnit()));
TriggerSendEvent((lv_event));
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:27133
else {
}
DataTableSetUnit(false, TriggerEventParamName((lv_event), "ZeratulEventUnit"), EventUnit());
DataTableSetInt(false, TriggerEventParamName((lv_event), "ZeratulEventPlayer"), UnitGetOwner(EventUnit()));
TriggerSendEvent((lv_event));