Blockland Forums > Modification Help
Checking For Death by explosion
Headcrab Zombie:
Yeah, wrong arguments
--- Code: ---...
function GameConnection::onDeath(%this,%obj,%killer,%type,%area)
...
--- End code ---
Greek2me:
--- Quote from: Headcrab Zombie on August 08, 2011, 01:23:26 AM ---Yeah, wrong arguments
--- End quote ---
Yes. GameConnection is the class for clients, therefore the first argument is always the client.
Swollow:
sorry bout that guys :| heres the new code
--- Code: ---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);
}
};
--- End code ---
console says on death by rocketlauncher:
6701^8379(different everytime hurdur)^6701^14^body
Amade:
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.
Swollow:
What variables are defined in player::damage?