Author Topic: Multiple Projectiles for One Weapon?  (Read 601 times)

 Is it possible to have two or more projectiles for one weapon in the same script? If so, can this also be done with raycasting projectiles?
« Last Edit: May 28, 2011, 11:41:39 AM by FrogFreak »

Pretty sure it can, you just need the two datablocks

You shouldn't need two datablocks unless the projectiles are different.

If they are different, then you'll need a datablock for each unique projectile.

Well, for two different raycast projectiles,  would anyone know how to set that up?

You shouldn't need two datablocks unless the projectiles are different.

If they are different, then you'll need a datablock for each unique projectile.
Thanks, Captain Obvious.

Frog, just make the datablock for one projectile like usual, then make another for the second, and call them whenever you need them in the state system.

Well, for two different raycast projectiles,  would anyone know how to set that up?
Raycasts and projectiles are different things.

If you want it to 'shoot' two raycasts that should be easy.

How about some sort of example code to define a certain raycast with an assigned name that is to be used in a certain function?

Notice here from the T+T2 pistol the lack of a name given to the raycast.
Code: [Select]
raycastWeaponRange = 200; //varies
   raycastWeaponTargets =
                   $TypeMasks::PlayerObjectType |    //AI/Players
                   $TypeMasks::StaticObjectType |    //Static Shapes
                   $TypeMasks::TerrainObjectType |    //Terrain
                   $TypeMasks::VehicleObjectType |    //Terrain
                   $TypeMasks::FXBrickObjectType;    //Bricks
   raycastExplosionProjectile = GunProjectile;
   raycastExplosionBrickSound = bulletHitSound;
   raycastExplosionPlayerSound = bulletHitSound;
   raycastDirectDamage = 12; //10
   raycastDirectDamageType = $DamageType::L4Pistol;
   raycastSpreadAmt = 0.0006; //varies
   raycastSpreadCount = 1;
   raycastTracerProjectile = pistolTracerProjectile;
   raycastFromMuzzle = true;
Code: [Select]
function pistolImage::onFire(%this,%obj,%slot)
{
%obj.spawnExplosion(TTRecoilProjectile,"1 1 1");
if(%obj.getDamagePercent() >= 1.0)
return;

if(vectorLen(%obj.getVelocity()) > 0.1)
{
%this.raycastSpreadAmt = 0.0018;
%this.raycastWeaponRange = 85;
}
else
{
%this.raycastSpreadAmt = 0.0009;
%this.raycastWeaponRange = 200;
}

if(%obj.toolAmmo[%obj.currTool] > 0)
{
Parent::onFire(%this,%obj,%slot);
%obj.toolAmmo[%obj.currTool]--;
%obj.AmmoSpent[%obj.currTool]++;
commandToClient(%obj.client,'bottomPrint',"<just:right><font:impact:24><color:fff000>10x18mm <font:impact:34>\c6" @ %obj.toolAmmo[%obj.currTool] @ " / " @ %obj.client.quantity["9MMrounds"] @ "", 1, 2, 3, 4);
}
else if(%this.item.maxAmmo == 0)
{
Parent::onFire(%this,%obj,%slot);
}


%obj.playThread(2, shiftAway);
}

raycasting projectiles what

if you're talking about tracers,
Code: [Select]
   raycastTracerProjectile = pistolTracerProjectile;

but if you're talking about firing 2 totally different raycasts, I can't help you

Two different raycasts.