Getting a distance

Post » Tue Dec 29, 2009 8:00 pm

Hi.

I am in need of working out some distances. Id like to have a rough perimeter around my city, extending a short way outside the walls, but in the Wiki it mentions that using Player.GetDistance , which is what I wanted to do (Distance from a central object in the city) may not give accurate distances. Is there a way around this?

Id also like to know if there is a way to work out these distances from within the editor (or even from the console within the game).

I want to use this as a radius for guards chasing the player if a crime has been committed. If the player is within the radius set from the center of the city, and also within a radius set from the guard then the guard will give chase, however, if the player gets too far away from either the guard OR the center point of the city (therefore being some way outside of the city limits), then the guard will give up and return to his post.

Any ideas?

Cheers

MVK
User avatar
bimsy
 
Posts: 3541
Joined: Wed Oct 11, 2006 3:04 pm

Post » Wed Dec 30, 2009 5:32 am

It mentions specifically the Player.getdistance Object is unreliable, but Object.getdistance Player is reliable.

Just use that instead.
User avatar
Deon Knight
 
Posts: 3363
Joined: Thu Sep 13, 2007 1:44 am

Post » Tue Dec 29, 2009 7:06 pm

Bugger! :swear:

I read that as Actor.getdistance Player!

Okay, thanks showler!

Now then, is there a way to work out distances in the CS so that I can set the radius, or will I need to be in the game and the console? Iv found the Wiki page on Units, but its rather confusing: Is each cell 4096 units, and does that directly relate to the units that would be used with getDistance?

Also, if the player is within the city walls for example, and therefore within the range of the central object, do interior cells continue to be included within the radius? Does that make sense?

Ill try again just in case: If I use the Cathedral in the center of town for a base, and measure that X number of units puts a radius around the outside of the city the player can be detected as being within that radius. Will the player still be detected as inside that radius if he enters a building (that is inside that radius)?

Logic would suggest yes, but Ill ask anyway!

Cheers

MVK
User avatar
Abel Vazquez
 
Posts: 3334
Joined: Tue Aug 14, 2007 12:25 am

Post » Wed Dec 30, 2009 3:47 am

For measuring distances in the CS you may use http://www.tesnexus.com/downloads/file.php?id=27291


Turning on the cell grid also helps (press B)

If the outside of the walls is in the same worldspace as the city, "MyObject.getdistance player" is reliable.
If not, use GetInWorldspace to check if the player is in the city worldspace

And, if the player enters a building, getdistance will not return anything usefull (will return a huge value).

See also http://cs.elderscrolls.com/constwiki/index.php/IsInInterior and http://cs.elderscrolls.com/constwiki/index.php/GetInCell . May be of some use along the way
User avatar
KRistina Karlsson
 
Posts: 3383
Joined: Tue Jun 20, 2006 9:22 pm

Post » Tue Dec 29, 2009 7:38 pm

Thanks QQuix - I already found IsInInterior and GetInCell and now you confirmed that interiors will return an invalid distance I know Ill have to use them. I hadn't seen Phitt's measures though - Nice one!

Cheers

MVK
User avatar
Richard Dixon
 
Posts: 3461
Joined: Thu Jun 07, 2007 1:29 pm


Return to IV - Oblivion