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!

Targeted location

for a mobile:
Point3D location = targeted.Location;

for an item in a pack:
Point2D location = targeted.Location;

I think that is what you are looking to do. This will get the x, y, z values of the target and store them in a single variable you can call later.

If you are looking to manipulate where the targeted thing (mobile or item) is located then I would do the following:

int locX = targeted.X;
int locY = targeted.Y;
int locZ = targeted.Z;

this will allow you to change where stuff is at easily.
 

Arrrr

Wanderer
From the signature
Code:
protected override void OnTarget( Mobile from, object targeted )

I want to being able to target the floor and know where that happened, but targeted is just an object.
 
Ahh ok, you need to add an extra if statement in there.

Code:
if (targeted is PlayerMobile)
{
    PlayerMobile pm = (PlayerMobile)targeted;
    Point3D loc = pm.Location;
}
else if (targeted is Item)
{
    Item stuff = (Item)targeted;
    Point3D loc = stuff.Locaiton;
}

You can then do what you are wanting to do with that location.

** note this is just quick code i typed here on my work pc and I have no idea if it will compile exactly as written.
 

Arrrr

Wanderer
Thanks for your suggestion, however if targeted is a tile (which is what i need) i cannot (or at least i don't know how) retrieve that information.
 
I cannot think of it off of the top of my head but there should be a tile object. I will get home from work in about 4 hours and I will try and find it then if no one else has an answer.

It will be solved much the same way just instead of PlayerMobile or Item it will be some other identifier.
 
I think this is what you are wanting. This will pull the location of what ever tile they click on.

Code:
                if (targeted is LandTarget)
                {
                    LandTarget targ = (LandTarget)targeted;
                    Point3D loc = targ.Location;
                }
 

Arrrr

Wanderer
I think this is what you are wanting. This will pull the location of what ever tile they click on.

Code:
                if (targeted is LandTarget)
                {
                    LandTarget targ = (LandTarget)targeted;
                    Point3D loc = targ.Location;
                }
humm, nice. I'll check it out now and tell you.
 
Top