The Horny Rat
2003-11-03, 06:11 PM
Hi,
I am trying to make my shotgun shoot out 16 random projectiles in one shot, this was easy to do on tribes2, but here on legends its been a little bit of a pain any ideas how to make the onfire code below do this?
function ShotgunImage::onFire( %data, %obj, %slot )
{
%obj.decInventory( %data.ammo, 1 );
%projectile = %data.projectile;
%muzzleVelocity = VectorAdd(
VectorScale(%obj.getMuzzleVector(%slot), %projectile.muzzleVelocity),
VectorScale(%obj.getVelocity(), %projectile.velInheritFactor));
//if( %data.projectileSpread )
//{
for(%i = 0; %i < 16; %i++)
%matrix = %matrix @ (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread @ " ";
%matrix = MatrixCreateFromEuler( %matrix );
%muzzleVelocity = MatrixMulVector( %matrix, %muzzleVelocity );
//}
%p = new (%data.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %muzzleVelocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
I am trying to make my shotgun shoot out 16 random projectiles in one shot, this was easy to do on tribes2, but here on legends its been a little bit of a pain any ideas how to make the onfire code below do this?
function ShotgunImage::onFire( %data, %obj, %slot )
{
%obj.decInventory( %data.ammo, 1 );
%projectile = %data.projectile;
%muzzleVelocity = VectorAdd(
VectorScale(%obj.getMuzzleVector(%slot), %projectile.muzzleVelocity),
VectorScale(%obj.getVelocity(), %projectile.velInheritFactor));
//if( %data.projectileSpread )
//{
for(%i = 0; %i < 16; %i++)
%matrix = %matrix @ (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread @ " ";
%matrix = MatrixCreateFromEuler( %matrix );
%muzzleVelocity = MatrixMulVector( %matrix, %muzzleVelocity );
//}
%p = new (%data.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %muzzleVelocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}