Author Topic: Detecting a Mid-Air Kill  (Read 815 times)

How would I detect when a player makes a mid-air kill on another player?
There's a bottomprint when it happens, but I can't seem to package that.

Any ideas?

How about the function for getting the players velocity? Maybe you can check if their 'Z' velocity is positive or negative.

Maybe you can check if their 'Z' velocity is positive or negative.

Yeah, this works really well. It doesn't seem to be what the default system uses though, which seems to be more like just firiung a long raycast straight down; I'm not sure what the tolerance distance is though.

Yeah, this works really well. It doesn't seem to be what the default system uses though, which seems to be more like just firiung a long raycast straight down; I'm not sure what the tolerance distance is though.
I just found a piece of code from Munk's footstep sound mod.
Code: [Select]
function Player::IsOnGround(%player)
{
%pos = %player.getPosition();
%scale = %player.getScale();
%xs = getWord(%scale,0);
%ys = getWord(%scale,1);

%nw = vectorAdd(%pos,0 - (0.75 * %xs) SPC 0 - (0.75 * %ys) SPC 0);
%dnw = vectorAdd(%nw,"0 0 -0.5");
%ne = vectorAdd(%pos,(0.75 * %xs) SPC 0 - (0.75 * %ys) SPC 0);
%dne = vectorAdd(%ne,"0 0 -0.5");
%se = vectorAdd(%pos,(0.75 * %xs) SPC (0.75 * %ys) SPC 0);
%dse = vectorAdd(%se,"0 0 -0.5");
%sw = vectorAdd(%pos,0 - (0.75 * %xs) SPC (0.75 * %ys) SPC 0);
%dsw = vectorAdd(%sw,"0 0 -0.5");
%dpos = vectorAdd(%pos,"0 0 -0.5");

%raynw = ag_bicheck(getWord(containerRaycast(%nw,%dnw,$TypeMasks::FxBrickAlwaysObjectType|$TypeMasks::InteriorObjectType),0));
%rayne = ag_bicheck(getWord(containerRaycast(%ne,%dne,$TypeMasks::FxBrickAlwaysObjectType|$TypeMasks::InteriorObjectType),0));
%rayse = ag_bicheck(getWord(containerRaycast(%se,%dse,$TypeMasks::FxBrickAlwaysObjectType|$TypeMasks::InteriorObjectType),0));
%raysw = ag_bicheck(getWord(containerRaycast(%sw,%dsw,$TypeMasks::FxBrickAlwaysObjectType|$TypeMasks::InteriorObjectType),0));
%rayce = ag_bicheck(getWord(containerRaycast(%pos,%dpos,$TypeMasks::FxBrickAlwaysObjectType|$TypeMasks::InteriorObjectType),0));

if(%raynw || %rayne || %rayse || %raysw || %rayce)
{
return 1;
}
else
{
return 0;
}
}