I wrote this code a long time ago. It makes a stunt plane drop five HE grenades (one per second) when the pilot presses Space with a twenty-second recharge time. This directly creates the projectiles rather than using a specific weapon to fire.
It could be modified to drop spear-like projectiles (gravity-based and exploding on impact) with a slight velocity in the direction of the plane, and maybe a safety check so it won't drop them while you are on the ground/near it.
function stuntplaneVehicle::onTrigger(%this, %obj, %num, %cli, %wha)
{
if(%cli $= 1 && !%obj.nofire)
{
%obj.nofire = 1;
bottomprint(%obj.getMountedObject(0).client,"\c0Bombs launching!",2,2,2);
schedule(20000,0,resetfire,%obj);
Bombs(0,%obj);
}
}
function resetFire(%obj)
{
%obj.nofire = 0;
if(isObject(%obj.getMountedObject(0).client)){bottomprint(%obj.getMountedObject(0).client,"\c0Bombs ready!",2,2,2);}
}
function Bombs(%num,%obj)
{
%p = new (Projectile)() {
dataBlock = heGrenadeProjectile;
initialVelocity = vectorScale("0 0 -1",heGrenadeProjectile.muzzleVelocity);
initialPosition = vectorAdd(%obj.position,"0 0 -2");
sourceObject = %obj;
sourceSlot = 0;
client = %obj.getMountedObject(0).client;
minigame = %obj.getMountedObject(0).client.minigame;
};
if(%num<6){schedule(500,0,bombs,%num++,%obj);}
}