activateAddons – Talk

From Bohemia Interactive Community
Revision as of 17:06, 21 January 2009 by WGL.Q (talk | contribs) (Clarification needed for raedor's comment.)
Jump to navigation Jump to search

Does this command work? I can't get it to pre-load weapons and ammo so when you go to crate to load up there isn't that big pause while game caches stuff.. --Doolittle 00:27, 7 April 2008 (CEST)

Maybe someone can confirm my understanding of the command or add some own knowledge.

My understanding is that activateAddons is the scripted replacement for a mission.sqm's addons[]/addonsAuto[] definition.

This means activateAddons will tell the engine that a particular addon via the cfgPathces class is used in the mission.

If the object (cfgVehicles, cfgWeapons, cfgMagazines, cfgAmmo - more?) is created by script, the engine/editor is unable to add the cfgPatches class to the mission.sqm's addons[] definition.

The requirement though is that the addon defines the cfgVehicle or cfgWeapons class properly in its units[]/weapons[] definition of the addons cfgPatches definition.

What does activateAddons/addons[] now.

The simple answer its avoid getting the "the addon X has been deleted" message. Technically it probably preloads the config class (to a degree), so that the engine is aware where to find other things it needs to load.

To preload the model to avoid LOD switching you need to preload the object before the creation though:

waitUntil {1 preloadObject _vehicleType};
_vehicle = _vehicleType createVehicle _startpos;

Example use of activateAddons

if (isClass(configFile >> "cfgPatches" >> "ic_mod_config")) exitWith { activateAddons = ["ic_config_air","ic_config_tracked","ic_config_wheeled","ic_config_weapons"]; };

To avoid the "the addon X has been deleted" message you can define in the config

class CfgAddons
{
	class PreloadAddons
	{
		class CCA
		{
			list[] = {"CCA"};
		};
	};
}; 

So the engine will always preload the said cfgPatches class anyway. The downside is that the dependency is also written into savegames. So if the addon is removed the mission will no longer be possible to load even though the addons content may not be needed by the mission actually.

In other words its not recommended to use it and is only meant as a bad workaround. A proper definition of the cfgPatches classes entries should work along with activateAddons for script only created objects.

Proper cfgPatches:

class CCA
{
	units[] = {"CCA_A10_NoLock","CCA_AGS_NoLock","CCA_AH1W_NoLock","CCA_AH6_NoLock","CCA_AH6_RACS_NoLock","CCA_AV8B_NoLock","CCA_AV8B2_NoLock","CCA_BMP2_NoLock","CCA_BRDM2_ATGM_NoLock","CCA_BRDM2_NoLock","CCA_Camel_NoLock","CCA_Camel2_NoLock","CCA_D30_NoLock","CCA_DSHkM_Mini_TriPod_NoLock","CCA_DSHKM_NoLock","CCA_HMMWV50_NoLock","CCA_HMMWVMK_NoLock","CCA_HMMWVTOW_NoLock","CCA_KA50_NoLock","CCA_M113_NoLock","CCA_M113_RACS_NoLock","CCA_M119_NoLock","CCA_M1Abrams_NoLock","CCA_M2HD_mini_TriPod_NoLock","CCA_M2StaticMG_NoLock","CCA_Mi17_MG_NoLock","CCA_Mi17_NoLock","CCA_MK19_TriPod_NoLock","CCA_RHIB_NoLock","CCA_RHIB2Turret_NoLock","CCA_Stinger_Pod_East_NoLock","CCA_Stinger_Pod_NoLock","CCA_Stryker_ICV_M2_NoLock","CCA_Stryker_ICV_MK19_NoLock","CCA_Stryker_TOW_NoLock","CCA_Su34_NoLock","CCA_Su34B_NoLock","CCA_T72_NoLock","CCA_T72_RACS_NoLock","CCA_TOW_TriPod_East_NoLock","CCA_TOW_TriPod_NoLock","CCA_Truck5tMG_NoLock","CCA_UAZ_AGS30_NoLock","CCA_UAZMG_NoLock","CCA_UH60_NoLock","CCA_UH60MG_NoLock","CCA_Vulcan_NoLock","CCA_Vulcan_RACS_NoLock","CCA_WarfareBEastMGNest_PK_NoLock","CCA_WarfareBResistanceM2StaticMG_NoLock","CCA_WarfareBResistanceMGNest_M240_NoLock","CCA_WarfareBWestMGNest_M240_NoLock","CCA_ZSU_NoLock"};
	weapons[] = {"CCA_2A42_NoLock","CCA_57mmLauncher_NoLock","CCA_80mmLauncher_NoLock","CCA_AALauncher_twice_NoLock","CCA_AGS30_NoLock","CCA_AT5Launcher_NoLock","CCA_AT5LauncherSingle_NoLock","CCA_ATLauncherSingle_Static_NoLock","CCA_AZP85_NoLock","CCA_BombLauncher_NoLock","CCA_CamelGrenades_NoLock","CCA_Ch29Launcher_NoLock","CCA_D30_NoLock","CCA_D81_NoLock","CCA_DSHKM_NoLock","CCA_FFARLauncher_NoLock","CCA_GAU12_NoLock","CCA_GAU8_NoLock","CCA_GSh301_NoLock","CCA_HellfireLauncher_NoLock","CCA_KPVT_NoLock","CCA_M119_NoLock","CCA_M134_2_NoLock","CCA_M134_NoLock","CCA_M168_NoLock","CCA_M197_NoLock","CCA_M2_NoLock","CCA_M240_veh_MG_Nest_NoLock","CCA_M240_veh_NoLock","CCA_M256_NoLock","CCA_MaverickLauncher_NoLock","CCA_MK19_NoLock","CCA_PK_veh_NoLock","CCA_PKT_MG_Nest_NoLock","CCA_PKT_NoLock","CCA_R73Launcher_NoLock","CCA_S8Launcher_NoLock","CCA_SidewinderLaucher_NoLock","CCA_StingerLauncher_twice_NoLock","CCA_TOWLauncher_NoLock","CCA_TOWLauncherSingle_NoLock","CCA_TOWLauncherSingle_Static_NoLock","CCA_TwinM134_NoLock","CCA_TwinVickers_NoLock","CCA_VikhrLauncher_NoLock"};
	requiredVersion = 1.14;
	requiredAddons[] = {"CA_Hotfix","CAA10","CAAir","CAAir3_Su34","CACharacters","CAData","CAFonts","CAMisc","CASounds","CATracked","CAWeapons","CAWeapons3","CAWheeled"};
};

--PROPER Q 13:50, 21 January 2009 (CET)

A proper cfgPatches still doesn't help anything when you're script-creating a weapon of an addon that has not been used in the mission before. --raedor 14:01, 21 January 2009 (CET)
Like I said?! :) --PROPER Q 16:06, 21 January 2009 (CET)
A proper definition of the cfgPatches classes entries should work along with activateAddons for script only created objects.
Even more. You need a proper cfgPatches definition otherwise activateAddons wont help you. At least according to my tests. --PROPER Q 16:06, 21 January 2009 (CET)