# Preload Unit
Grammar — Preload unit|Unit queue|Immediately/For Next Map
Flags —Action
Preloads a unit and its associated assets. The unit must be explicitly identified (it won’t work if you plug in a variable to that parameter). Preloading will force an asset or data entry to be loaded into memory before the map starts, rather than be loaded on demand as the map runs.
# Arguments
string
<gamelink::Unit> — Unit Typebool
<preset::PreloadQueue> — Queue
Returns — void
void libNtve_gf_PreloadUnit(string lp_unit, bool lp_queue);
# Related
Category: Game / Preloading
- Preload Asset —
void
— PreloadAsset - Preload Image —
void
— PreloadImage - Preload Layout —
void
— PreloadLayout - Preload Model —
void
— PreloadModel - Preload Model Animation —
void
— libNtve_gf_PreloadModelAnimation - Preload Model Object —
void
— libNtve_gf_PreloadModelObject - Preload Movie —
void
— PreloadMovie - Preload Object —
void
— PreloadObject - Preload Scene —
void
— PreloadScene - Preload Script —
void
— PreloadScript - Preload Sound —
void
— PreloadSound - Preload Sound Object —
void
— libNtve_gf_PreloadSoundObject - Preload Soundtrack —
void
— libNtve_gf_PreloadSoundtrack - Preload Unit —
void
— libNtve_gf_PreloadUnit
# Examples
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tarcade.sc2map/MapScript.galaxy:688
lv_index = 1;
for ( ; ( (autoB2FAD8C5_ai >= 0 && lv_index <= autoB2FAD8C5_ae) || (autoB2FAD8C5_ai <= 0 && lv_index >= autoB2FAD8C5_ae) ) ; lv_index += autoB2FAD8C5_ai ) {
libNtve_gf_PreloadUnit(gv_levelWavePlaneType[(lp_level)][lv_index], false);
}
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tarcade.sc2map/MapScript.galaxy:4026
lv_index = 1;
for ( ; ( (auto8396104F_ai >= 0 && lv_index <= auto8396104F_ae) || (auto8396104F_ai <= 0 && lv_index >= auto8396104F_ae) ) ; lv_index += auto8396104F_ai ) {
libNtve_gf_PreloadUnit(gv_powerupTypeUnitTypes[lv_index], false);
}
return true;
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/thorner01.sc2map/MapScript.galaxy:739
}
libNtve_gf_PreloadUnit("TarsonisEngineFast", false);
gv_defilerSkeletonsNeeded = UnitGroupCount(UnitGroup("DefilerBoneSample", gv_pLAYER_07_DEFILERBONESAMPLE, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive);
TriggerExecute(gt_TrainPathInitialization, true, false);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:12674
for ( ; auto8D2B279B_u <= UnitGroupCount(auto8D2B279B_g, c_unitCountAll) ; auto8D2B279B_u += BoolToInt(lv_indexUnit == UnitGroupUnit(auto8D2B279B_g, auto8D2B279B_u)) ) {
lv_indexUnit = UnitGroupUnit(auto8D2B279B_g, auto8D2B279B_u);
libNtve_gf_PreloadUnit(UnitGetType(lv_indexUnit), false);
}
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:12863
for ( ; autoDC1868A3_u <= UnitGroupCount(autoDC1868A3_g, c_unitCountAll) ; autoDC1868A3_u += BoolToInt(lv_indexUnit == UnitGroupUnit(autoDC1868A3_g, autoDC1868A3_u)) ) {
lv_indexUnit = UnitGroupUnit(autoDC1868A3_g, autoDC1868A3_u);
libNtve_gf_PreloadUnit(UnitGetType(lv_indexUnit), false);
}
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:37127
gf_ActorScenePrepare(ge_ActorID_ActorHillMercContact, ge_ActorID_ActorNone, ge_RoomID_RoomCantina, ge_SceneType_Scene);
gf_RemoveVisibleUnit(true, gf_ActorUnit(ge_ActorID_ActorHillMercContact));
libNtve_gf_PreloadUnit("SMAnnabelle", false);
libNtve_gf_CreateUnitsAtPoint2(1, "SMAnnabelle", 0, 0, PointFromId(958));
gv_scriptSceneMercIntroAnnabelle = UnitLastCreated();
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:37132
UnitGroupAdd(lv_group, UnitLastCreated());
libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(UnitLastCreated()), c_animNameDefault, "Talk", c_animFlagPlayForever, c_animTimeDefault);
libNtve_gf_PreloadUnit("SMBralik", false);
libNtve_gf_CreateUnitsAtPoint2(1, "SMBralik", 0, 0, PointFromId(959));
UnitGroupAdd(lv_group, UnitLastCreated());
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:37136
UnitGroupAdd(lv_group, UnitLastCreated());
gf_TurnAnimationPropertiesOnOff(UnitLastCreated(), "Cover", true, 0.0);
libNtve_gf_PreloadUnit("SMHall", false);
libNtve_gf_CreateUnitsAtPoint2(1, "SMHall", 0, 0, PointFromId(960));
UnitGroupAdd(lv_group, UnitLastCreated());
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:37257
UnitCreate(1, "SMHyperionArmoryStage1Set02", 0, 0, UnitGetPosition(gf_RoomUnit(ge_RoomID_RoomArmory)), UnitGetFacing(gf_RoomUnit(ge_RoomID_RoomArmory)));
lv_armoryStage02 = UnitLastCreated();
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorKachinsky)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorEarl)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorAnnabelle)), false);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:37258
lv_armoryStage02 = UnitLastCreated();
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorKachinsky)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorEarl)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorAnnabelle)), false);
libNtve_gf_CreateUnitsAtPoint2(1, UnitGetType(gf_ActorUnit(ge_ActorID_ActorKachinsky)), 0, 0, PointFromId(660));
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:37259
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorKachinsky)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorEarl)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorAnnabelle)), false);
libNtve_gf_CreateUnitsAtPoint2(1, UnitGetType(gf_ActorUnit(ge_ActorID_ActorKachinsky)), 0, 0, PointFromId(660));
UnitGroupAdd(lv_bGGroup, UnitLastCreated());
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul04.sc2map/MapScript.galaxy:481
}
libNtve_gf_PreloadUnit("Urun", false);
libNtve_gf_PreloadUnit("Mohandar", false);
libNtve_gf_PreloadUnit("Selendis", false);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul04.sc2map/MapScript.galaxy:482
libNtve_gf_PreloadUnit("Urun", false);
libNtve_gf_PreloadUnit("Mohandar", false);
libNtve_gf_PreloadUnit("Selendis", false);
libNtve_gf_ShowHideUnit(UnitFromId(637), false);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul04.sc2map/MapScript.galaxy:483
libNtve_gf_PreloadUnit("Urun", false);
libNtve_gf_PreloadUnit("Mohandar", false);
libNtve_gf_PreloadUnit("Selendis", false);
libNtve_gf_ShowHideUnit(UnitFromId(637), false);
libNtve_gf_ShowHideUnit(UnitFromId(843), false);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tarcade.sc2map — MapScript.galaxy:688
lv_index = 1;
for ( ; ( (autoB2FAD8C5_ai >= 0 && lv_index <= autoB2FAD8C5_ae) || (autoB2FAD8C5_ai <= 0 && lv_index >= autoB2FAD8C5_ae) ) ; lv_index += autoB2FAD8C5_ai ) {
libNtve_gf_PreloadUnit(gv_levelWavePlaneType[(lp_level)][lv_index], false);
}
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tarcade.sc2map — MapScript.galaxy:4026
lv_index = 1;
for ( ; ( (auto8396104F_ai >= 0 && lv_index <= auto8396104F_ae) || (auto8396104F_ai <= 0 && lv_index >= auto8396104F_ae) ) ; lv_index += auto8396104F_ai ) {
libNtve_gf_PreloadUnit(gv_powerupTypeUnitTypes[lv_index], false);
}
return true;
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner01.sc2map — MapScript.galaxy:739
}
libNtve_gf_PreloadUnit("TarsonisEngineFast", false);
gv_defilerSkeletonsNeeded = UnitGroupCount(UnitGroup("DefilerBoneSample", gv_pLAYER_07_DEFILERBONESAMPLE, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive);
TriggerExecute(gt_TrainPathInitialization, true, false);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:12674
for ( ; auto8D2B279B_u <= UnitGroupCount(auto8D2B279B_g, c_unitCountAll) ; auto8D2B279B_u += BoolToInt(lv_indexUnit == UnitGroupUnit(auto8D2B279B_g, auto8D2B279B_u)) ) {
lv_indexUnit = UnitGroupUnit(auto8D2B279B_g, auto8D2B279B_u);
libNtve_gf_PreloadUnit(UnitGetType(lv_indexUnit), false);
}
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:12863
for ( ; autoDC1868A3_u <= UnitGroupCount(autoDC1868A3_g, c_unitCountAll) ; autoDC1868A3_u += BoolToInt(lv_indexUnit == UnitGroupUnit(autoDC1868A3_g, autoDC1868A3_u)) ) {
lv_indexUnit = UnitGroupUnit(autoDC1868A3_g, autoDC1868A3_u);
libNtve_gf_PreloadUnit(UnitGetType(lv_indexUnit), false);
}
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:37127
gf_ActorScenePrepare(ge_ActorID_ActorHillMercContact, ge_ActorID_ActorNone, ge_RoomID_RoomCantina, ge_SceneType_Scene);
gf_RemoveVisibleUnit(true, gf_ActorUnit(ge_ActorID_ActorHillMercContact));
libNtve_gf_PreloadUnit("SMAnnabelle", false);
libNtve_gf_CreateUnitsAtPoint2(1, "SMAnnabelle", 0, 0, PointFromId(958));
gv_scriptSceneMercIntroAnnabelle = UnitLastCreated();
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:37132
UnitGroupAdd(lv_group, UnitLastCreated());
libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(UnitLastCreated()), c_animNameDefault, "Talk", c_animFlagPlayForever, c_animTimeDefault);
libNtve_gf_PreloadUnit("SMBralik", false);
libNtve_gf_CreateUnitsAtPoint2(1, "SMBralik", 0, 0, PointFromId(959));
UnitGroupAdd(lv_group, UnitLastCreated());
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:37136
UnitGroupAdd(lv_group, UnitLastCreated());
gf_TurnAnimationPropertiesOnOff(UnitLastCreated(), "Cover", true, 0.0);
libNtve_gf_PreloadUnit("SMHall", false);
libNtve_gf_CreateUnitsAtPoint2(1, "SMHall", 0, 0, PointFromId(960));
UnitGroupAdd(lv_group, UnitLastCreated());
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:37257
UnitCreate(1, "SMHyperionArmoryStage1Set02", 0, 0, UnitGetPosition(gf_RoomUnit(ge_RoomID_RoomArmory)), UnitGetFacing(gf_RoomUnit(ge_RoomID_RoomArmory)));
lv_armoryStage02 = UnitLastCreated();
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorKachinsky)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorEarl)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorAnnabelle)), false);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:37258
lv_armoryStage02 = UnitLastCreated();
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorKachinsky)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorEarl)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorAnnabelle)), false);
libNtve_gf_CreateUnitsAtPoint2(1, UnitGetType(gf_ActorUnit(ge_ActorID_ActorKachinsky)), 0, 0, PointFromId(660));
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:37259
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorKachinsky)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorEarl)), false);
libNtve_gf_PreloadUnit(UnitGetType(gf_ActorUnit(ge_ActorID_ActorAnnabelle)), false);
libNtve_gf_CreateUnitsAtPoint2(1, UnitGetType(gf_ActorUnit(ge_ActorID_ActorKachinsky)), 0, 0, PointFromId(660));
UnitGroupAdd(lv_bGGroup, UnitLastCreated());
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul04.sc2map — MapScript.galaxy:481
}
libNtve_gf_PreloadUnit("Urun", false);
libNtve_gf_PreloadUnit("Mohandar", false);
libNtve_gf_PreloadUnit("Selendis", false);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul04.sc2map — MapScript.galaxy:482
libNtve_gf_PreloadUnit("Urun", false);
libNtve_gf_PreloadUnit("Mohandar", false);
libNtve_gf_PreloadUnit("Selendis", false);
libNtve_gf_ShowHideUnit(UnitFromId(637), false);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul04.sc2map — MapScript.galaxy:483
libNtve_gf_PreloadUnit("Urun", false);
libNtve_gf_PreloadUnit("Mohandar", false);
libNtve_gf_PreloadUnit("Selendis", false);
libNtve_gf_ShowHideUnit(UnitFromId(637), false);
libNtve_gf_ShowHideUnit(UnitFromId(843), false);
campaigns/libertystory.sc2campaign — base.sc2data/TriggerLibs/CampaignLib.galaxy:9662
for ( ; ( (autoA87DC2EE_ai >= 0 && lv_index <= autoA87DC2EE_ae) || (autoA87DC2EE_ai < 0 && lv_index >= autoA87DC2EE_ae) ) ; lv_index += autoA87DC2EE_ai ) {
TriggerDebugOutput(1, (StringExternal("Param/Value/lib_Camp_ABAC52DD") + StringToText((libCamp_gv_tS_StoryRoomUnitTypes[lv_roomIndex][lv_index]))), false);
libNtve_gf_PreloadUnit(libCamp_gv_tS_StoryRoomUnitTypes[lv_roomIndex][lv_index], true);
}
}
campaigns/libertystory.sc2campaign — base.sc2data/TriggerLibs/CampaignLib.galaxy:9670
// Implementation
TriggerDebugOutput(1, (StringExternal("Param/Value/lib_Camp_4F00CC43") + StringToText((libCamp_gv_tS_StoryActorUnitTypes[(lp_actor)]))), false);
libNtve_gf_PreloadUnit(libCamp_gv_tS_StoryActorUnitTypes[(lp_actor)], true);
}
campaigns/swarmstoryutil.sc2mod — base.sc2data/Lib281DEC45.galaxy:1529
lv_indexMap = (lib281DEC45_gf_ZSS_UITravelLocationProperty(lv_indexPlanet, ("MissionCategoryArray[" + IntToString((lv_index - 1)) + "].Map")));
if ((lv_indexMap != null) && (libSwaC_gf_MissionArmyCategoryUnlocked(lv_indexMap) != null)) {
libNtve_gf_PreloadUnit((CatalogFieldValueGet(c_gameCatalogArmyCategory, libSwaC_gf_MissionArmyCategoryUnlocked(lv_indexMap), "Unit", 1)), false);
}
else {
campaigns/swarmstoryutil.sc2mod — base.sc2data/Lib281DEC45.galaxy:1692
// Implementation
if ((libSwaC_gf_MissionArmyCategoryUnlocked(lib281DEC45_gv_zSS_NextMission) != null)) {
libNtve_gf_PreloadUnit((CatalogFieldValueGet(c_gameCatalogArmyCategory, libSwaC_gf_MissionArmyCategoryUnlocked(lib281DEC45_gv_zSS_NextMission), "Unit", c_playerAny)), false);
}
else {
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:2065
// Implementation
if ((libVoiC_gf_MissionArmyCategoryUnlocked(lp_mission) != null)) {
libNtve_gf_PreloadUnit(libVoiC_gf_PC_ArmyCategoryUnitType(libVoiC_gf_MissionArmyCategoryUnlocked(lp_mission)), false);
}
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:3152
if (CatalogFieldValueGet(c_gameCatalogMap, lv_indexMission, "Kind", 1) == "Mission" && libVoiC_gf_StoryMapPlanet(lv_indexMission) == lv_indexLocation) {
if ((libVoiC_gf_MissionArmyCategoryUnlocked(lv_indexMission) != null)) {
libNtve_gf_PreloadUnit(libVoiC_gf_PC_ArmyCategoryUnitType(libVoiC_gf_MissionArmyCategoryUnlocked(lv_indexMission)), false);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:10875
libCore_gf_DataClearHeroDataAtIndex(lv_itPlayer);
libCore_gf_DataLoadHeroDataIntoIndex(libCore_gf_GetHeroFromIndex(libGame_gv_players[lv_itPlayer].lv_heroIndex), lv_itPlayer);
libNtve_gf_PreloadUnit(libGame_gv_players[lv_itPlayer].lv_heroData.lv_unitType, false);
}