Blockland Forums > Modification Help
Multiple Projectiles for One Weapon?
cucumberdude:
--- Quote from: FrogFreak on May 28, 2011, 11:01:11 AM ---Well, for two different raycast projectiles, would anyone know how to set that up?
--- End quote ---
Raycasts and projectiles are different things.
If you want it to 'shoot' two raycasts that should be easy.
FrogFreak:
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: --- 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;
--- End code ---
--- Code: ---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);
}
--- End code ---
Zloff:
raycasting projectiles what
if you're talking about tracers,
--- Quote from: FrogFreak on May 29, 2011, 04:22:25 PM ---
--- Code: --- raycastTracerProjectile = pistolTracerProjectile;
--- End code ---
--- End quote ---
but if you're talking about firing 2 totally different raycasts, I can't help you
FrogFreak:
Two different raycasts.