Author Topic: Making projectiles do no damage to bots.  (Read 1035 times)

Could I modify a projectile to deal absolutely no damage to bots?

If so then how would I implement this?

All the bots I use end up taking damage from each other, then they kill each other.
« Last Edit: February 02, 2011, 02:32:37 PM by Deadzone »

Dont hold me to anything, because Im not 100% sure, but I dont think there is a way to differentiate between an actual client's player object and that of a bot.

Dont hold me to anything, because Im not 100% sure, but I dont think there is a way to differentiate between an actual client's player object and that of a bot.

I hope you are wrong.

Could I modify a projectile deal absolutely no damage to bots?

If so then how would I implement this?
The only time i've seen ANY projectile not harming bots is a glitch where it got killed too many times.

However, it might have something to do with OBJECTID.client or something.

Code: [Select]
package botimmunity
{
   function player::damage(%victimplayer, %attackerplayer, %position, %damage, %damageType)
   {
      if(%victimplayer.getClassName() $= "AIplayer" && %attackerplayer.getClassName() $= "Player")
         return;
      parent::damage(%victimplayer, %attackerplayer, %position, %damage, %damageType);
   }
};
activatepackage(botimmunity);

I think this would work.

Edit because the change in bold will let bots hurt eachother.
Edit because bold does not work in code boxes
« Last Edit: February 02, 2011, 02:44:53 AM by Nexus »

Quote
-Snip-
I think this would work.

Doesn't seem to be working for me, maybe I'm placing it wrong?

I placed it randomly in the weapon that I'm referring to.

« Last Edit: February 02, 2011, 02:20:02 PM by Deadzone »

Doesn't seem to be working for me, maybe I'm placing it wrong?



Are you getting a syntax error? I didn't test this at all, but it is short and not too complicated.
What does the console say when it executes the file? What does it say when you attack a bot?

Dont hold me to anything, because Im not 100% sure, but I dont think there is a way to differentiate between an actual client's player object and that of a bot.
There is, now go away.

What does the console say when it executes the file? What does it say when you attack a bot?

It doesn't say anything.

Code: [Select]
function YOURPROJECTILE::damage(%this, %obj, %col, %fade, %pos, %normal)
{
if(%obj.getClassName() $= "AIplayer")
{
return;
}
return parent::damage(%this, %obj, %col, %fade, %pos, %normal);
}
Be aware, however, that this apply to all bots, including tank turrets, cannons, and horses.

Be aware, however, that this apply to all bots, including tank turrets, cannons, and horses.

Again I must be placing it wrong, it still deals damage to bots.

"function YOURPROJECTILE::damage"

"function FireMProjectile::damage"
« Last Edit: February 02, 2011, 05:41:16 PM by Deadzone »

Amade, why are you having the function return the parent?  I thought that normally you would just end with the parent::damage.

Amade, why are you having the function return the parent?  I thought that normally you would just end with the parent::damage.
Some edits to functions will break things if you simply call the parent, returning the parent is "safer".

Again I must be placing it wrong, it still deals damage to bots.

"function YOURPROJECTILE::damage"

"function FireMProjectile::damage"
Post the rest of your script

AddDamageType("FireM", '<bitmap:Add-Ons/Weapon_ElementalSpells/Icons/CI_Fire> %1', '%2 <bitmap:Add-Ons/Weapon_ElementalSpells/Icons/CI_Fire> %1', 0.25, 0);

datablock ProjectileData(FireMProjectile)
{
   shapeFile = "base/data/shapes/empty.dts";
   directDamage = 0.13;
   radiusDamageType = $DamageType::FireM;

   brickExplosionRadius = 0;
   brickExplosionImpact = true;
   brickExplosionForce = 0;
   brickExplosionMaxVolume = 0;
   brickExplosionMaxVolumeFloati ng = 0;

   impactImpulse = 0;
   verticalImpulse = 0;
   explosion = FireMExplosion;
   particleEmitter = FireAmbientEmitter;
   sound = FireLoopSound;

   muzzleVelocity = 75;
   velInheritFactor = 1;

   armingDelay = 0;
   lifetime = 1000;
   fadeDelay = 1000;
   bounceElasticity = 0.5;
   bounceFriction = 0.20;
   isBallistic = true;
   gravityMod = 0.0;

   hasLight = true;
   lightRadius = 5;
   lightColor = "1 0.5 0";

   uiName = "Fireball";
};

function FireMProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal)
{
   if(%col.getClassName() $= "TSStatic")
   {
      if(%col.shapeName $= "Add-Ons/Weapon_ElementalSpells/OtherShapes/IceBlock.dts")
      {
         if(isObject(%col.player))
         {
            %col.player.thaw();
         }
         %col.delete();
      }
   }
   parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
}

function FireMProjectile::damage(%this, %obj, %col, %fade, %pos, %normal)
{
   if(%obj.getClassName() $= "AIplayer")
   {
      return;
   }
   return parent::damage(%this, %obj, %col, %fade, %pos, %normal);
}

function FireMProjectile::RadiusDamage(%this, %obj, %col, %distance, %pos, %amt)
{
   if(!isObject(%col))
   {
      return;
   }
   %col.damage(%obj, %pos, 15 * getWord(%col.getScale(), 2), $DamageType::FireM);
   if(%col.getType() & $Typemasks::PlayerObjectType && %col.getMountedImage(0) != WaterMImage.getID())
   {
      %col.burnCount = 0;
      if(isObject(%source = %obj.sourceObject))
      {
         %col.lastBurner = %source;
      }
      else
      {
         %col.lastBurner = %obj;
      }
      for(%i = 2; %i < 7; %i++)
      {
         %img = %col.getMountedImage(%i);
         if(%img == FireBurnPlayerImage.getID())
         {
            return;
         }
         if(%img < 1)
         {
            %col.mountImage(FireBurnPlayerImage, %i);
            return;
         }
      }
   }
}


You want the whole thing?

mabye try a different function?

function FireMProjectile::onCollision(%this, %obj, %brick, %fade, %pos, %normal)
  {
   if(%obj.getClassName() $= "AIplayer")
   {
      return 0;
   }
   return parent::onCollision(%this, %obj, %brick, %fade, %pos, %normal);
  }

Also - dont forget to trace() and echo()  when your debugging.