Author Topic: How do I make a weapon fire multiple projectiles than it should?  (Read 824 times)


check ephialtes' shotgun, or any of my shotguns

it's in the onFire, you can really just copypaste the code block

check ephialtes' shotgun, or any of my shotguns

it's in the onFire, you can really just copypaste the code block
I can't find onFire thing in your quake shotgun.

check ephi's shotgun
Code: [Select]
function shotgunImage::onFire(%this,%obj,%slot)
{
if((%obj.lastFireTime+%this.minShotTime) > getSimTime())
return;
%obj.lastFireTime = getSimTime();
     
%obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%obj.client.player.getEyeVector(),"-3")));
%obj.playThread(2, shiftAway);

%projectile = %this.projectile;
%spread = 0.0015;
%shellcount = 3;

for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);

%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
return %p;
}

This is pretty much the thing you need to change in the weapon's code assuming it's the same as the previously posted code:
Code: [Select]
%shellcount = #;The amount of projectiles fired is the number that this variable is set to.

For raycasting weapons, you'll need to change this instead:
Code: [Select]
raycastSpreadCount = #;The number of raycast bullets/projectiles fired being is the number that this variable is set to.