Author Topic: Applying damage  (Read 1609 times)

So I need to apply damage, but I want to still call all the usual checks for it (minigame, etc).  Right now I have a somewhat sloppy way to do this for players, but I need it to work for vehicles too.  Instead of try to just recode damage, could someone tell me if there is a way to simply apply damage with all the usual checks, without using a projectile?

Fine, since I doubt anyone will help me unless I say this...

I'm in a bit of a pickle.
« Last Edit: February 03, 2008, 04:54:25 PM by Aloshi »

Once, I found a way to make all light invisible, then change the projectile to empty, and keep damage on, invisible damage. Is that what you wanted?
Code: [Select]
//projectile
AddDamageType("RocketDirect",   '<bitmap:add-ons/ci/rocket> %1',    '%2 <bitmap:add-ons/ci/rocket> %1',1,1);
AddDamageType("RocketRadius",   '<bitmap:add-ons/ci/rocketRadius> %1',    '%2 <bitmap:add-ons/ci/rocketRadius> %1',1,0);
datablock ProjectileData(GolfscorereseterProjectile)
{
   projectileShapeName = "base/data/shapes/empty.dts";
   directDamage        = 0;
   directDamageType  = $DamageType::rocketDirect;
   radiusDamageType  = $DamageType::rocketRadius;
   impactImpulse    = 0;
   verticalImpulse    = 0;
   explosion           = GolfscorereseterExplosion;
   particleEmitter     = GolfscorereseterTrailEmitter;

   muzzleVelocity      = 70;
   velInheritFactor    = 1;

   armingDelay         = 0;
   lifetime            = 20000;
   fadeDelay           = 19500;
   bounceElasticity    = 0;
   bounceFriction      = 0;
   isBallistic         = true;
   gravityMod = 0.20;

   hasLight    = false;

 hasLight    = false; is what makes the particles invisible...
« Last Edit: February 03, 2008, 04:56:34 PM by Dr Bling »

Er, no, I need a way to do it without a projectile.

You could make the projectile travel at mach 5 and then it wouldn't matter  :cookieMonster:

You could do this:

Code: [Select]
if(minigameCanDamage(%obj,%col))
{
   %col.damage(%obj,%pos,%damage,%damageType);
}

You'd need to fill in the damage/type/position though - and this is assuming %obj is the damager, and %col is the one getting hurt.

So much for me helping someone for once =/

Thanks Ephi, but I tried it on a vehicle and the minigame check didn't work. (I was on single player, not in a minigame, used it on my own vehicle and it was still destroyed)

Code: [Select]
if(minigameCanDamage(%obj,%col) && isObject(%obj.client.minigame))
{
   %col.damage(%obj,%pos,%damage,%damageType);
}