
Originally Posted by
vwxz
Just a note. I had something similar in my woodcutter (see sig) that uses a median of pixel shift values. What I learned was that pixel shift was easy to put in but hard to tune to work right, let alone work right for different people (in the case of detecting character animation across different costumes). The biggest problem is that some costumes have huge pixel shifts during their standing idle animation, more than you get during a lot of activities. As such, I actually recommend not using pixel shift if there are easier alternatives for a given situation.
Pixelshift will still work great for any kind of animation, and for any specific target you're tracking. You could get a TPA of a certain color (for example your player's top & bottom) and calculate the amount of pixelshift of that TPA only. And, as you brought up certain outfits would effect it because of size. Well for this you don't have to use a static pixelshift count, instead use a percentage. Take a look at how MonkFishies detects a whirlpool:
Simba Code:
Function foundWhirlPool(Me: TEntity): Boolean;
var
b : TBox;
l : Integer;
tpa: TPointArray;
begin
result := false;
b := intToBox(myPlayer.BasePnt.X-17, myPlayer.Bounds.Y1-30, myPlayer.BasePnt.X+17, myPlayer.BasePnt.Y-5);
// Box "b" is directly north of our player
colorToleranceSpeed(2);
setColorSpeed2Modifiers(1.58, 0.29);
findColorsSpiralTolerance(MSCX, MSCY, tpa, 12433082, b.X1, b.Y1, b.X2, b.Y2, 13);
setColorSpeed2Modifiers(0.02, 0.02);
colorToleranceSpeed(1);
l := length(tpa);
if (l > 20) then
result := (getPixelShiftTPA(300, tpa) >= (l/6)); // If 1/6 (17%) of this TPA is moving then...
end;