Here is code to get the relative velocity vector.
function relativeVelocity(%dirVec, %velVec)
{
%pi = 4 * mAtan(1, 1);
//get the magnitude of the horizontal componenet of the velocity
%horMag = VectorLen(getWords(%velVec, 0, 1) SPC 0);
//the angle the velocity is being calculated from
%dirAng = mATan(getWord(%dirVec, 1), getWord(%dirVec, 0));
//the angle of the velocity with respect to the world
%velAng = mATan(getWord(%velVec, 1), getWord(%velVec, 0));
//get the relative angle of the velocity
%relAng = %velAng - %dirAng + %pi/2;
//Get the cartesian (x, y) values from the angle, scale it by the horizontal magnitude of the velocity, add the vertical component
%relVec = VectorAdd(VectorScale(mCos(%relAng) SPC mSin(%relAng) SPC 0, %horMag), "0 0" SPC getWord(%velVec, 2));
}
Edit: Made a small fix to the method.