Author Topic: Cannot be damaged (Not sure how)  (Read 438 times)

Not really sure how I cannot be damaged, I am trying to reflect a bullet, it works fine, it just cannot damage me for some reason.


function ProjectileData::onCollision(%this,%obj,%col,%fade,%pos,%normal)
   {
      %objA = %obj.sourceObject;
      if((%col.getClassName() $= "AIPlayer" || %col.getClassName() $= "Player") && %col.reflect && %objA != %col)
      {
         %scaleFactor = getWord(%obj.getScale(), 2);
         %vel = %obj.initialVelocity;
         if(%obj.isDuplicate)
            %obj.delete();
         %p = new Projectile()
         {
             dataBlock = %this;
             initialPosition = %pos;
             initialVelocity = getWord(%vel,0)*-1 SPC getWord(%vel,1)*-1 SPC getWord(%vel,2)*-1;
             sourceObject = %objA;
             client = %objA.client;
             sourceSlot = 0;
             originPoint = %pos;
             isDuplicate = 1;
         };
         %p.setScale(%scaleFactor SPC %scaleFactor SPC %scaleFactor);
         %p.schedule(%this.lifetime,explode);
         return;
      }
      return Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
   }


Basically when I shoot the flamethrower at an AI, it reflects back, but it doesn't damage.
« Last Edit: March 29, 2014, 04:03:00 AM by Advanced Bot »

I actually found this recently when making a homing projectile (just recreated the projectile every 100ms or so with slightly different velocity). It just goes right through me, not sure if its the same for you.

All I can think of doing is removing sourceObject or client from the projectile when you recreate it. I think removing sourceObject should work fine.

Seems to not still damage me.