RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Fixing Range

Fixing Range

Hello,

Well, here is the change I made to Utility.cs, since Geometry.cs already has Point3D defined, yet Utility.cs was not using it as defined:

Code:
public static bool InRange( Point3D p1, Point3D p2, int range )
		{
			return ( p1.m_X >= (p2.m_X - range) )
				&& ( p1.m_X <= (p2.m_X + range) )
				&& ( p1.m_Y >= (p2.m_Y - range) )
				&& ( p1.m_Y <= (p2.m_Y + range) )
				&& ( p1.m_Z >= (p2.m_Z - range) )
				&& ( p1.m_Z <= (p2.m_Z + range) );
		}

		public static bool InUpdateRange( Point3D p1, Point3D p2 )
		{
			return ( p1.m_X >= (p2.m_X - 18) )
				&& ( p1.m_X <= (p2.m_X + 18) )
				&& ( p1.m_Y >= (p2.m_Y - 18) )
				&& ( p1.m_Y <= (p2.m_Y + 18) )
				&& ( p1.m_Z >= (p2.m_Z - 18) )
				&& ( p1.m_Z <= (p2.m_Z + 18) );


I just added the Z component they already defined, so now you won't get someone on the third floor shooting or stealing from someone on the ground just because their X,Y is under range... now all three have to be.

A.V.
 

krrios

Administrator
That is not the intended functionality of those methods; they are not intended to check the Z coordinate.

If you are having issues with stealing or attacking on multiple floors, you may be trying it on a staff (GM+) character, or there is some other line of sight issue.
 
Hello,

Ok, then I guess I do not follow how range checks between target and targetee are done then.

I know it uses the InRange and int range checks, and Point3D even Defines itself using a Z range, but how are these implemented to calculate range between two people if not the Utility and Geometry script functions. Point3D is the only place I have found InRange at all....

A.V.
 
Top