Author Topic: Checking For Death by explosion  (Read 1339 times)

How would I check if your player was killed in the radius of a explosion?

function ProjectileData::radiusDamage(%this, %obj, %col, %distanceFactor, %pos, %damageAmt)

Check if %obj's health - %damageAmt is less than or equal to 0.

I kinda meant all radius damage in general is that possible?

Code: [Select]
function GameConnection::onDeath(%client,%obj,%killer,%type,%area)
You should be able to use %type to determine if it was due to radius damage. Do some experimenting with it.

Well I'm having a lot of trouble on this, I'll continue trying everything I can.

How am I supposed to check if %type is equal to something like radiusdamage anyway? It doesn't make sense to directly type in if(%type == radiusdamage)
or "radiusdamage" can anyone help me out? :|

Package onDeath to echo %type
Get killed by an explosion
Check console
Package onDeath - if(%type $= "whatever console output is")

Except I think the types are weapon specific, and not just a general 'radius damage'

Well apparently you can't use %type to check for the type of death because no matter what every time you die the "type" of death is Body every time  you die I tried letting myself get shot to death in areas like the head to and it yielded same results there must be another way to check for death by radius damage. :|

That's what %area should be. That'd mean that some of the arguments I gave you are messed up OR your function is messed up. Could you post your function?

In addition, add this to your function:
Code: [Select]
echo(%client TAB %obj TAB %killer TAB %type TAB %area);Then test it out again and tell us what the console says.

I shot myself with a rocketlauncher at my feet
it says
Body (from the echo Headcrab Zombie said)
8245^6701^14^Body
Code: [Select]
package bloodbath
{
function GameConnection::onDeath(%this,%client,%obj,%killer,%type,%area)
{

echo(%type);
echo(%client TAB %obj TAB %killer TAB %type TAB %area);
%cp=%this.player;
%cp.mountImage(BleedImage,0);
%p = new projectile()
{
dataBlock = GoryDeathExplosionProjectile;
scale = ("0.5 0.5 0.5");
initialVelocity = ("0 0 0");
initialPosition = %cp.getPosition();
sourceObject = %cp;
sourceSlot = 0;
client = %this;
};






Parent::OnDeath(%this,%client,%obj,%killer,%type,%area);
}
};
activatePackage(bloodbath);

Yeah, wrong arguments
Code: [Select]
...
function GameConnection::onDeath(%this,%obj,%killer,%type,%area)
...

Yeah, wrong arguments
Yes. GameConnection is the class for clients, therefore the first argument is always the client.

sorry bout that guys :| heres the new code
Code: [Select]
package bloodbath
{
function GameConnection::onDeath(%client,%obj,%killer,%type,%area)
{
echo(%client TAB %obj TAB %killer TAB %type TAB %area);
%cp=%client.player;
%cp.mountImage(BleedImage,0);
%p = new projectile()
{
dataBlock = GoryDeathExplosionProjectile;
scale = ("0.5 0.5 0.5");
initialVelocity = ("0 0 0");
initialPosition = %cp.getPosition();
sourceObject = %cp;
sourceSlot = 0;
client = %this;
};
Parent::OnDeath(%client,%obj,%killer,%type,%area);
}
};
console says on death by rocketlauncher:
6701^8379(different everytime hurdur)^6701^14^body

1. If you don't want this to only work on players (ie you want it to affect bots) then you would want to package player::damage instead.
2. Check if $Damage::Direct[%type] is 0. If it is, it's radius damage that killed the player. If not, it was direct.

What variables are defined in player::damage?