put the muzzle point in the middle

when creating projectiles just do a little bit of math to create a projectile or projectiles at 2 locations

`function gunImage::onFire(%db,%pl,%slot)`

{

%upHack = %pl.getUpVectorHack();

%muzBase = %pl.getMuzzlePoint(%slot);

%forward = %pl.getMuzzleVector(%slot);

%muzPos0 = vectorAdd(%muzBase,vectorRelativeShift(%forward,%upHack,0 SPC -1 SPC 0));

%muzPos1 = vectorAdd(%muzBase,vectorRelativeShift(%forward,%upHack,0 SPC 1 SPC 0));

%proj = %db.projectile;

%pvel = %pl.getVelocity();

%vel = vectorAdd(%proj.muzzleVelocity,vectorScale(%pvel,%proj.velInheritFactor));

for(%i=0;%i<=1;%i++)

{

%p = new projectile()

{

dataBlock = %proj;

initialVelocity = %vel;

initialPosition = %muzPos[%i];

sourceObject = %pl;

sourceSlot = %slot;

client = %pl.client;

};

missionCleanup.add(%p);

}

}

function vectorRelativeShift(%forward,%up,%shift)

{

return vectorAdd(vectorAdd(vectorScale(%forward,getWord(%shift,0)),vectorScale(vectorCross(%forward,%up),getWord(%shift,1))),vectorScale(%up,getWord(%shift,2)));

}

function vectorAngleRotate(%vec,%ref,%ang)

{

%x = getWord(%vec,0);

%y = getWord(%vec,1);

%z = getWord(%vec,2);

%u = getWord(%ref,0);

%v = getWord(%ref,1);

%w = getWord(%ref,2);

%cos = mCos(%ang);

%sin = mSin(%ang);

return %u*(%u*%x+%v*%y+%w*%z)*(1-%cos)+%x*%cos+(%v*%z-%w*%y)*%sin SPC %u*(%u*%x+%v*%y+%w*%z)*(1-%cos)+%y*%cos+(%w*%x-%u*%z)*%sin SPC %u*(%u*%x+%v*%y+%w*%z)*(1-%cos)+%z*%cos+(%u*%y-%v*%x)*%sin;

}

function player::getUpVectorHack(%pl)

{

%muz = MatrixMulVector(%pl.getSlotTransform(0),"0 1 0");

%forward = %pl.getForwardVector();

%up = %pl.getUpVector();

return vectorAngleRotate(%muz,vectorCross(%forward,%up),$PI/2);

}

this would create two projectiles when the gun fires, one shifted 1 unit to the left and the other shifted 1 unit to the right

obviously if you wanted to create some projectiles spreading you could use some spread code to create multiple projectiles at each point

the bottom 3 functions are just support functions and you don't need to worry about anything in them

the only thing you need to tinker with is muzPos0 and muzPos1 and the projectile creation part