Quote:
Originally Posted by Smurfin
does anyone know how ingame meter is calculated ?
I usually use this formula ($Y ^ 2 + $X ^ 2) / 2 where $y and $x are our target's coordinates subtracted by our own coordinates, not the exact metric used by the game but good enough to filter surrounding players/mobs by distance
|
This would be what we use.
Func GetRealXYZ($RawX, $RawY, $RawZ)
Local $RealXYZ
$RealX = ($RawX + 4000) / 10
$RealY = ($RawY + 5500) / 10
$RealZ = $RawZ / 10
Return $RealX & "," & $RealY & "," & $RealZ
EndFunc ;==>
Func GetGrade($X1, $Y1, $Z1, $X2, $Y2, $Z2)
Local $RISE, $RUN, $GRADE
$RISE = GetSlopeDistance($X1, $Y1, $Z1, $X2, $Y2, $Z2)
$RUN = GetDistance($X1, $Y1, $X2, $Y2)
$GRADE = ($RUN / $RISE) * 100
Return $GRADE
EndFunc ;==>
Func GetDistance($X1, $Y1, $X2, $Y2)
GetRealXYZ($X1, $Y1, "")
Local $DIS
$DIS = Round(10*Sqrt(($X1-$X2)^2+($Y1-$Y2)^2), 1)
Return $DIS
EndFunc ;==>
Func GetSlopeDistance($X1, $Y1, $Z1, $X2, $Y2, $Z2)
Local $DIS
$DIS = Round(10*Sqrt(($X1-$X2)^2+($Y1-$Y2)^2+($Z1-$Z2)^2), 1)
Return $DIS
EndFunc ;==>
Here is an example from our npcarray.
Code:
$array[$n][6] = _MemoryRead($NPCPointer + $OFFSET_NPCX, $PROCESS_INFORMATION, 'float') ;X
$array[$n][7] = _MemoryRead($NPCPointer + $OFFSET_NPCY, $PROCESS_INFORMATION, 'float') ;Y
$array[$n][8] = _MemoryRead($NPCPointer + $OFFSET_NPCZ, $PROCESS_INFORMATION, 'float') ;Z
$array[$n][9] = $NPCPointer ;NPC Base
$array[$n][10] = GetSlopeDistance(($X + 4000) / 10, ($Y + 5500) / 10, $Z / 10, ($array[$n][6] + 4000) / 10, ($array[$n][7] + 5500) / 10, $array[$n][8] / 10)
$array[$n][11] = GetSlopeDistance(($HOME_X + 4000) / 10, ($HOME_Y + 5500) / 10, $HOME_Z / 10, ($array[$n][6] + 4000) / 10, ($array[$n][7] + 5500) / 10, $array[$n][8] / 10)