From NWN Lexicon
Jump to navigationJump to search
Nwnee logo.jpg Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.

Get the surface material at the given location.

int GetSurfaceMaterial(
    location at


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).

For a little more information about walkmeshes see the NWN Wiki.


This function was added in 1.74.8156 of NWN:EE.


void main()
    // 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!");

See Also

functions: GetGroundHeight()