Author Topic: ProjectileData::Damage is having issues  (Read 1063 times)


datablock ProjectileData(pepperSprayPaintProjectile) {
   className = "Projectile";
   scale = "1 1 1";
   Explosion = "pepperSprayPaintExplosion";
   hasLight = "0";
   lightRadius = "1";
   lightColor = "1.000000 1.000000 1.000000 1.000000";
   hasWaterLight = "0";
   waterLightColor = "1.000000 1.000000 1.000000 1.000000";
   isBallistic = "0";
   collideWithPlayers = "1";
   velInheritFactor = "0";
   muzzleVelocity = "20";
   restVelocity = "1";
   lifetime = "300";
   armingDelay = "0";
   fadeDelay = "0";
   directDamage = 0;
   directDamageType  = $DamageType::Direct;
   radiusDamageType  = $DamageType::Radius;
   explodeOnDeath = "0";
   explodeOnPlayerImpact = "0";
   bounceAngle = "0";
   minStickVelocity = "0";
   bounceElasticity = "0";
   bounceFriction = "0";
   gravityMod = "0";
};

function pepperSprayPaintProjectile::Damage(%this,%obj,%col,%fade,%pos,%normal)
{
   if(%col.getType() & $TypeMasks::PlayerObjectType)
   {
      %col.setWhiteOut(1);
      %col.setDamageFlash(1);
      %col.setTransform(%col.getPosition() SPC eulerToMatrix(getRandom(0,360) SPC getRandom(0,360) SPC getRandom(0,360)));
   }
}


for some reason, It won't call the pepperSprayPaintProjectile.Damage function when I hit other players in minigames...
This works with other weapons I have made, but not this one.. Why? How can I fix this?

Try setting directDamge to 1 or 0.1 or something. It may not be calling it because it thinks there's no damage to do.

Try setting directDamge to 1 or 0.1 or something. It may not be calling it because it thinks there's no damage to do.
that didn't work when I first tried it...
The chinese fingertrap uses the Projectile::damage with 0 damage and it does not do anything. Do i need isBallistic = 1;?

Try changing ::Damage to ::onCollision

Try changing ::Damage to ::onCollision
This will cause it to bypass any checks to see if the projectile should cause harm to the target. Still, couldn't hurt as a way to see if something is happening.

Do i need isBallistic = 1;?
No, that's just for enabling a few other properties for the projectile like gravity and bouncing and such.

No, that's just for enabling a few other properties for the projectile like gravity and bouncing and such.
>.< Instant kill....

Try changing ::Damage to ::onCollision
i will try
tried:
Failure :C
« Last Edit: March 06, 2013, 09:04:29 PM by MARBLE MAN »

>.< Instant kill....
i will try
tried:
Failure :C
Show us the rest of your script.

This will cause it to bypass any checks to see if the projectile should cause harm to the target. Still, couldn't hurt as a way to see if something is happening.
But his projectile isn't supposed to harm anything, so onCollision is just fine.

But his projectile isn't supposed to harm anything, so onCollision is just fine.
It causes the person's screen to flash and spins them around chaotically (Oh by the way you probably should ditch the attempt to do that on the X and Y axes). Not something you want people doing to each other outside a minigame/gamemode.