I was a bit tired of seeing the regular gun shot do the same, boring Splat effect when it hit a wall, a player, a vehicle, basically everything. So I shamelessly looked and copy-pasted a few lines from Ephi's well written Flak Cannon that used a bit of what I needed for it's effects and I came up with this script:
function SensorFusedLProjectile::onCollision(%this,%obj,%col,%fade,%pos,%norm)
{
if(%col.getClassName() $= "Player")
%obj.setDataBlock(PlaySensorFusedLProjectile);
Parent::onCollision(%this,%obj,%col,%fade,%pos,%norm);
}
function SensorFusedLProjectile::onCollision(%this,%obj,%col,%fade,%pos,%norm)
{
if(%col.getClassName() $= "WheeledVehicle")
%obj.setDataBlock(VehiSensorFusedLProjectile);
Parent::onCollision(%this,%obj,%col,%fade,%pos,%norm);
}
(where SensorFusedLProjectile is the weapon's main projectile, what it fires)
Basically if the projectile hits a Player, it switches to another Projectile with different damage, impulse, explosion, etc. for a completely different effect (like flying chunks of plastic and whatnot). If the projectile hits a Wheeled Vehicle, like jeeps and stunt planes, it also switches out to yet another different projectile producing a shower of sparks and fancy fire explosions.
I know the Vehicle bit works, but I'm not too sure about the Player bit. Testing with zombies didn't work but the flak cannon also doesn't behave normally on zombies.
All I want to know is, do you think this works? Might there be an issue with the code? Or is there a neater way of presenting it? Also thanks again Ephi