-
Notifications
You must be signed in to change notification settings - Fork 149
Disposable Launchers
This framework provides support for disposable launchers. They are loaded when taken out of a weapons crate or the Arsenal without having to take a magazine. When shot they are replaced by a used tube. The magazine can not be dropped via the inventory menu.
For this to work you need to create 3 separate weapon classes: the "normal" launcher, the preloaded launcher (which will be replaced with the normal launcher and the magazine) and the used launcher (which can no longer be fired).
The preloaded launcher is itself not compatible with the magazine and should have the mass of the normal launcher plus the magazine. The used launcher should have the same mass as the normal launcher.
The necessary config entries are shown below. Some of these are required for the arsenal to handle the items correctly, for the weapon optic of the used launcher to be usable and for the engine to handle the framework correctly in general. Be not afraid to set the magazineReloadTime
to exactly 0.1. This just circumvents a bug with some script commands that would cause the launcher to not be usable for quite a while after selected the first time. The magazine reload time is otherwise ignored for person held weapons: it only affects vehicles. Person held weapons reload times are controlled entirely by their reload gesture animations. Disposable launchers are preloaded anyway.
This framework is not compiled or executed when no compatible launchers are in your mod set. CBA provides no such launchers.
#define LAUNCHER_MASS 80
#define LAUNCHER_MAGAZINE_MASS 40
class CBA_DisposableLaunchers {
BWA3_PzF3[] = {"BWA3_PzF3_Loaded","BWA3_PzF3_Used"};
};
class CfgMagazines {
class CA_LauncherMagazine;
class BWA3_PzF3_Tandem: CA_LauncherMagazine {
author = "$STR_BWA3_Author";
scope = 1;
mass = LAUNCHER_MAGAZINE_MASS;
allowedSlots[] = {};
};
};
class CfgWeapons {
class Launcher;
class Launcher_Base_F: Launcher {
class WeaponSlotsInfo;
};
class BWA3_PzF3: Launcher_Base_F {
author = "$STR_BWA3_Author";
scope = 1;
scopeArsenal = 1;
baseWeapon = "BWA3_PzF3";
magazines[] = {"BWA3_PzF3_Tandem"};
magazineReloadTime = 0.1;
reloadMagazineSound[] = {"",1,1};
class EventHandlers {
fired = "_this call CBA_fnc_firedDisposable"; // this weapon eventhandler is required!
};
class WeaponSlotsInfo: WeaponSlotsInfo {
mass = LAUNCHER_MASS;
};
};
class BWA3_PzF3_Loaded: BWA3_PzF3 {
author = "$STR_BWA3_Author";
scope = 2;
scopeArsenal = 2;
baseWeapon = "BWA3_PzF3_Loaded";
magazines[] = {"CBA_FakeLauncherMagazine"};
class WeaponSlotsInfo: WeaponSlotsInfo {
mass = LAUNCHER_MASS + LAUNCHER_MAGAZINE_MASS;
};
};
class BWA3_PzF3_Used: BWA3_PzF3 {
author = "$STR_BWA3_Author";
scope = 1;
scopeArsenal = 1;
baseWeapon = "BWA3_PzF3_Used";
magazines[] = {"CBA_FakeLauncherMagazine"};
class WeaponSlotsInfo: WeaponSlotsInfo {
mass = LAUNCHER_MASS;
};
};
};