Skip to content

Boolean Function that Determines Valid Location

Is there a command that can be used to determine if a location is accessible/valid?

EXAMPLE:
int IsThisLocationValid(location lSpot)
{
return ThisIsTheCommand(lSpot);
}

In short, will a selected location be inside a wall, unseen or inaccessible to the PC?

[I have created a Ring of Telekinesis that pushes useable placeables away from the ring-bearer; however, the placeables can end up inside walls. Wanting to check for that.]

Comments

  • ProlericProleric Member Posts: 1,268
    Create an invisible creature at the target location. If the resulting creature's location is significantly different, the target location is invalid, but the creature's location is a valid nearby spot.
    TerrorbleSmithicus
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    edited May 2020
    Can also use the new GetSurfaceMaterial(location) function without having to create any objects. Returns 0 on invalid location.
    Post edited by NeverwinterWights on
    TerrorbleSmithicus
  • SmithicusSmithicus Member Posts: 21
    Thank you both - I will start the experiments!
  • SmithicusSmithicus Member Posts: 21
    GetSurfaceMaterial(loc) works beautifully in identifying invalid locations. Thank you!
  • SmithicusSmithicus Member Posts: 21
    For clarity in future reviews of code, I made this for my library:
    int GetIsLocationValid(location loc)
    {
        return GetSurfaceMaterial(loc) ;
    }
    
    NOTE:
    // Get the surface material at the given location. (This is
    // equivalent to the walkmesh type).
    // Returns 0 if the location is invalid or has no surface type.
    int GetSurfaceMaterial(location at)
Sign In or Register to comment.