FANDOM


// MAP 3/24/2009
// Returns a bitmask composed of 0 or more SM_* values.
int GetSurfaceMaterialsAtLocation(location lLocation);

When using this function it helps to think of the return value as a number within a range rather than a constant value.

To clarify, if I wanted something to happen when my PC was standing on a particular type of terrain using this:

 object oPC = OBJECT_SELF;
 int nDirt = GetSurfaceMaterialsAtLocation(GetLocation(oPC));
 
 if (nDirt == SM_TYPE_DIRT)
 {
     DoThis();
 }

It wouldn't work because nDirt will almost never be equal to SM_TYPE_DIRT, despite the dark brown patch of dirt it looks like the PC is standing on. To actually have something happen while the PC is standing on a "Dirt" type terrain I would use this:

 object oPC = OBJECT_SELF;
 int nTerrain = GetSurfaceMaterialsAtLocation(GetLocation(oPC));
 
 if ((nTerrain >= SM_TYPE_DIRT) && (nTerrain < SM_TYPE_GRASS))
 {
     DoThat();
 }

Because the range of surface materials that represent the dirt bitmasks are between SM_TYPE_DIRT (8) and SM_TYPE_GRASS (16).

  • Added in Patch 1.23

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.