Aller au contenu

Photo

Is there a function that finds nearest valid location.


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I need to find the nearest valid location to a given location if that location is not valid.  I checked the lexicon and the function library and couldn't find one.  Surely this function exists.

Thanks for help.

Matt

#2
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Nevermind.

#3
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
In the future, if you come up with an answer yourself, please post what that was. This is just so that others with the same question can come here and find out too.



I believe the function you were looking for is CalcSafeLocation()?

#4
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I actually didn't find the function, I just scripted around the need for the function. Since my needs are pretty particular, I doubt they will be useful, but here it is:



I wanted a creature to move to a certain location or the nearest location to the intended location. The problem was that if the location was not valid, the creature would just stay put and not move at all.



So I used the #include position functions to set up a loop that incrementally deleted 0.1 from the distance to move until the location was valid, and it worked.



I don't have the code here in front of me and it is too complex for me to remember, but if anyone wants it, just send me a message.








#5
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Yeah, CalcSafeLocation() sounds about right. I always get hung up looking for functions that start with "get" when I want information returned to me. Thanks Knightmare.

#6
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
NP. And yeah, when using the Script Assist filter, do like you might when trying to Google a subject, try different word/search terms using the "best" words first. In your example above searching for "location" will give you all the functions that deal with that sort of thing. :)

#7
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Good advice. Thanks.