In my experimentation, this works shockingly well. Basically, if a position can fire a weapon, it can fire any vehicle weapon, up to including tank and artillery cannons. Even if it can't normally, you can still add weapons and sometimes it'll even work. If it doesn't, typically that's because the shot you fire spawns inside your vehicle and you instantly blow up and/or die.
So first step to doing this is figuring out the turret path to the turret. This is an array, [-1] always refers to driver, [0] typically refers to the main gunner, and I don't know what happens beyond that ([0,0] is a thing occasionally). You can get the turret path for a position by sitting in that position and pasting
Code: Select all
hint format ["%1", assignedVehicleRole player]
After that, it's actually pretty simple. Your main tools are addWeaponTurret, removeWeaponTurret, addMagazineTurret, and removeMagazineTurret. These all work pretty much the same, you give a weapon/magazine classname and a turret path and it adds/removes that thing from the turret. You can use weaponsTurret to see what weapons already exist on a turret. Classnames can be found at https://community.bistudio.com/wiki/Arm ... le_Weapons.
As an example, pasting this in the init field of a HMG Hunter will replace the .50 cal with a 105mm cannon with 40 rounds of APFSDS ammo:
Code: Select all
{this removeWeaponTurret [_x,[0]];} forEach (this weaponsTurret [0]);
{this removeMagazinesTurret [_x,[0]];} forEach (this magazinesTurret [0]);
this addWeaponTurret ["cannon_105mm",[0]];
this addMagazineTurret ["40Rnd_105mm_APFSDS", [0]];
Examples of stuff that works:
- An AT technical with a tank cannon. The recoil is enough to flip a normal technical so increasing mass is recommended. setMass 5000 leaves a good kick without destroying the technical.
- A static minigun (HMG firing heli minigun). This will even work if you disassemble and reassemble it.
- A static AT gun (HMG firing tank cannon). Again, you'll need to setMass to handle the recoil. Disassembling the static will undo the setMass so you'll have to disable disassembly or reapply the setMass.
- A Panther with a 20mm gattling cannon.
- A remote designator that acts as a remote 50cal turret.
- A Hunter with a flare mortar.
- A Ghosthawk with gattling cannons for door guns.
- An AH-9 that fires 230mm artillery rockets.
- A Darter UAV that drops bombs.
- A quadbike with a forward-mounted LMG.
- A hatchback with a forward-mounted tank cannon.
- A mortar that fires Skyfire rockets. The artillery computer seems like it works but I'm not very convinced that it actually does.
- A Taru whose loadmaster has a backwards head and can fire a gattling cannon somehow.
EDIT: whoops, in retrospect I guess this is basically a guide. Oh well.
DOUBLE EDIT: also, if anyone wants to see the above there's a mission on the test server I used to make sure they don't break in multiplayer. Look for weird_vehicle_test, at least until the test server gods decide it's time for a wipe.