Get the surface material at the given location.
- The location to check the surface material of.
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.
This primarily can be used to check the different information in the surfacemat.2da file. The column "Walk" shows the location is walkable, for instance. Other useful columns may be "Sound" that is a lookup to footstepsounds.2da or "IsWater" to see if the location is on some water (walkable or not).
This function was added in 1.74.8156 of NWN:EE.
// Lookup the location of a waypoint
object oWaypoint = GetObjectByTag("my_waypoint");
// Get the surface type
int nSurfaceType = GetSurfaceMaterial(GetLocation(oWaypoint));
// Is this waypoint on a valid, walkable, surface? Eg; we can spawn a creature
int bWalkable = StringToInt(Get2DAString("surfacemat", "Walk", nSurfaceType));
PostString(GetFirstPC(), "The location at my_waypoint is walkable!");
PostString(GetFirstPC(), "The location at my_waypoint is not walkable!");